VirtualBox

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

Last change on this file since 4163 was 4071, checked in by vboxsync, 17 years ago

Biggest check-in ever. New source code headers for all (C) innotek files.

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 1.4 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# find a unique temp directory
18num=0
19while true; do
20 tmpdir="/tmp/vbox.$num"
21 if mkdir -m 0755 "$tmpdir" 2> /dev/null; then
22 break
23 fi
24 num=`expr $num + 1`
25 if [ $num -gt 200 ]; then
26 echo "Could not find a valid tmp directory"
27 exit 1
28 fi
29done
30
31if [ "$1" = "--save-module-symvers" ]; then
32 shift
33 SAVE_MOD_SYMVERS="$1"
34 shift
35fi
36
37if [ "$1" = "--use-module-symvers" ]; then
38 shift
39 USE_MOD_SYMVERS="$1"
40 shift
41fi
42
43# copy
44cp -a ${0%/*}/* $tmpdir/
45if [ -n "$USE_MOD_SYMVERS" ]; then
46 cp $USE_MOD_SYMVERS $tmpdir/Module.symvers
47fi
48
49# make, cleanup if success
50cd "$tmpdir"
51if make "$@"; then
52 if [ -n "$SAVE_MOD_SYMVERS" ]; then
53 if [ -f Module.symvers ]; then
54 cp -f Module.symvers $SAVE_MOD_SYMVERS
55 else
56 cat /dev/null > $SAVE_MOD_SYMVERS
57 fi
58 fi
59 rm -rf $tmpdir
60 exit 0
61fi
62
63# failure
64exit 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