VirtualBox

source: vbox/trunk/src/VBox/Additions/darwin/Installer/VBoxGuestAdditionsToolsAndServices/VBoxServiceWrapper@ 96399

Last change on this file since 96399 was 93115, checked in by vboxsync, 3 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: 1.9 KB
Line 
1#!/bin/sh
2## @file
3# VBoxService wrapper script.
4#
5# Load required kernel extensions before start service (if necessary).
6#
7
8#
9# Copyright (C) 2007-2022 Oracle Corporation
10#
11# This file is part of VirtualBox Open Source Edition (OSE), as
12# available from http://www.virtualbox.org. This file is free software;
13# you can redistribute it and/or modify it under the terms of the GNU
14# General Public License (GPL) as published by the Free Software
15# Foundation, in version 2 as it comes in the "COPYING" file of the
16# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
17# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
18#
19
20export PATH="/bin:/usr/bin:/sbin:/usr/sbin:$PATH"
21
22echo "Check if kernel extensions loaded..."
23items="VBoxGuest"
24for item in $items; do
25 kext_item="org.virtualbox.kext.$item"
26 loaded=`kextstat | grep $kext_item`
27 if [ -z "$loaded" ] ; then
28 echo "Loading $item kernel extension..."
29 XNU_VERSION=`LC_ALL=C uname -r | LC_ALL=C cut -d . -f 1`
30 if [ "$XNU_VERSION" -ge "10" ]; then
31 kextutil /Library/Extensions/$item.kext
32 else
33 kextload /Library/Extensions/$item.kext
34 fi
35 fi
36done
37
38echo "Check if VBoxClient is added for all non-system users"
39for user in $(dscl . -list /Users | grep -v -e'^_' -e'root'); do
40 system_user="YES"
41 test -n "$(dscl . -read /Users/$user NFSHomeDirectory | grep '/Users')" && system_user="NO"
42 if [ "$system_user" = "NO" ]; then
43 loaded="NO"
44 test -n "$(sudo -u "$user" launchctl list | grep 'org.virtualbox.additions.vboxclient')" && loaded="YES"
45 if [ "$loaded" = "NO" ] ; then
46 echo "Loading org.virtualbox.additions.vboxclient for $user"
47 sudo -u "$user" launchctl load -F "/Library/LaunchAgents/org.virtualbox.additions.vboxclient.plist"
48 fi
49 fi
50done
51
52exec "/Library/Application Support/VirtualBox Guest Additions/VBoxService" -f
53
Note: See TracBrowser for help on using the repository browser.

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