VirtualBox

source: vbox/trunk/src/VBox/Additions/darwin/Installer/VBoxGuestAdditionsKEXTs/postflight@ 69496

Last change on this file since 69496 was 69496, checked in by vboxsync, 7 years ago

*: scm --update-copyright-year

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 2.0 KB
Line 
1#!/bin/sh
2# $Id: postflight 69496 2017-10-28 14:55:58Z vboxsync $
3## @file
4# Post flight installer script for the VirtualBox OS X kernel extensions.
5#
6
7#
8# Copyright (C) 2007-2017 Oracle Corporation
9#
10# This file is part of VirtualBox Open Source Edition (OSE), as
11# available from http://www.virtualbox.org. This file is free software;
12# you can redistribute it and/or modify it under the terms of the GNU
13# General Public License (GPL) as published by the Free Software
14# Foundation, in version 2 as it comes in the "COPYING" file of the
15# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
16# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
17#
18
19set -e
20
21# Setup environment.
22export PATH="/bin:/usr/bin:/sbin:/usr/sbin:$PATH"
23
24unload_service()
25{
26 ITEM_ID=$1
27 ITEM_PATH=$2
28 FORCED_USER=$3
29
30 loaded="NO"
31 test -n "$(sudo -u "$FORCED_USER" launchctl list | grep $ITEM_ID)" && loaded="YES"
32 if [ "$loaded" = "YES" ] ; then
33 echo "Unloading previously installed service: $ITEM_ID"
34 sudo -u "$FORCED_USER" launchctl unload -F "$ITEM_PATH/$ITEM_ID.plist"
35 fi
36}
37
38load_service()
39{
40 ITEM_ID=$1
41 ITEM_PATH=$2
42 FORCED_USER=$3
43
44 echo "Loading newly installed service: $ITEM_ID"
45 sudo -u "$FORCED_USER" launchctl load -F "$ITEM_PATH/$ITEM_ID.plist"
46}
47
48unload_service "org.virtualbox.additions.vboxservice" "/Library/LaunchDaemons" "root"
49unload_service "org.virtualbox.additions.vboxclient" "/Library/LaunchAgents" "${USER}"
50
51items="VBoxGuest"
52for item in $items; do
53 kext_item="org.virtualbox.kext.$item"
54
55 loaded="NO"
56 test -n "$(kextstat | grep $kext_item)" && loaded="YES"
57 if [ "$loaded" = "YES" ] ; then
58 echo "Unloading $item kernel extension..."
59 kextunload -b $kext_item
60 fi
61done
62echo "Loading newly installed kernel extensions."
63kextload "/Library/Extensions/VBoxGuest.kext"
64
65load_service "org.virtualbox.additions.vboxservice" "/Library/LaunchDaemons" "root"
66load_service "org.virtualbox.additions.vboxclient" "/Library/LaunchAgents" "${USER}"
67
68echo "Done."
69
70exit 0;
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette