export_modules revision e64031e20c39650a7bc902a3e1aba613b9415dee
2c1ca08d7e82859835cdb7daa00651db86c7cbd4Luke Smith# Create a tar archive containing the sources of the Linux guest kernel
afd6c54b4b2a0eb021233651a894e5a3ce3f1ca4Luke Smith# Copyright (C) 2006-2007 Oracle Corporation
2c1ca08d7e82859835cdb7daa00651db86c7cbd4Luke Smith# This file is part of VirtualBox Open Source Edition (OSE), as
afd6c54b4b2a0eb021233651a894e5a3ce3f1ca4Luke Smith# available from http://www.virtualbox.org. This file is free software;
afd6c54b4b2a0eb021233651a894e5a3ce3f1ca4Luke Smith# you can redistribute it and/or modify it under the terms of the GNU
afd6c54b4b2a0eb021233651a894e5a3ce3f1ca4Luke Smith# General Public License (GPL) as published by the Free Software
afd6c54b4b2a0eb021233651a894e5a3ce3f1ca4Luke Smith# Foundation, in version 2 as it comes in the "COPYING" file of the
afd6c54b4b2a0eb021233651a894e5a3ce3f1ca4Luke Smith# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
2c1ca08d7e82859835cdb7daa00651db86c7cbd4Luke Smith# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
2c1ca08d7e82859835cdb7daa00651db86c7cbd4Luke Smithif [ -z "$1" ]; then
2c1ca08d7e82859835cdb7daa00651db86c7cbd4Luke Smith echo "Usage: $0 <filename.tar.gz>"
2c1ca08d7e82859835cdb7daa00651db86c7cbd4Luke Smith echo " Export VirtualBox kernel modules to <filename.tar.gz>"
2c1ca08d7e82859835cdb7daa00651db86c7cbd4Luke SmithPATH_VBOXGUEST="$PATH_ROOT/src/VBox/Additions/common/VBoxGuest"
2c1ca08d7e82859835cdb7daa00651db86c7cbd4Luke SmithPATH_VBOXVFS="$PATH_ROOT/src/VBox/Additions/linux/sharedfolders"
2c1ca08d7e82859835cdb7daa00651db86c7cbd4Luke SmithVBOX_VERSION_MAJOR=`sed -e "s/^ *VBOX_VERSION_MAJOR *= \+\([0-9]\+\)/\1/;t;d" $PATH_ROOT/Config.kmk`
2c1ca08d7e82859835cdb7daa00651db86c7cbd4Luke SmithVBOX_VERSION_MINOR=`sed -e "s/^ *VBOX_VERSION_MINOR *= \+\([0-9]\+\)/\1/;t;d" $PATH_ROOT/Config.kmk`
85d2d33f7ddef4ec0abb9158d36275151660764aLuke SmithVBOX_VERSION_BUILD=`sed -e "s/^ *VBOX_VERSION_BUILD *= \+\([0-9]\+\)/\1/;t;d" $PATH_ROOT/Config.kmk`
2c1ca08d7e82859835cdb7daa00651db86c7cbd4Luke Smith# Temporary path for creating the modules, will be removed later
2c1ca08d7e82859835cdb7daa00651db86c7cbd4Luke Smith# Create auto-generated version file, needed by all modules
2c1ca08d7e82859835cdb7daa00651db86c7cbd4Luke Smithecho "#ifndef __version_generated_h__" > $PATH_TMP/version-generated.h
2c1ca08d7e82859835cdb7daa00651db86c7cbd4Luke Smithecho "#define __version_generated_h__" >> $PATH_TMP/version-generated.h
2c1ca08d7e82859835cdb7daa00651db86c7cbd4Luke Smithecho "#define VBOX_VERSION_MAJOR $VBOX_VERSION_MAJOR" >> $PATH_TMP/version-generated.h
2c1ca08d7e82859835cdb7daa00651db86c7cbd4Luke Smithecho "#define VBOX_VERSION_MINOR $VBOX_VERSION_MINOR" >> $PATH_TMP/version-generated.h
2c1ca08d7e82859835cdb7daa00651db86c7cbd4Luke Smithecho "#define VBOX_VERSION_BUILD $VBOX_VERSION_BUILD" >> $PATH_TMP/version-generated.h
2c1ca08d7e82859835cdb7daa00651db86c7cbd4Luke Smithecho "#define VBOX_VERSION_STRING \"$VBOX_VERSION_MAJOR.$VBOX_VERSION_MINOR.$VBOX_VERSION_BUILD\"" >> $PATH_TMP/version-generated.h
2c1ca08d7e82859835cdb7daa00651db86c7cbd4Luke Smith# vboxguest (VirtualBox guest kernel module)
2c1ca08d7e82859835cdb7daa00651db86c7cbd4Luke Smith install -D -m 0644 `echo $f|cut -d'=' -f1` "$PATH_TMP/vboxguest/`echo $f|cut -d'>' -f2`"
2c1ca08d7e82859835cdb7daa00651db86c7cbd4Luke Smith install -D -m 0755 `echo $f|cut -d'=' -f1` "$PATH_TMP/vboxguest/`echo $f|cut -d'>' -f2`"
a1db253efdfe10b47f002c23646d43a887e2aeeaLuke Smith# vboxvfs (VirtualBox guest kernel module for shared folders)
a1db253efdfe10b47f002c23646d43a887e2aeeaLuke Smith install -D -m 0644 `echo $f|cut -d'=' -f1` "$PATH_TMP/vboxvfs/`echo $f|cut -d'>' -f2`"
a1db253efdfe10b47f002c23646d43a887e2aeeaLuke Smith install -D -m 0755 `echo $f|cut -d'=' -f1` "$PATH_TMP/vboxvfs/`echo $f|cut -d'>' -f2`"
a1db253efdfe10b47f002c23646d43a887e2aeeaLuke Smith# Only temporary, omit from archive
a1db253efdfe10b47f002c23646d43a887e2aeeaLuke Smith# Create the archive
a1db253efdfe10b47f002c23646d43a887e2aeeaLuke Smith# Remove the temporary directory