build_in_tmp revision 8e668d6ec021222ed7b02063035fda30692c52fe
#
# Script to build a kernel module in /tmp. Useful if the module sources
# are installed in read-only directory.
#
# Copyright (C) 2007 Sun Microsystems, Inc.
#
# This file is part of VirtualBox Open Source Edition (OSE), as
# available from http://www.virtualbox.org. This file is free software;
# General Public License (GPL) as published by the Free Software
# Foundation, in version 2 as it comes in the "COPYING" file of the
# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
#
# The contents of this file may alternatively be used under the terms
# of the Common Development and Distribution License Version 1.0
# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
# VirtualBox OSE distribution, in which case the provisions of the
# CDDL are applicable instead of those of the GPL.
#
# You may elect to license modified versions of this file under the
# terms and conditions of either the GPL or the CDDL or both.
#
# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
# Clara, CA 95054 USA or visit http://www.sun.com if you need
# additional information or have any questions.
#
# Attempt to build using DKMS first
if [ -n "$DKMS" ]
then
echo "Attempting to install using DKMS"
then
fi
then
exit 0
fi
echo "Failed to install using DKMS, attempting to install without"
fi
# find a unique temp directory
num=0
while true; do
break
fi
echo "Could not find a valid tmp directory"
exit 1
fi
done
if [ "$1" = "--save-module-symvers" ]; then
shift
SAVE_MOD_SYMVERS="$1"
shift
fi
if [ "$1" = "--use-module-symvers" ]; then
shift
USE_MOD_SYMVERS="$1"
shift
fi
# copy
if [ -n "$USE_MOD_SYMVERS" ]; then
fi
# make, cleanup if success
cd "$tmpdir"
if make "$@"; then
if [ -n "$SAVE_MOD_SYMVERS" ]; then
if [ -f Module.symvers ]; then
else
fi
fi
exit 0
fi
# failure
exit 1