export_modules revision 80096fb54d147045204dcc7e3ff273158de03f81
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen# Create a tar archive containing the sources of the Linux guest kernel
16c89b1260c9d07c01c83a9219424d3727069b2eTimo Sirainen# Copyright (C) 2006-2007 Oracle Corporation
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen# This file is part of VirtualBox Open Source Edition (OSE), as
6a19e109ee8c5a6f688da83a86a7f6abeb71abddTimo Sirainen# available from http://www.virtualbox.org. This file is free software;
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen# you can redistribute it and/or modify it under the terms of the GNU
d9fdacd5fb3e07997e5c389739d2054f0c8441d8Timo Sirainen# General Public License (GPL) as published by the Free Software
d9fdacd5fb3e07997e5c389739d2054f0c8441d8Timo Sirainen# Foundation, in version 2 as it comes in the "COPYING" file of the
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
31ddc75584c5cde53d2e78a737587f2e7fdcb0d2Timo Sirainenif [ -z "$1" ]; then
8887bf3757d51d73887dd20b1db3334d867d3817Timo Sirainen echo "Usage: $0 <filename.tar.gz>"
8887bf3757d51d73887dd20b1db3334d867d3817Timo Sirainen echo " Export VirtualBox kernel modules to <filename.tar.gz>"
a53cb86b4d733d9c48ee4d285bed477c80825804Timo SirainenPATH_TMP="`cd \`dirname $1\`; pwd`/.vbox_modules"
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo SirainenFILE_OUT="`cd \`dirname $1\`; pwd`/`basename $1`"
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo SirainenPATH_ROOT="`cd \`dirname $0\`/../../../..; pwd`"
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo SirainenPATH_VBOXGUEST="$PATH_ROOT/src/VBox/Additions/common/VBoxGuest"
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo SirainenPATH_VBOXSF="$PATH_ROOT/src/VBox/Additions/linux/sharedfolders"
fd3d711f219fd6813492acbe051e04327f0ca0f0Timo SirainenVBOX_VERSION_MAJOR=`sed -e "s/^ *VBOX_VERSION_MAJOR *= \+\([0-9]\+\)/\1/;t;d" $PATH_ROOT/Config.kmk`
e12648867876aaec17e06ee4caef0bb60363449dTimo SirainenVBOX_VERSION_MINOR=`sed -e "s/^ *VBOX_VERSION_MINOR *= \+\([0-9]\+\)/\1/;t;d" $PATH_ROOT/Config.kmk`
e12648867876aaec17e06ee4caef0bb60363449dTimo SirainenVBOX_VERSION_BUILD=`sed -e "s/^ *VBOX_VERSION_BUILD *= \+\([0-9]\+\)/\1/;t;d" $PATH_ROOT/Config.kmk`
fd3d711f219fd6813492acbe051e04327f0ca0f0Timo Sirainen# Temporary path for creating the modules, will be removed later
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen# Create auto-generated version file, needed by all modules
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenecho "#ifndef __version_generated_h__" > $PATH_TMP/version-generated.h
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenecho "#define __version_generated_h__" >> $PATH_TMP/version-generated.h
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenecho "#define VBOX_VERSION_MAJOR $VBOX_VERSION_MAJOR" >> $PATH_TMP/version-generated.h
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenecho "#define VBOX_VERSION_MINOR $VBOX_VERSION_MINOR" >> $PATH_TMP/version-generated.h
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenecho "#define VBOX_VERSION_BUILD $VBOX_VERSION_BUILD" >> $PATH_TMP/version-generated.h
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenecho "#define VBOX_VERSION_STRING \"$VBOX_VERSION_MAJOR.$VBOX_VERSION_MINOR.$VBOX_VERSION_BUILD\"" >> $PATH_TMP/version-generated.h
024815ea2ffdda9ea79919f18e865663977f73eaTimo Sirainen# vboxguest (VirtualBox guest kernel module)
811f2e26d9782d9cb99fdf82e18ffa0a77564fe2Timo Sirainen install -D -m 0644 `echo $f|cut -d'=' -f1` "$PATH_TMP/vboxguest/`echo $f|cut -d'>' -f2`"
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen install -D -m 0755 `echo $f|cut -d'=' -f1` "$PATH_TMP/vboxguest/`echo $f|cut -d'>' -f2`"
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen# vboxsf (VirtualBox guest kernel module for shared folders)
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen install -D -m 0644 `echo $f|cut -d'=' -f1` "$PATH_TMP/vboxsf/`echo $f|cut -d'>' -f2`"
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen install -D -m 0755 `echo $f|cut -d'=' -f1` "$PATH_TMP/vboxsf/`echo $f|cut -d'>' -f2`"
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen# Only temporary, omit from archive
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen# Create the archive
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen# Remove the temporary directory