postflight revision 2907c780b193573627b0c40724bbc1bd0f8e9d34
0N/A#!/bin/sh
0N/A# $Id$
0N/A## @file
0N/A# Reloads the new kernel extension at the end of installation.
0N/A#
0N/A
0N/A#
0N/A# Copyright (C) 2007-2013 Oracle Corporation
0N/A#
0N/A# This file is part of VirtualBox Open Source Edition (OSE), as
0N/A# available from http://www.virtualbox.org. This file is free software;
0N/A# you can redistribute it and/or modify it under the terms of the GNU
0N/A# General Public License (GPL) as published by the Free Software
0N/A# Foundation, in version 2 as it comes in the "COPYING" file of the
0N/A# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
0N/A# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
0N/A#
0N/A
0N/A#
0N/A# Make sure the old startup items are gone.
0N/A#
0N/Aif [ -d /Library/StartupItems/VirtualBox/ ]; then
0N/A rm -vf "/Library/StartupItems/VirtualBox/StartupParameters.plist"
0N/A rm -vf "/Library/StartupItems/VirtualBox/VirtualBox"
0N/A rm -vf "/Library/StartupItems/VirtualBox/Resources/English.lproj/Localizable.strings"
0N/A test -d "/Library/StartupItems/VirtualBox/Resources/English.lproj/" && rmdir "/Library/StartupItems/VirtualBox/Resources/English.lproj/"
0N/A test -d "/Library/StartupItems/VirtualBox/Resources/" && rmdir "/Library/StartupItems/VirtualBox/Resources/"
0N/A test -d "/Library/StartupItems/VirtualBox/" && rmdir "/Library/StartupItems/VirtualBox/"
0N/Afi
0N/A
0N/A#
0N/A# Make sure old kernel extensions are gone (moved to "/Library/Application Support/VirtualBox/" with 4.3).
0N/A#
0N/Arm -Rfv \
0N/A "/Library/Extensions/VBoxDrv.kext/" \
0N/A "/Library/Extensions/VBoxNetFlt.kext/" \
0N/A "/Library/Extensions/VBoxNetAdp.kext/" \
0N/A "/Library/Extensions/VBoxUSB.kext/" \
0N/A "/Library/Extensions/VBoxDrvTiger.kext/" \
0N/A "/Library/Extensions/VBoxUSBTiger.kext/"
0N/A
0N/A#
0N/A# Install the launchd script.
0N/A#
0N/Arm -vf "/Library/LaunchDaemons/org.virtualbox.startup.plist"
0N/Aset -e
0N/Aln -s "../Application Support/VirtualBox/LaunchDaemons/org.virtualbox.startup.plist" \
0N/A "/Library/LaunchDaemons/org.virtualbox.startup.plist"
0N/Aset +e
0N/A
0N/A#
0N/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'