VirtualBox

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

Last change on this file since 75701 was 75701, checked in by vboxsync, 6 years ago

add/darwin/inst: Need to 'touch /System/Library/Extensions/' and run 'kextcache-update-volume /' after installing VBoxGuest.kext into /Library/Extensions/. OS X should then find and load it on its own.

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 2.1 KB
Line 
1#!/bin/sh
2# $Id: postflight 75701 2018-11-25 01:39:10Z 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
62
63echo "Updating kernel cache (should trigger loading of new modules)."
64touch "/System/Library/Extensions/"
65kextcache -update-volume / || true
66
67#echo "Loading newly installed kernel extensions."
68#kextload "/Library/Extensions/VBoxGuest.kext"
69
70load_service "org.virtualbox.additions.vboxservice" "/Library/LaunchDaemons" "root"
71load_service "org.virtualbox.additions.vboxclient" "/Library/LaunchAgents" "${USER}"
72
73echo "Done."
74
75exit 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