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