VirtualBox

source: vbox/trunk/src/VBox/HostDrivers/Support/linux/build_in_tmp@ 3068

Last change on this file since 3068 was 3068, checked in by vboxsync, 18 years ago

small fix

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 1.6 KB
Line 
1#!/bin/sh
2
3#
4# Script to build a kernel module in /tmp. Useful if the module sources
5# are installed in read-only directory.
6#
7# Copyright (C) 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 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# find a unique temp directory
23num=0
24while true; do
25 tmpdir="/tmp/vbox.$num"
26 if mkdir -m 0755 "$tmpdir" 2> /dev/null; then
27 break
28 fi
29 num=`expr $num + 1`
30 if [ $num -gt 200 ]; then
31 echo "Could not find a valid tmp directory"
32 exit 1
33 fi
34done
35
36if [ "$1" = "--save-module-symvers" ]; then
37 shift
38 SAVE_MOD_SYMVERS="$1"
39 shift
40fi
41
42if [ "$1" = "--use-module-symvers" ]; then
43 shift
44 USE_MOD_SYMVERS="$1"
45 shift
46fi
47
48# copy
49cp -a ${0%/*}/* $tmpdir/
50if [ -n "$USE_MOD_SYMVERS" ]; then
51 cp $USE_MOD_SYMVERS $tmpdir/Module.symvers
52fi
53
54# make, cleanup if success
55cd "$tmpdir"
56if make "$@"; then
57 if [ -n "$SAVE_MOD_SYMVERS" ]; then
58 if [ -f Module.symvers ]; then
59 cp -f Module.symvers $SAVE_MOD_SYMVERS
60 else
61 cat /dev/null > $SAVE_MOD_SYMVERS
62 fi
63 fi
64 rm -rf $tmpdir
65 exit 0
66fi
67
68# failure
69exit 1
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