VirtualBox

source: vbox/trunk/src/VBox/HostDrivers/linux/build_in_tmp@ 45786

Last change on this file since 45786 was 44528, checked in by vboxsync, 12 years ago

header (C) fixes

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