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 Oracle Corporation
|
---|
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 (GPL) as published by the Free Software
|
---|
13 | # Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | # VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | # hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | #
|
---|
17 |
|
---|
18 | if [ -z "$1" ]; then
|
---|
19 | echo "Usage: $0 <filename.tar.gz>"
|
---|
20 | echo " Export VirtualBox kernel modules to <filename.tar.gz>"
|
---|
21 | exit 1
|
---|
22 | fi
|
---|
23 |
|
---|
24 | PATH_TMP="`cd \`dirname $1\`; pwd`/.vbox_modules"
|
---|
25 | PATH_OUT=$PATH_TMP
|
---|
26 | FILE_OUT="`cd \`dirname $1\`; pwd`/`basename $1`"
|
---|
27 | PATH_ROOT="`cd \`dirname $0\`/../../../..; pwd`"
|
---|
28 | PATH_VBOXGUEST="$PATH_ROOT/src/VBox/Additions/common/VBoxGuest"
|
---|
29 | PATH_VBOXSF="$PATH_ROOT/src/VBox/Additions/linux/sharedfolders"
|
---|
30 |
|
---|
31 | VBOX_VERSION_MAJOR=`sed -e "s/^ *VBOX_VERSION_MAJOR *= \+\([0-9]\+\)/\1/;t;d" $PATH_ROOT/Config.kmk`
|
---|
32 | VBOX_VERSION_MINOR=`sed -e "s/^ *VBOX_VERSION_MINOR *= \+\([0-9]\+\)/\1/;t;d" $PATH_ROOT/Config.kmk`
|
---|
33 | VBOX_VERSION_BUILD=`sed -e "s/^ *VBOX_VERSION_BUILD *= \+\([0-9]\+\)/\1/;t;d" $PATH_ROOT/Config.kmk`
|
---|
34 |
|
---|
35 | . $PATH_VBOXGUEST/linux/files_vboxguest
|
---|
36 | . $PATH_VBOXSF/files_vboxsf
|
---|
37 |
|
---|
38 | # Temporary path for creating the modules, will be removed later
|
---|
39 | mkdir $PATH_TMP || exit 1
|
---|
40 |
|
---|
41 | # Create auto-generated version file, needed by all modules
|
---|
42 | echo "#ifndef __version_generated_h__" > $PATH_TMP/version-generated.h
|
---|
43 | echo "#define __version_generated_h__" >> $PATH_TMP/version-generated.h
|
---|
44 | echo "" >> $PATH_TMP/version-generated.h
|
---|
45 | echo "#define VBOX_VERSION_MAJOR $VBOX_VERSION_MAJOR" >> $PATH_TMP/version-generated.h
|
---|
46 | echo "#define VBOX_VERSION_MINOR $VBOX_VERSION_MINOR" >> $PATH_TMP/version-generated.h
|
---|
47 | echo "#define VBOX_VERSION_BUILD $VBOX_VERSION_BUILD" >> $PATH_TMP/version-generated.h
|
---|
48 | echo "#define VBOX_VERSION_STRING \"$VBOX_VERSION_MAJOR.$VBOX_VERSION_MINOR.$VBOX_VERSION_BUILD\"" >> $PATH_TMP/version-generated.h
|
---|
49 | echo "" >> $PATH_TMP/version-generated.h
|
---|
50 | echo "#endif" >> $PATH_TMP/version-generated.h
|
---|
51 |
|
---|
52 | # vboxguest (VirtualBox guest kernel module)
|
---|
53 | mkdir $PATH_TMP/vboxguest || exit 1
|
---|
54 | for f in $FILES_VBOXGUEST_NOBIN; do
|
---|
55 | install -D -m 0644 `echo $f|cut -d'=' -f1` "$PATH_TMP/vboxguest/`echo $f|cut -d'>' -f2`"
|
---|
56 | done
|
---|
57 | for f in $FILES_VBOXGUEST_BIN; do
|
---|
58 | install -D -m 0755 `echo $f|cut -d'=' -f1` "$PATH_TMP/vboxguest/`echo $f|cut -d'>' -f2`"
|
---|
59 | done
|
---|
60 |
|
---|
61 | # vboxsf (VirtualBox guest kernel module for shared folders)
|
---|
62 | mkdir $PATH_TMP/vboxsf || exit 1
|
---|
63 | for f in $FILES_VBOXSF_NOBIN; do
|
---|
64 | install -D -m 0644 `echo $f|cut -d'=' -f1` "$PATH_TMP/vboxsf/`echo $f|cut -d'>' -f2`"
|
---|
65 | done
|
---|
66 | for f in $FILES_VBOXSF_BIN; do
|
---|
67 | install -D -m 0755 `echo $f|cut -d'=' -f1` "$PATH_TMP/vboxsf/`echo $f|cut -d'>' -f2`"
|
---|
68 | done
|
---|
69 |
|
---|
70 | # Only temporary, omit from archive
|
---|
71 | rm $PATH_TMP/version-generated.h
|
---|
72 |
|
---|
73 | # Create the archive
|
---|
74 | tar -czf $FILE_OUT -C $PATH_TMP . || exit 1
|
---|
75 |
|
---|
76 | # Remove the temporary directory
|
---|
77 | rm -r $PATH_TMP
|
---|
78 |
|
---|