postflight revision 66ab05d147fcb24a5fec1cd3c37a1799db26c804
2N/A#!/bin/sh
2N/A# $Id$
2N/A## @file
2N/A# Reloads the new kernel extension at the end of installation.
2N/A#
2N/A
2N/A#
2N/A# Copyright (C) 2007-2013 Oracle Corporation
2N/A#
2N/A# This file is part of VirtualBox Open Source Edition (OSE), as
2N/A# available from http://www.virtualbox.org. This file is free software;
2N/A# you can redistribute it and/or modify it under the terms of the GNU
2N/A# General Public License (GPL) as published by the Free Software
2N/A# Foundation, in version 2 as it comes in the "COPYING" file of the
2N/A# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
2N/A# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
2N/A#
2N/A
2N/A#
2N/A# Make sure the old startup items are gone.
2N/A#
2N/Aif [ -d /Library/StartupItems/VirtualBox/ ]; then
2N/A rm -vf "/Library/StartupItems/VirtualBox/StartupParameters.plist"
2N/A rm -vf "/Library/StartupItems/VirtualBox/VirtualBox"
2N/A rm -vf "/Library/StartupItems/VirtualBox/Resources/English.lproj/Localizable.strings"
2N/A test -d "/Library/StartupItems/VirtualBox/Resources/English.lproj/" && rmdir "/Library/StartupItems/VirtualBox/Resources/English.lproj/"
2N/A test -d "/Library/StartupItems/VirtualBox/Resources/" && rmdir "/Library/StartupItems/VirtualBox/Resources/"
2N/A test -d "/Library/StartupItems/VirtualBox/" && rmdir "/Library/StartupItems/VirtualBox/"
2N/Afi
2N/A
2N/A#
2N/A# Install the launchd script.
2N/A#
2N/Arm -vf "/Library/LaunchDaemons/org.virtualbox.startup.plist"
2N/Aset -e
2N/Aln -s "../Application Support/VirtualBox/LaunchDaemons/org.virtualbox.startup.plist" \
2N/A "/Library/LaunchDaemons/org.virtualbox.startup.plist"
2N/Aset +e
2N/A
#
# Unload any old extension that might be loaded already (ignore failures).
#
sync
if kextstat -lb org.virtualbox.kext.VBoxNetAdp 2>&1 | grep -q org.virtualbox.kext.VBoxNetAdp; then
kextunload -m org.virtualbox.kext.VBoxNetAdp
fi
if kextstat -lb org.virtualbox.kext.VBoxNetFlt 2>&1 | grep -q org.virtualbox.kext.VBoxNetFlt; then
kextunload -m org.virtualbox.kext.VBoxNetFlt
fi
if kextstat -lb org.virtualbox.kext.VBoxUSB 2>&1 | grep -q org.virtualbox.kext.VBoxUSB; then
kextunload -m org.virtualbox.kext.VBoxUSB
fi
if kextstat -lb org.virtualbox.kext.VBoxDrv 2>&1 | grep -q org.virtualbox.kext.VBoxDrv; then
kextunload -m org.virtualbox.kext.VBoxDrv
fi
#
# Load the extension, exit on first error.
#
sync
set -e
kextload '/Library/Application Support/VirtualBox/VBoxDrv.kext'
kextload -d '/Library/Application Support/VirtualBox/VBoxDrv.kext' '/Library/Application Support/VirtualBox/VBoxUSB.kext'
kextload -d '/Library/Application Support/VirtualBox/VBoxDrv.kext' '/Library/Application Support/VirtualBox/VBoxNetFlt.kext'
kextload -d '/Library/Application Support/VirtualBox/VBoxDrv.kext' '/Library/Application Support/VirtualBox/VBoxNetAdp.kext'