## @file
#
# VirtualBox postinstall script for FreeBSD.
#
#
# Copyright (C) 2007-2012 Oracle Corporation
#
# 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.
#
PATH_TMP="/tmp"
PATH_TMP_MODS="$PATH_TMP/vbox_mods"
PATH_KERN_SRC="/usr/src/sys"
if [ ! -f $PATH_KERN_SRC/Makefile ]; then
echo "Kernel sources are not installed. Please install them and reinstall VirtualBox"
exit 1
fi
echo "Compiling kernel modules, please wait..."
# Create temporary directory
# Unpack archive
# Compile
# Check if we succeeded
if [ $? != 0 ]; then
echo "Compiling kernel modules failed."
cd ..
exit 1
fi
# Load them now, unloading old modules
if [ $? != 0 ]; then
echo "Loading kernel modules failed"
cd ..
exit 1
fi
echo "Kernel modules successfully installed."
echo "To load them on every boot put them into /boot/loader.conf"
# Cleanup
cd ..
exit 0