postflight revision 2e79616cdb94a9f801a368bc0b31a6a7dc7f20dd
321N/A#!/bin/sh
321N/A
1276N/A#
321N/A# Copyright (C) 2007-2013 Oracle Corporation
1549N/A#
321N/A# This file is part of VirtualBox Open Source Edition (OSE), as
321N/A# available from http://www.virtualbox.org. This file is free software;
919N/A# you can redistribute it and/or modify it under the terms of the GNU
919N/A# General Public License (GPL) as published by the Free Software
919N/A# Foundation, in version 2 as it comes in the "COPYING" file of the
919N/A# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
919N/A# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
919N/A#
919N/A
919N/Aset -e
919N/A
919N/A# Setup environment.
919N/Aexport PATH="/bin:/usr/bin:/sbin:/usr/sbin:$PATH"
919N/A
919N/Aunload_service()
919N/A{
919N/A ITEM_ID=$1
919N/A ITEM_PATH=$2
919N/A FORCED_USER=$3
321N/A
321N/A loaded="NO"
321N/A test -n "$(sudo -u "$FORCED_USER" launchctl list | grep $ITEM_ID)" && loaded="YES"
321N/A if [ "$loaded" = "YES" ] ; then
493N/A echo "Unloading previously installed service: $ITEM_ID"
321N/A sudo -u "$FORCED_USER" launchctl unload -F "$ITEM_PATH/$ITEM_ID.plist"
970N/A fi
970N/A}
970N/A
1356N/Aload_service()
970N/A{
970N/A ITEM_ID=$1
970N/A ITEM_PATH=$2
970N/A FORCED_USER=$3
970N/A
321N/A echo "Loading newly installed service: $ITEM_ID"
1549N/A sudo -u "$FORCED_USER" launchctl load -F "$ITEM_PATH/$ITEM_ID.plist"
321N/A}
911N/A
1549N/Aunload_service "org.virtualbox.additions.vboxservice" "/Library/LaunchDaemons" "root"
1549N/Aunload_service "org.virtualbox.additions.vboxclient" "/Library/LaunchAgents" "${USER}"
1549N/A
911N/Aitems="VBoxGuest"
321N/Afor item in $items; do
321N/A kext_item="org.virtualbox.kext.$item"
321N/A
321N/A loaded="NO"
1408N/A test -n "$(kextstat | grep $kext_item)" && loaded="YES"
493N/A if [ "$loaded" = "YES" ] ; then
321N/A echo "Unloading $item kernel extension..."
970N/A kextunload -b $kext_item
970N/A fi
970N/Adone
1196N/Aecho "Loading newly installed kernel extensions."
1196N/Akextload "/Library/Extensions/VBoxGuest.kext"
1196N/A
1425N/Aload_service "org.virtualbox.additions.vboxservice" "/Library/LaunchDaemons" "root"
1196N/Aload_service "org.virtualbox.additions.vboxclient" "/Library/LaunchAgents" "${USER}"
321N/A
echo "Done."
exit 0;