export_modules revision e64031e20c39650a7bc902a3e1aba613b9415dee
2N/A#!/bin/sh
2N/A
2N/A#
2N/A# Create a tar archive containing the sources of the Linux guest kernel
2N/A# modules
2N/A#
2N/A# Copyright (C) 2006-2007 Oracle Corporation
2N/A#
2N/A# This file is part of VirtualBox Open Source Edition (OSE), as
2N/A# available from http://www.virtualbox.org. This file is free software;
2N/A# you can redistribute it and/or modify it under the terms of the GNU
2N/A# General Public License (GPL) as published by the Free Software
2N/A# Foundation, in version 2 as it comes in the "COPYING" file of the
2N/A# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
2N/A# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
2N/A#
2N/A
2N/Aif [ -z "$1" ]; then
2N/A echo "Usage: $0 <filename.tar.gz>"
2N/A echo " Export VirtualBox kernel modules to <filename.tar.gz>"
2N/A exit 1
2N/Afi
2N/A
2N/APATH_TMP="`cd \`dirname $1\`; pwd`/.vbox_modules"
2N/APATH_OUT=$PATH_TMP
2N/AFILE_OUT="`cd \`dirname $1\`; pwd`/`basename $1`"
2N/APATH_ROOT="`cd \`dirname $0\`/../../../..; pwd`"
2N/APATH_VBOXGUEST="$PATH_ROOT/src/VBox/Additions/common/VBoxGuest"
2N/APATH_VBOXVFS="$PATH_ROOT/src/VBox/Additions/linux/sharedfolders"
2N/A
2N/AVBOX_VERSION_MAJOR=`sed -e "s/^ *VBOX_VERSION_MAJOR *= \+\([0-9]\+\)/\1/;t;d" $PATH_ROOT/Config.kmk`
2N/AVBOX_VERSION_MINOR=`sed -e "s/^ *VBOX_VERSION_MINOR *= \+\([0-9]\+\)/\1/;t;d" $PATH_ROOT/Config.kmk`
2N/AVBOX_VERSION_BUILD=`sed -e "s/^ *VBOX_VERSION_BUILD *= \+\([0-9]\+\)/\1/;t;d" $PATH_ROOT/Config.kmk`
2N/A
2N/A. $PATH_VBOXGUEST/linux/files_vboxguest
2N/A. $PATH_VBOXVFS/files_vboxvfs
2N/A
2N/A# Temporary path for creating the modules, will be removed later
2N/Amkdir $PATH_TMP || exit 1
2N/A
2N/A# Create auto-generated version file, needed by all modules
2N/Aecho "#ifndef __version_generated_h__" > $PATH_TMP/version-generated.h
2N/Aecho "#define __version_generated_h__" >> $PATH_TMP/version-generated.h
2N/Aecho "" >> $PATH_TMP/version-generated.h
2N/Aecho "#define VBOX_VERSION_MAJOR $VBOX_VERSION_MAJOR" >> $PATH_TMP/version-generated.h
2N/Aecho "#define VBOX_VERSION_MINOR $VBOX_VERSION_MINOR" >> $PATH_TMP/version-generated.h
2N/Aecho "#define VBOX_VERSION_BUILD $VBOX_VERSION_BUILD" >> $PATH_TMP/version-generated.h
2N/Aecho "#define VBOX_VERSION_STRING \"$VBOX_VERSION_MAJOR.$VBOX_VERSION_MINOR.$VBOX_VERSION_BUILD\"" >> $PATH_TMP/version-generated.h
2N/Aecho "" >> $PATH_TMP/version-generated.h
2N/Aecho "#endif" >> $PATH_TMP/version-generated.h
2N/A
2N/A# vboxguest (VirtualBox guest kernel module)
2N/Amkdir $PATH_TMP/vboxguest || exit 1
2N/Afor f in $FILES_VBOXGUEST_NOBIN; do
2N/A install -D -m 0644 `echo $f|cut -d'=' -f1` "$PATH_TMP/vboxguest/`echo $f|cut -d'>' -f2`"
2N/Adone
2N/Afor f in $FILES_VBOXGUEST_BIN; do
2N/A install -D -m 0755 `echo $f|cut -d'=' -f1` "$PATH_TMP/vboxguest/`echo $f|cut -d'>' -f2`"
2N/Adone
2N/A
2N/A# vboxvfs (VirtualBox guest kernel module for shared folders)
2N/Amkdir $PATH_TMP/vboxvfs || exit 1
2N/Afor f in $FILES_VBOXVFS_NOBIN; do
2N/A install -D -m 0644 `echo $f|cut -d'=' -f1` "$PATH_TMP/vboxvfs/`echo $f|cut -d'>' -f2`"
2N/Adone
2N/Afor f in $FILES_VBOXVFS_BIN; do
2N/A install -D -m 0755 `echo $f|cut -d'=' -f1` "$PATH_TMP/vboxvfs/`echo $f|cut -d'>' -f2`"
2N/Adone
2N/A
2N/A# Only temporary, omit from archive
2N/Arm $PATH_TMP/version-generated.h
2N/A
2N/A# Create the archive
2N/Atar -czf $FILE_OUT -C $PATH_TMP . || exit 1
2N/A
2N/A# Remove the temporary directory
2N/Arm -r $PATH_TMP
2N/A
2N/A