1 | #!/bin/sh
|
---|
2 |
|
---|
3 | #
|
---|
4 | # Create a tar archive containing the sources of the Linux guest kernel
|
---|
5 | # modules
|
---|
6 | #
|
---|
7 | # Copyright (C) 2006 InnoTek Systemberatung GmbH
|
---|
8 | #
|
---|
9 | # This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | # available from http://www.virtualbox.org. This file is free software;
|
---|
11 | # you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | # General Public License as published by the Free Software Foundation,
|
---|
13 | # in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
|
---|
14 | # distribution. VirtualBox OSE is distributed in the hope that it will
|
---|
15 | # be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | #
|
---|
17 | # If you received this file as part of a commercial VirtualBox
|
---|
18 | # distribution, then only the terms of your commercial VirtualBox
|
---|
19 | # license agreement apply instead of the previous paragraph.
|
---|
20 | #
|
---|
21 |
|
---|
22 | if [ -z "$1" ]; then
|
---|
23 | echo "Usage: $0 <filename.tar.gz>"
|
---|
24 | echo " Export VirtualBox kernel modules to <filename.tar.gz>"
|
---|
25 | exit 1
|
---|
26 | fi
|
---|
27 |
|
---|
28 | PATH_TMP="`cd \`dirname $1\`; pwd`/.vbox_modules"
|
---|
29 | PATH_OUT=$PATH_TMP
|
---|
30 | FILE_OUT="`cd \`dirname $1\`; pwd`/`basename $1`"
|
---|
31 | PATH_ROOT="`cd \`dirname $0\`/../../../..; pwd`"
|
---|
32 | PATH_VBOXADD="$PATH_ROOT/src/VBox/Additions/linux/module"
|
---|
33 | PATH_VBOXVFS="$PATH_ROOT/src/VBox/Additions/linux/sharedfolders"
|
---|
34 |
|
---|
35 | VBOX_VERSION_MAJOR=`sed -e "s/^ *VBOX_VERSION_MAJOR *= \+\([0-9]\+\)/\1/;t;d" $PATH_ROOT/Config.kmk`
|
---|
36 | VBOX_VERSION_MINOR=`sed -e "s/^ *VBOX_VERSION_MINOR *= \+\([0-9]\+\)/\1/;t;d" $PATH_ROOT/Config.kmk`
|
---|
37 | VBOX_VERSION_BUILD=`sed -e "s/^ *VBOX_VERSION_BUILD *= \+\([0-9]\+\)/\1/;t;d" $PATH_ROOT/Config.kmk`
|
---|
38 |
|
---|
39 | . $PATH_VBOXADD/files_vboxadd
|
---|
40 | . $PATH_VBOXVFS/files_vboxvfs
|
---|
41 |
|
---|
42 | # Temporary path for creating the modules, will be removed later
|
---|
43 | mkdir $PATH_TMP || exit 1
|
---|
44 |
|
---|
45 | # Create auto-generated version file, needed by all modules
|
---|
46 | echo "#ifndef __version_generated_h__" > $PATH_TMP/version-generated.h
|
---|
47 | echo "#define __version_generated_h__" >> $PATH_TMP/version-generated.h
|
---|
48 | echo "" >> $PATH_TMP/version-generated.h
|
---|
49 | echo "#define VBOX_VERSION_MAJOR $VBOX_VERSION_MAJOR" >> $PATH_TMP/version-generated.h
|
---|
50 | echo "#define VBOX_VERSION_MINOR $VBOX_VERSION_MINOR" >> $PATH_TMP/version-generated.h
|
---|
51 | echo "#define VBOX_VERSION_BUILD $VBOX_VERSION_BUILD" >> $PATH_TMP/version-generated.h
|
---|
52 | echo "#define VBOX_VERSION_STRING \"$VBOX_VERSION_MAJOR.$VBOX_VERSION_MINOR.$VBOX_VERSION_BUILD\"" >> $PATH_TMP/version-generated.h
|
---|
53 | echo "" >> $PATH_TMP/version-generated.h
|
---|
54 | echo "#endif" >> $PATH_TMP/version-generated.h
|
---|
55 |
|
---|
56 | # vboxadd (VirtualBox guest kernel module)
|
---|
57 | mkdir $PATH_TMP/vboxadd || exit 1
|
---|
58 | for f in $FILES_VBOXADD_NOBIN; do
|
---|
59 | install -D -m 0644 `echo $f|cut -d'=' -f1` "$PATH_TMP/vboxadd/`echo $f|cut -d'>' -f2`"
|
---|
60 | done
|
---|
61 | for f in $FILES_VBOXADD_BIN; do
|
---|
62 | install -D -m 0755 `echo $f|cut -d'=' -f1` "$PATH_TMP/vboxadd/`echo $f|cut -d'>' -f2`"
|
---|
63 | done
|
---|
64 |
|
---|
65 | # vboxvfs (VirtualBox guest kernel module for shared folders)
|
---|
66 | mkdir $PATH_TMP/vboxvfs || exit 1
|
---|
67 | for f in $FILES_VBOXVFS_NOBIN; do
|
---|
68 | install -D -m 0644 `echo $f|cut -d'=' -f1` "$PATH_TMP/vboxvfs/`echo $f|cut -d'>' -f2`"
|
---|
69 | done
|
---|
70 | for f in $FILES_VBOXVFS_BIN; do
|
---|
71 | install -D -m 0755 `echo $f|cut -d'=' -f1` "$PATH_TMP/vboxvfs/`echo $f|cut -d'>' -f2`"
|
---|
72 | done
|
---|
73 |
|
---|
74 | # Only temporary, omit from archive
|
---|
75 | rm $PATH_TMP/version-generated.h
|
---|
76 |
|
---|
77 | # Create the archive
|
---|
78 | tar -czf $FILE_OUT -C $PATH_TMP . || exit 1
|
---|
79 |
|
---|
80 | # Remove the temporary directory
|
---|
81 | rm -r $PATH_TMP
|
---|
82 |
|
---|