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-2007 innotek 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 [ -z "$1" ]; then
|
---|
18 | echo "Usage: $0 <filename.tar.gz>"
|
---|
19 | echo " Export VirtualBox kernel modules to <filename.tar.gz>"
|
---|
20 | exit 1
|
---|
21 | fi
|
---|
22 |
|
---|
23 | PATH_TMP="`cd \`dirname $1\`; pwd`/.vbox_modules"
|
---|
24 | PATH_OUT=$PATH_TMP
|
---|
25 | FILE_OUT="`cd \`dirname $1\`; pwd`/`basename $1`"
|
---|
26 | PATH_ROOT="`cd \`dirname $0\`/../../../..; pwd`"
|
---|
27 | PATH_VBOXADD="$PATH_ROOT/src/VBox/Additions/linux/module"
|
---|
28 | PATH_VBOXVFS="$PATH_ROOT/src/VBox/Additions/linux/sharedfolders"
|
---|
29 |
|
---|
30 | VBOX_VERSION_MAJOR=`sed -e "s/^ *VBOX_VERSION_MAJOR *= \+\([0-9]\+\)/\1/;t;d" $PATH_ROOT/Config.kmk`
|
---|
31 | VBOX_VERSION_MINOR=`sed -e "s/^ *VBOX_VERSION_MINOR *= \+\([0-9]\+\)/\1/;t;d" $PATH_ROOT/Config.kmk`
|
---|
32 | VBOX_VERSION_BUILD=`sed -e "s/^ *VBOX_VERSION_BUILD *= \+\([0-9]\+\)/\1/;t;d" $PATH_ROOT/Config.kmk`
|
---|
33 |
|
---|
34 | . $PATH_VBOXADD/files_vboxadd
|
---|
35 | . $PATH_VBOXVFS/files_vboxvfs
|
---|
36 |
|
---|
37 | # Temporary path for creating the modules, will be removed later
|
---|
38 | mkdir $PATH_TMP || exit 1
|
---|
39 |
|
---|
40 | # Create auto-generated version file, needed by all modules
|
---|
41 | echo "#ifndef __version_generated_h__" > $PATH_TMP/version-generated.h
|
---|
42 | echo "#define __version_generated_h__" >> $PATH_TMP/version-generated.h
|
---|
43 | echo "" >> $PATH_TMP/version-generated.h
|
---|
44 | echo "#define VBOX_VERSION_MAJOR $VBOX_VERSION_MAJOR" >> $PATH_TMP/version-generated.h
|
---|
45 | echo "#define VBOX_VERSION_MINOR $VBOX_VERSION_MINOR" >> $PATH_TMP/version-generated.h
|
---|
46 | echo "#define VBOX_VERSION_BUILD $VBOX_VERSION_BUILD" >> $PATH_TMP/version-generated.h
|
---|
47 | echo "#define VBOX_VERSION_STRING \"$VBOX_VERSION_MAJOR.$VBOX_VERSION_MINOR.$VBOX_VERSION_BUILD\"" >> $PATH_TMP/version-generated.h
|
---|
48 | echo "" >> $PATH_TMP/version-generated.h
|
---|
49 | echo "#endif" >> $PATH_TMP/version-generated.h
|
---|
50 |
|
---|
51 | # vboxadd (VirtualBox guest kernel module)
|
---|
52 | mkdir $PATH_TMP/vboxadd || exit 1
|
---|
53 | for f in $FILES_VBOXADD_NOBIN; do
|
---|
54 | install -D -m 0644 `echo $f|cut -d'=' -f1` "$PATH_TMP/vboxadd/`echo $f|cut -d'>' -f2`"
|
---|
55 | done
|
---|
56 | for f in $FILES_VBOXADD_BIN; do
|
---|
57 | install -D -m 0755 `echo $f|cut -d'=' -f1` "$PATH_TMP/vboxadd/`echo $f|cut -d'>' -f2`"
|
---|
58 | done
|
---|
59 |
|
---|
60 | # vboxvfs (VirtualBox guest kernel module for shared folders)
|
---|
61 | mkdir $PATH_TMP/vboxvfs || exit 1
|
---|
62 | for f in $FILES_VBOXVFS_NOBIN; do
|
---|
63 | install -D -m 0644 `echo $f|cut -d'=' -f1` "$PATH_TMP/vboxvfs/`echo $f|cut -d'>' -f2`"
|
---|
64 | done
|
---|
65 | for f in $FILES_VBOXVFS_BIN; do
|
---|
66 | install -D -m 0755 `echo $f|cut -d'=' -f1` "$PATH_TMP/vboxvfs/`echo $f|cut -d'>' -f2`"
|
---|
67 | done
|
---|
68 |
|
---|
69 | # Only temporary, omit from archive
|
---|
70 | rm $PATH_TMP/version-generated.h
|
---|
71 |
|
---|
72 | # Create the archive
|
---|
73 | tar -czf $FILE_OUT -C $PATH_TMP . || exit 1
|
---|
74 |
|
---|
75 | # Remove the temporary directory
|
---|
76 | rm -r $PATH_TMP
|
---|
77 |
|
---|