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