fb27aa740466280f820e13e238bc6dd0b477eb37vboxsync#!/bin/sh
29e18dff973632afcdb1ebf98dbc9d38f80a7792vboxsync# $Id$
29e18dff973632afcdb1ebf98dbc9d38f80a7792vboxsync## @file
29e18dff973632afcdb1ebf98dbc9d38f80a7792vboxsync# Reloads the new kernel extension at the end of installation.
29e18dff973632afcdb1ebf98dbc9d38f80a7792vboxsync#
fb27aa740466280f820e13e238bc6dd0b477eb37vboxsync
fb27aa740466280f820e13e238bc6dd0b477eb37vboxsync#
29e18dff973632afcdb1ebf98dbc9d38f80a7792vboxsync# Copyright (C) 2007-2013 Oracle Corporation
fb27aa740466280f820e13e238bc6dd0b477eb37vboxsync#
343053a42dedb94c8ef5534fff89c72384adf94dvboxsync# This file is part of VirtualBox Open Source Edition (OSE), as
343053a42dedb94c8ef5534fff89c72384adf94dvboxsync# available from http://www.virtualbox.org. This file is free software;
343053a42dedb94c8ef5534fff89c72384adf94dvboxsync# you can redistribute it and/or modify it under the terms of the GNU
343053a42dedb94c8ef5534fff89c72384adf94dvboxsync# General Public License (GPL) as published by the Free Software
343053a42dedb94c8ef5534fff89c72384adf94dvboxsync# Foundation, in version 2 as it comes in the "COPYING" file of the
343053a42dedb94c8ef5534fff89c72384adf94dvboxsync# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
343053a42dedb94c8ef5534fff89c72384adf94dvboxsync# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
fb27aa740466280f820e13e238bc6dd0b477eb37vboxsync#
fb27aa740466280f820e13e238bc6dd0b477eb37vboxsync
66ab05d147fcb24a5fec1cd3c37a1799db26c804vboxsync#
66ab05d147fcb24a5fec1cd3c37a1799db26c804vboxsync# Make sure the old startup items are gone.
66ab05d147fcb24a5fec1cd3c37a1799db26c804vboxsync#
66ab05d147fcb24a5fec1cd3c37a1799db26c804vboxsyncif [ -d /Library/StartupItems/VirtualBox/ ]; then
66ab05d147fcb24a5fec1cd3c37a1799db26c804vboxsync rm -vf "/Library/StartupItems/VirtualBox/StartupParameters.plist"
66ab05d147fcb24a5fec1cd3c37a1799db26c804vboxsync rm -vf "/Library/StartupItems/VirtualBox/VirtualBox"
66ab05d147fcb24a5fec1cd3c37a1799db26c804vboxsync rm -vf "/Library/StartupItems/VirtualBox/Resources/English.lproj/Localizable.strings"
66ab05d147fcb24a5fec1cd3c37a1799db26c804vboxsync test -d "/Library/StartupItems/VirtualBox/Resources/English.lproj/" && rmdir "/Library/StartupItems/VirtualBox/Resources/English.lproj/"
66ab05d147fcb24a5fec1cd3c37a1799db26c804vboxsync test -d "/Library/StartupItems/VirtualBox/Resources/" && rmdir "/Library/StartupItems/VirtualBox/Resources/"
66ab05d147fcb24a5fec1cd3c37a1799db26c804vboxsync test -d "/Library/StartupItems/VirtualBox/" && rmdir "/Library/StartupItems/VirtualBox/"
66ab05d147fcb24a5fec1cd3c37a1799db26c804vboxsyncfi
66ab05d147fcb24a5fec1cd3c37a1799db26c804vboxsync
2907c780b193573627b0c40724bbc1bd0f8e9d34vboxsync#
2907c780b193573627b0c40724bbc1bd0f8e9d34vboxsync# Make sure old kernel extensions are gone (moved to "/Library/Application Support/VirtualBox/" with 4.3).
2907c780b193573627b0c40724bbc1bd0f8e9d34vboxsync#
2907c780b193573627b0c40724bbc1bd0f8e9d34vboxsyncrm -Rfv \
2907c780b193573627b0c40724bbc1bd0f8e9d34vboxsync "/Library/Extensions/VBoxDrv.kext/" \
2907c780b193573627b0c40724bbc1bd0f8e9d34vboxsync "/Library/Extensions/VBoxNetFlt.kext/" \
2907c780b193573627b0c40724bbc1bd0f8e9d34vboxsync "/Library/Extensions/VBoxNetAdp.kext/" \
2907c780b193573627b0c40724bbc1bd0f8e9d34vboxsync "/Library/Extensions/VBoxUSB.kext/" \
2907c780b193573627b0c40724bbc1bd0f8e9d34vboxsync "/Library/Extensions/VBoxDrvTiger.kext/" \
2907c780b193573627b0c40724bbc1bd0f8e9d34vboxsync "/Library/Extensions/VBoxUSBTiger.kext/"
2907c780b193573627b0c40724bbc1bd0f8e9d34vboxsync
66ab05d147fcb24a5fec1cd3c37a1799db26c804vboxsync#
66ab05d147fcb24a5fec1cd3c37a1799db26c804vboxsync# Install the launchd script.
66ab05d147fcb24a5fec1cd3c37a1799db26c804vboxsync#
66ab05d147fcb24a5fec1cd3c37a1799db26c804vboxsyncrm -vf "/Library/LaunchDaemons/org.virtualbox.startup.plist"
66ab05d147fcb24a5fec1cd3c37a1799db26c804vboxsyncset -e
66ab05d147fcb24a5fec1cd3c37a1799db26c804vboxsyncln -s "../Application Support/VirtualBox/LaunchDaemons/org.virtualbox.startup.plist" \
66ab05d147fcb24a5fec1cd3c37a1799db26c804vboxsync "/Library/LaunchDaemons/org.virtualbox.startup.plist"
66ab05d147fcb24a5fec1cd3c37a1799db26c804vboxsyncset +e
66ab05d147fcb24a5fec1cd3c37a1799db26c804vboxsync
fb27aa740466280f820e13e238bc6dd0b477eb37vboxsync#
fb27aa740466280f820e13e238bc6dd0b477eb37vboxsync# Unload any old extension that might be loaded already (ignore failures).
fb27aa740466280f820e13e238bc6dd0b477eb37vboxsync#
fb27aa740466280f820e13e238bc6dd0b477eb37vboxsyncsync
fb27aa740466280f820e13e238bc6dd0b477eb37vboxsyncif kextstat -lb org.virtualbox.kext.VBoxNetAdp 2>&1 | grep -q org.virtualbox.kext.VBoxNetAdp; then
fb27aa740466280f820e13e238bc6dd0b477eb37vboxsync kextunload -m org.virtualbox.kext.VBoxNetAdp
fb27aa740466280f820e13e238bc6dd0b477eb37vboxsyncfi
fb27aa740466280f820e13e238bc6dd0b477eb37vboxsyncif kextstat -lb org.virtualbox.kext.VBoxNetFlt 2>&1 | grep -q org.virtualbox.kext.VBoxNetFlt; then
fb27aa740466280f820e13e238bc6dd0b477eb37vboxsync kextunload -m org.virtualbox.kext.VBoxNetFlt
fb27aa740466280f820e13e238bc6dd0b477eb37vboxsyncfi
fb27aa740466280f820e13e238bc6dd0b477eb37vboxsyncif kextstat -lb org.virtualbox.kext.VBoxUSB 2>&1 | grep -q org.virtualbox.kext.VBoxUSB; then
fb27aa740466280f820e13e238bc6dd0b477eb37vboxsync kextunload -m org.virtualbox.kext.VBoxUSB
fb27aa740466280f820e13e238bc6dd0b477eb37vboxsyncfi
fb27aa740466280f820e13e238bc6dd0b477eb37vboxsyncif kextstat -lb org.virtualbox.kext.VBoxDrv 2>&1 | grep -q org.virtualbox.kext.VBoxDrv; then
fb27aa740466280f820e13e238bc6dd0b477eb37vboxsync kextunload -m org.virtualbox.kext.VBoxDrv
fb27aa740466280f820e13e238bc6dd0b477eb37vboxsyncfi
fb27aa740466280f820e13e238bc6dd0b477eb37vboxsync
fb27aa740466280f820e13e238bc6dd0b477eb37vboxsync#
fb27aa740466280f820e13e238bc6dd0b477eb37vboxsync# Load the extension, exit on first error.
fb27aa740466280f820e13e238bc6dd0b477eb37vboxsync#
fb27aa740466280f820e13e238bc6dd0b477eb37vboxsyncsync
9719c70242335a826a49f05c1a1f7c2cfd6a38cevboxsyncset -e
29e18dff973632afcdb1ebf98dbc9d38f80a7792vboxsynckextload '/Library/Application Support/VirtualBox/VBoxDrv.kext'
29e18dff973632afcdb1ebf98dbc9d38f80a7792vboxsynckextload -d '/Library/Application Support/VirtualBox/VBoxDrv.kext' '/Library/Application Support/VirtualBox/VBoxUSB.kext'
29e18dff973632afcdb1ebf98dbc9d38f80a7792vboxsynckextload -d '/Library/Application Support/VirtualBox/VBoxDrv.kext' '/Library/Application Support/VirtualBox/VBoxNetFlt.kext'
29e18dff973632afcdb1ebf98dbc9d38f80a7792vboxsynckextload -d '/Library/Application Support/VirtualBox/VBoxDrv.kext' '/Library/Application Support/VirtualBox/VBoxNetAdp.kext'
fb27aa740466280f820e13e238bc6dd0b477eb37vboxsync