VirtualBox

source: vbox/trunk/src/VBox/Additions/linux/export_modules@ 58356

Last change on this file since 58356 was 58324, checked in by vboxsync, 9 years ago

Installers/linux: cleaner script for getting shell script location folders.

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
File size: 5.7 KB
Line 
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-2010 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# The below is GNU-specific. See VBox.sh for the longer Solaris/OS X version.
19TARGET=`readlink -e -- "${0}"` || exit 1
20MY_DIR="${TARGET%/[!/]*}"
21
22if [ -z "$1" ]; then
23 echo "Usage: $0 <filename.tar.gz>"
24 echo " Export VirtualBox kernel modules to <filename.tar.gz>"
25 exit 1
26fi
27
28PATH_TMP="`cd \`dirname $1\`; pwd`/.vbox_modules"
29PATH_OUT=$PATH_TMP
30FILE_OUT="`cd \`dirname $1\`; pwd`/`basename $1`"
31PATH_ROOT="${MY_DIR}/../../../..; pwd`"
32PATH_LINUX="$PATH_ROOT/src/VBox/Additions/linux"
33PATH_VBOXGUEST="$PATH_ROOT/src/VBox/Additions/common/VBoxGuest"
34PATH_VBOXSF="$PATH_ROOT/src/VBox/Additions/linux/sharedfolders"
35PATH_VBOXVIDEO="$PATH_ROOT/src/VBox/Additions/linux/drm"
36
37VBOX_VERSION_MAJOR=`sed -e "s/^ *VBOX_VERSION_MAJOR *= \+\([0-9]\+\)/\1/;t;d" $PATH_ROOT/Config.kmk`
38VBOX_VERSION_MINOR=`sed -e "s/^ *VBOX_VERSION_MINOR *= \+\([0-9]\+\)/\1/;t;d" $PATH_ROOT/Config.kmk`
39VBOX_VERSION_BUILD=`sed -e "s/^ *VBOX_VERSION_BUILD *= \+\([0-9]\+\)/\1/;t;d" $PATH_ROOT/Config.kmk`
40VBOX_SVN_REV=`sed -e 's/^ *VBOX_SVN_REV_FALLBACK *:= \+\$(patsubst *%:,, *\$Rev: *\([0-9]\+\) *\$ *) */\1/;t;d' $PATH_ROOT/Config.kmk`
41VBOX_VENDOR=`sed -e 's/^ *VBOX_VENDOR *= \+\(.\+\)/\1/;t;d' $PATH_ROOT/Config.kmk`
42VBOX_VENDOR_SHORT=`sed -e 's/^ *VBOX_VENDOR_SHORT *= \+\(.\+\)/\1/;t;d' $PATH_ROOT/Config.kmk`
43VBOX_PRODUCT=`sed -e 's/^ *VBOX_PRODUCT *= \+\(.\+\)/\1/;t;d' $PATH_ROOT/Config.kmk`
44VBOX_C_YEAR=`date +%Y`
45
46. $PATH_VBOXGUEST/linux/files_vboxguest
47. $PATH_VBOXSF/files_vboxsf
48. $PATH_VBOXVIDEO/files_vboxvideo_drm
49
50# Temporary path for creating the modules, will be removed later
51mkdir $PATH_TMP || exit 1
52
53# Create auto-generated version file, needed by all modules
54echo "#ifndef ___version_generated_h___" > $PATH_TMP/version-generated.h
55echo "#define ___version_generated_h___" >> $PATH_TMP/version-generated.h
56echo "" >> $PATH_TMP/version-generated.h
57echo "#define VBOX_VERSION_MAJOR $VBOX_VERSION_MAJOR" >> $PATH_TMP/version-generated.h
58echo "#define VBOX_VERSION_MINOR $VBOX_VERSION_MINOR" >> $PATH_TMP/version-generated.h
59echo "#define VBOX_VERSION_BUILD $VBOX_VERSION_BUILD" >> $PATH_TMP/version-generated.h
60echo "#define VBOX_VERSION_STRING_RAW \"$VBOX_VERSION_MAJOR.$VBOX_VERSION_MINOR.$VBOX_VERSION_BUILD\"" >> $PATH_TMP/version-generated.h
61echo "#define VBOX_VERSION_STRING \"$VBOX_VERSION_MAJOR.$VBOX_VERSION_MINOR.$VBOX_VERSION_BUILD\"" >> $PATH_TMP/version-generated.h
62echo "#define VBOX_API_VERSION_STRING \"${VBOX_VERSION_MAJOR}_${VBOX_VERSION_MINOR}\"" >> $PATH_TMP/version-generated.h
63echo "#define VBOX_PRIVATE_BUILD_DESC \"Private build with export_modules\"" >> $PATH_TMP/version-generated.h
64echo "" >> $PATH_TMP/version-generated.h
65echo "#endif" >> $PATH_TMP/version-generated.h
66
67# Create auto-generated revision file, needed by all modules
68echo "#ifndef __revision_generated_h__" > $PATH_TMP/revision-generated.h
69echo "#define __revision_generated_h__" >> $PATH_TMP/revision-generated.h
70echo "" >> $PATH_TMP/revision-generated.h
71echo "#define VBOX_SVN_REV $VBOX_SVN_REV" >> $PATH_TMP/revision-generated.h
72echo "" >> $PATH_TMP/revision-generated.h
73echo "#endif" >> $PATH_TMP/revision-generated.h
74
75# Create auto-generated product file, needed by all modules
76echo "#ifndef ___product_generated_h___" > $PATH_TMP/product-generated.h
77echo "#define ___product_generated_h___" >> $PATH_TMP/product-generated.h
78echo "" >> $PATH_TMP/product-generated.h
79echo "#define VBOX_VENDOR \"$VBOX_VENDOR\"" >> $PATH_TMP/product-generated.h
80echo "#define VBOX_VENDOR_SHORT \"$VBOX_VENDOR_SHORT\"" >> $PATH_TMP/product-generated.h
81echo "" >> $PATH_TMP/product-generated.h
82echo "#define VBOX_PRODUCT \"$VBOX_PRODUCT\"" >> $PATH_TMP/product-generated.h
83echo "#define VBOX_C_YEAR \"$VBOX_C_YEAR\"" >> $PATH_TMP/product-generated.h
84echo "" >> $PATH_TMP/product-generated.h
85echo "#endif" >> $PATH_TMP/product-generated.h
86
87# vboxguest (VirtualBox guest kernel module)
88mkdir $PATH_TMP/vboxguest || exit 1
89for f in $FILES_VBOXGUEST_NOBIN; do
90 install -D -m 0644 `echo $f|cut -d'=' -f1` "$PATH_TMP/vboxguest/`echo $f|cut -d'>' -f2`"
91done
92for f in $FILES_VBOXGUEST_BIN; do
93 install -D -m 0755 `echo $f|cut -d'=' -f1` "$PATH_TMP/vboxguest/`echo $f|cut -d'>' -f2`"
94done
95
96# vboxsf (VirtualBox guest kernel module for shared folders)
97mkdir $PATH_TMP/vboxsf || exit 1
98for f in $FILES_VBOXSF_NOBIN; do
99 install -D -m 0644 `echo $f|cut -d'=' -f1` "$PATH_TMP/vboxsf/`echo $f|cut -d'>' -f2`"
100done
101for f in $FILES_VBOXSF_BIN; do
102 install -D -m 0755 `echo $f|cut -d'=' -f1` "$PATH_TMP/vboxsf/`echo $f|cut -d'>' -f2`"
103done
104
105# vboxvideo (VirtualBox guest kernel module for drm support)
106mkdir $PATH_TMP/vboxvideo || exit 1
107for f in $FILES_VBOXVIDEO_DRM_NOBIN; do
108 install -D -m 0644 `echo $f|cut -d'=' -f1` "$PATH_TMP/vboxvideo/`echo $f|cut -d'>' -f2`"
109done
110for f in $FILES_VBOXVIDEO_DRM_BIN; do
111 install -D -m 0755 `echo $f|cut -d'=' -f1` "$PATH_TMP/vboxvideo/`echo $f|cut -d'>' -f2`"
112done
113
114# convenience Makefile
115install -D -m 0644 $PATH_LINUX/Makefile "$PATH_TMP/Makefile"
116
117# Only temporary, omit from archive
118rm $PATH_TMP/version-generated.h
119rm $PATH_TMP/revision-generated.h
120rm $PATH_TMP/product-generated.h
121
122# Create the archive
123tar -czf $FILE_OUT -C $PATH_TMP . || exit 1
124
125# Remove the temporary directory
126rm -r $PATH_TMP
127
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette