summaryrefslogtreecommitdiffstats
path: root/src/VBox/Additions/darwin/Installer
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-11 08:17:27 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-11 08:17:27 +0000
commitf215e02bf85f68d3a6106c2a1f4f7f063f819064 (patch)
tree6bb5b92c046312c4e95ac2620b10ddf482d3fa8b /src/VBox/Additions/darwin/Installer
parentInitial commit. (diff)
downloadvirtualbox-c31cb7e733ae8e33d73383e04db264d4293f0b1a.tar.xz
virtualbox-c31cb7e733ae8e33d73383e04db264d4293f0b1a.zip
Adding upstream version 7.0.14-dfsg.upstream/7.0.14-dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/VBox/Additions/darwin/Installer')
-rw-r--r--src/VBox/Additions/darwin/Installer/.scm-settings37
-rwxr-xr-xsrc/VBox/Additions/darwin/Installer/DiskImage/Uninstall.tool124
-rw-r--r--src/VBox/Additions/darwin/Installer/Makefile.kmk414
-rw-r--r--src/VBox/Additions/darwin/Installer/VBoxGuestAdditionsKEXTs/PkgBuildComponent.plist15
-rwxr-xr-xsrc/VBox/Additions/darwin/Installer/VBoxGuestAdditionsKEXTs/postflight104
-rwxr-xr-xsrc/VBox/Additions/darwin/Installer/VBoxGuestAdditionsToolsAndServices/VBoxServiceWrapper63
-rw-r--r--src/VBox/Additions/darwin/Installer/VBoxGuestAdditionsToolsAndServices/org.virtualbox.additions.vboxclient.plist17
-rw-r--r--src/VBox/Additions/darwin/Installer/VBoxGuestAdditionsToolsAndServices/org.virtualbox.additions.vboxservice.plist15
-rw-r--r--src/VBox/Additions/darwin/Installer/VBoxGuestAdditions_mpkg/Conclusion.rtf9
-rw-r--r--src/VBox/Additions/darwin/Installer/VBoxGuestAdditions_mpkg/Localizable.strings14
-rw-r--r--src/VBox/Additions/darwin/Installer/VBoxGuestAdditions_mpkg/Welcome.rtf13
-rw-r--r--src/VBox/Additions/darwin/Installer/VBoxGuestAdditions_mpkg/distribution-amd64.dist70
-rw-r--r--src/VBox/Additions/darwin/Installer/VBoxGuestAdditions_mpkg/distribution-x86.dist70
13 files changed, 965 insertions, 0 deletions
diff --git a/src/VBox/Additions/darwin/Installer/.scm-settings b/src/VBox/Additions/darwin/Installer/.scm-settings
new file mode 100644
index 00000000..d46569be
--- /dev/null
+++ b/src/VBox/Additions/darwin/Installer/.scm-settings
@@ -0,0 +1,37 @@
+# $Id: .scm-settings $
+## @file
+# Source code massager settings for OS X guest additions installer.
+#
+
+#
+# Copyright (C) 2010-2023 Oracle and/or its affiliates.
+#
+# This file is part of VirtualBox base platform packages, as
+# available from https://www.virtualbox.org.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation, in version 3 of the
+# License.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <https://www.gnu.org/licenses>.
+#
+# SPDX-License-Identifier: GPL-3.0-only
+#
+
+
+--filter-out-files /VBoxGuestAdditions_mpkg/Conclusion.rtf
+--filter-out-files /VBoxGuestAdditions_mpkg/Welcome.rtf
+--filter-out-files /VBoxGuestAdditions_mpkg/Localizable.strings
+
+/DiskImage/Uninstall.tool: --treat-as .sh
+/VBoxGuestAdditionsKEXTs/postflight: --treat-as .sh
+/VBoxGuestAdditionsToolsAndServices/VBoxServiceWrapper: --treat-as .sh
+/VBoxGuestAdditions_mpkg/distribution.dist: --treat-as .xml
+
diff --git a/src/VBox/Additions/darwin/Installer/DiskImage/Uninstall.tool b/src/VBox/Additions/darwin/Installer/DiskImage/Uninstall.tool
new file mode 100755
index 00000000..e057c250
--- /dev/null
+++ b/src/VBox/Additions/darwin/Installer/DiskImage/Uninstall.tool
@@ -0,0 +1,124 @@
+#!/bin/sh
+# $Id: Uninstall.tool $
+## #file
+# VirtualBox Guest Additions uninstall script.
+#
+
+#
+# Copyright (C) 2007-2023 Oracle and/or its affiliates.
+#
+# This file is part of VirtualBox base platform packages, as
+# available from https://www.virtualbox.org.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation, in version 3 of the
+# License.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <https://www.gnu.org/licenses>.
+#
+# SPDX-License-Identifier: GPL-3.0-only
+#
+
+# Override any funny stuff from the user.
+export PATH="/bin:/usr/bin:/sbin:/usr/sbin:$PATH"
+
+#
+# Display a simple welcome message first.
+#
+echo ""
+echo "Welcome to the VirtualBox Guest Additions uninstall script."
+echo ""
+
+# Check if user interraction is required to start uninstall process.
+fUnattended=0
+if test "$#" != "0"; then
+ if test "$#" != "1" -o "$1" != "--unattended"; then
+ echo "Error: Unknown argument(s): $*"
+ echo ""
+ echo "Usage: $0 [--unattended]"
+ echo ""
+ echo "If the '--unattended' option is not given, you will be prompted"
+ echo "for a Yes/No before doing the actual uninstallation."
+ echo ""
+ exit 4;
+ fi
+ fUnattended="Yes"
+fi
+
+if test "$fUnattended" != "Yes"; then
+ echo "Do you wish to continue none the less (Yes/No)?"
+ read fUnattended
+ if test "$fUnattended" != "Yes" -a "$fUnattended" != "YES" -a "$fUnattended" != "yes"; then
+ echo "Aborting uninstall. (answer: '$fUnattended')".
+ exit 2;
+ fi
+ echo ""
+fi
+
+# Stop services
+echo "Checking running services..."
+unload()
+{
+ ITEM_ID=$1
+ ITEM_PATH=$2
+ FORCED_USER=$3
+
+ echo "Unloading $ITEM_ID"
+
+
+ loaded="NO"
+ test -n "$(sudo -u "$FORCED_USER" launchctl list | grep $ITEM_ID)" && loaded="YES"
+ if [ "$loaded" = "YES" ] ; then
+ sudo -p "Please enter $FORCED_USER's password (unloading $ITEM_ID):" sudo -u "$FORCED_USER" launchctl unload -F "$ITEM_PATH/$ITEM_ID.plist"
+ fi
+
+}
+
+unload "org.virtualbox.additions.vboxservice" "/Library/LaunchDaemons" "root"
+unload "org.virtualbox.additions.vboxclient" "/Library/LaunchAgents" `whoami`
+
+# Unload kernel extensions
+echo "Checking running kernel extensions..."
+items="VBoxGuest"
+for item in $items; do
+ kext_item="org.virtualbox.kext.$item"
+ loaded=`kextstat | grep $kext_item`
+ if [ ! -z "$loaded" ] ; then
+ echo "Unloading $item kernel extension"
+ sudo -p "Please enter %u's password (unloading $item):" kextunload -b $kext_item
+ fi
+done
+
+# Remove files and directories
+echo "Checking files and directories..."
+sudo -p "Please enter %u's password (removing files and directories):" rm -rf "/Library/Application Support/VirtualBox Guest Additions"
+sudo -p "Please enter %u's password (removing files and directories):" rm -rf "/Library/Extensions/VBoxGuest.kext"
+sudo -p "Please enter %u's password (removing files and directories):" rm -rf "/Library/LaunchAgents/org.virtualbox.additions.vboxclient.plist"
+sudo -p "Please enter %u's password (removing files and directories):" rm -rf "/Library/LaunchDaemons/org.virtualbox.additions.vboxservice.plist"
+
+# Cleaning up pkgutil database
+echo "Checking package database ..."
+items="kexts tools-and-services"
+for item in $items; do
+ pkg_item="org.virtualbox.pkg.additions.$item"
+ installed=`pkgutil --pkgs="$pkg_item"`
+ if [ ! -z "$installed" ] ; then
+ sudo -p "Please enter %u's password (removing $pkg_item):" pkgutil --forget "$pkg_item"
+ fi
+done
+
+# Remove our kexts from the cache.
+echo "Updating kernel cache."
+sudo -p "Please enter %u's password (refreshing kext cache):" touch "/System/Library/Extensions/"
+sudo -p "Please enter %u's password (refreshing kext cache):" kextcache -update-volume /
+
+echo "Done."
+exit 0;
+
diff --git a/src/VBox/Additions/darwin/Installer/Makefile.kmk b/src/VBox/Additions/darwin/Installer/Makefile.kmk
new file mode 100644
index 00000000..0dae3d97
--- /dev/null
+++ b/src/VBox/Additions/darwin/Installer/Makefile.kmk
@@ -0,0 +1,414 @@
+# $Id: Makefile.kmk $
+## @file
+# Install misc stuff and create dist packages for Mac OS X Guest Additions.
+#
+
+#
+# Copyright (C) 2006-2023 Oracle and/or its affiliates.
+#
+# This file is part of VirtualBox base platform packages, as
+# available from https://www.virtualbox.org.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation, in version 3 of the
+# License.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <https://www.gnu.org/licenses>.
+#
+# SPDX-License-Identifier: GPL-3.0-only
+#
+
+SUB_DEPTH = ../../../../..
+include $(KBUILD_PATH)/subheader.kmk
+
+
+#
+# Globals
+#
+VBOX_ADD_PATH_DI_SRC := $(PATH_SUB_CURRENT)
+VBOX_ADD_DI_OUT_DIR := $(PATH_TARGET)/additions/Installer
+BLDDIRS += $(VBOX_ADD_DI_OUT_DIR)
+
+ifdef VBOX_WITH_COMBINED_PACKAGE
+ ifeq ($(KBUILD_TARGET_ARCH),x86)
+ VBOX_PATH_DIST_32 = $(VBOX_PATH_DIST)/additions
+ VBOX_PATH_DIST_64 = $(PATH_OUT_BASE)/darwin.amd64/$(KBUILD_TYPE)/dist/additions
+ else
+ VBOX_PATH_DIST_64 = $(VBOX_PATH_DIST)/additions
+ VBOX_PATH_DIST_32 = $(PATH_OUT_BASE)/darwin.x86/$(KBUILD_TYPE)/dist
+ endif
+ VBOX_DI_FN_DEP_BOTH = $(VBOX_PATH_DIST_32)/$1 $(VBOX_PATH_DIST_64)/$2
+ VBOX_DI_FN_DEP_32 = $(VBOX_PATH_DIST_32)/$1
+ VBOX_DI_FN_DEP_64 = $(VBOX_PATH_DIST_64)/$1
+ VBOX_DI_LIPO = lipo
+else
+ VBOX_DI_FN_DEP_BOTH = $(VBOX_PATH_DIST)/additions/$1
+ ifeq ($(KBUILD_TARGET_ARCH),x86)
+ VBOX_DI_FN_DEP_32 = $(VBOX_PATH_DIST)/additions/$1
+ VBOX_DI_FN_DEP_64 =
+ else
+ VBOX_DI_FN_DEP_64 = $(VBOX_PATH_DIST)/additions/$1
+ VBOX_DI_FN_DEP_32 =
+ endif
+endif
+
+# Unset this to speed up things during makefile hacking.
+VBOX_DARWIN_INST_DEP_ON_MAKEFILE := $(MAKEFILE_CURRENT)
+
+# The location of the pkgbuild program.
+ifndef VBOX_PKGBUILD
+ VBOX_PKGBUILD := pkgbuild
+endif
+
+# The location of the productbuild program.
+ifndef VBOX_PRODUCTBUILD
+ VBOX_PRODUCTBUILD := productbuild
+endif
+
+# Where we do the packing (override this in LocalConfig.kmk if building on smbfs).
+ifndef VBOX_PATH_PACK_TMP
+ VBOX_PATH_PACK_TMP := $(VBOX_ADD_DI_OUT_DIR)
+endif
+
+
+#
+# The packing.
+#
+PACKING += \
+ $(PATH_STAGE)/$(INST_ADDITIONS)VBoxGuestAdditions.pkg \
+ $(PATH_STAGE)/$(INST_ADDITIONS)VBoxDarwinAdditionsUninstall.tool
+
+#OTHER_CLEAN = TODO
+
+
+include $(FILE_KBUILD_SUB_FOOTER)
+
+
+#
+# We're running commands as root here, take some care and assertion
+# a sane environment.
+#
+ifeq ($(strip $(VBOX_PATH_DIST)),)
+ $(error VBOX_PATH_DIST=$(VBOX_PATH_DIST))
+endif
+ifeq ($(strip $(VBOX_PATH_DIST)),/)
+ $(error VBOX_PATH_DIST=$(VBOX_PATH_DIST))
+endif
+ifeq ($(strip $(VBOX_PATH_PACK_TMP)),)
+ $(error VBOX_PATH_PACK_TMP=$(VBOX_PATH_PACK_TMP))
+endif
+ifeq ($(strip $(VBOX_PATH_PACK_TMP)),/)
+ $(error VBOX_PATH_PACK_TMP=$(VBOX_PATH_PACK_TMP))
+endif
+
+#
+# The packing targets.
+#
+$(PATH_STAGE)/$(INST_ADDITIONS)VBoxGuestAdditions.pkg: $(VBOX_PATH_PACK_TMP)/VBoxGuestAdditions.pkg
+ $(MKDIR) -p "$(@D)"
+ $(INSTALL) -m 0644 -- "$<" "$@"
+
+$(PATH_STAGE)/$(INST_ADDITIONS)VBoxDarwinAdditionsUninstall.tool: $(VBOX_ADD_PATH_DI_SRC)/DiskImage/Uninstall.tool
+ $(MKDIR) -p "$(@D)"
+ $(INSTALL) -m 0755 -- "$<" "$@"
+
+
+#
+# The meta-package.
+#
+$(VBOX_PATH_PACK_TMP)/VBoxGuestAdditions.pkg: \
+ $(VBOX_PATH_PACK_TMP)/Packages/VBoxGuestAdditionsKEXTs.pkg \
+ $(VBOX_PATH_PACK_TMP)/Packages/VBoxGuestAdditionsToolsAndServices.pkg \
+ $$(wildcard $(VBOX_ADD_PATH_DI_SRC)/VBoxGuestAdditions_mpkg/* \
+ $(VBOX_ADD_PATH_DI_SRC)/VBoxGuestAdditions_mpkg/*.lproj/*) \
+ $(foreach f,$(VBOX_INSTALLER_ADD_LANGUAGES), $(VBOX_BRAND_$(f)_VIRTUALBOX_WELCOME_RTF)) \
+ $(VBOX_ADD_PATH_DI_SRC)/VBoxGuestAdditions_mpkg/Welcome.rtf \
+ $(VBOX_ADD_PATH_DI_SRC)/VBoxGuestAdditions_mpkg/Conclusion.rtf \
+ $(VBOX_ADD_PATH_DI_SRC)/VBoxGuestAdditions_mpkg/distribution-$(KBUILD_TARGET_ARCH).dist \
+ $(VBOX_DARWIN_INST_DEP_ON_MAKEFILE)
+ $(call MSG_TOOL,productbuild,,,$@)
+ @# Cleanup any previously failed attempts.
+ sudo rm -Rf \
+ $@ \
+ $(VBOX_PATH_PACK_TMP)/VBoxDarwinAdditions.dist.root \
+ $(VBOX_PATH_PACK_TMP)/VBoxDarwinAdditions.dist.desc \
+ $(VBOX_PATH_PACK_TMP)/VBoxDarwinAdditions.dist.res
+ @# Correct directory permissions are important.
+ $(MKDIR) -p \
+ $(@D) \
+ $(VBOX_PATH_PACK_TMP)/VBoxDarwinAdditions.dist.desc \
+ $(VBOX_PATH_PACK_TMP)/VBoxDarwinAdditions.dist.res \
+ $(VBOX_PATH_PACK_TMP)/VBoxDarwinAdditions.dist.res/English.lproj
+
+ @# Do keyword replacement in the package info and description files.
+ $(SED) \
+ -e 's+@VBOX_VERSION_STRING@+$(VBOX_VERSION_STRING)+g' \
+ -e 's+@VBOX_VERSION_MAJOR@+$(VBOX_VERSION_MAJOR)+g' \
+ -e 's+@VBOX_VERSION_MINOR@+$(VBOX_VERSION_MINOR)+g' \
+ -e 's+@VBOX_VERSION_BUILD@+$(VBOX_VERSION_BUILD)+g' \
+ -e 's+@VBOX_VENDOR@+$(VBOX_VENDOR)+g' \
+ -e 's+@VBOX_PRODUCT@+$(VBOX_PRODUCT)+g' \
+ -e 's+@VBOX_C_YEAR@+$(VBOX_C_YEAR)+g' \
+ --output $(VBOX_PATH_PACK_TMP)/VBoxDarwinAdditions.dist.res/English.lproj/Welcome.rtf \
+ $(VBOX_ADD_PATH_DI_SRC)/VBoxGuestAdditions_mpkg/Welcome.rtf
+ @# Copy the resources.
+ $(INSTALL) -m 0644 $(VBOX_ADD_PATH_DI_SRC)/VBoxGuestAdditions_mpkg/Conclusion.rtf $(VBOX_PATH_PACK_TMP)/VBoxDarwinAdditions.dist.res/English.lproj/Conclusion.rtf
+
+ $(SED) \
+ -e 's+@VBOX_VENDOR@+$(VBOX_VENDOR)+g' \
+ -e 's+@VBOX_PRODUCT@+$(VBOX_PRODUCT)+g' \
+ -e 's+@VBOX_C_YEAR@+$(VBOX_C_YEAR)+g' \
+ --output $(VBOX_PATH_PACK_TMP)/VBoxDarwinAdditions.dist.res/English.lproj/Localizable.strings \
+ $(VBOX_ADD_PATH_DI_SRC)/VBoxGuestAdditions_mpkg/Localizable.strings
+ $(INSTALL) -m 0644 $(VBOX_BRAND_DARWIN_INSTALLER_BG) $(VBOX_PATH_PACK_TMP)/VBoxDarwinAdditions.dist.res/background.tif
+
+ $(foreach f,$(VBOX_INSTALLER_ADD_LANGUAGES), \
+ $(MKDIR) -p \
+ $(VBOX_PATH_PACK_TMP)/VBoxDarwinAdditions.dist.res/$(VBOX_INSTALLER_$(f)_DARWIN_TARGET).lproj$(NLTAB) \
+ $(SED) \
+ -e 's+@VBOX_VERSION_STRING@+$(VBOX_VERSION_STRING)+g' \
+ -e 's+@VBOX_VERSION_MAJOR@+$(VBOX_VERSION_MAJOR)+g' \
+ -e 's+@VBOX_VERSION_MINOR@+$(VBOX_VERSION_MINOR)+g' \
+ -e 's+@VBOX_VERSION_BUILD@+$(VBOX_VERSION_BUILD)+g' \
+ --output $(VBOX_PATH_PACK_TMP)/VBoxDarwinAdditions.dist.res/$(VBOX_INSTALLER_$(f)_DARWIN_TARGET).lproj/Welcome.rtf \
+ $(VBOX_BRAND_$(f)_VIRTUALBOX_WELCOME_RTF)$(NLTAB) \
+ $(INSTALL) -m 0644 $(VBOX_BRAND_$(f)_VIRTUALBOX_CONCLUSION_RTF) $(VBOX_PATH_PACK_TMP)/VBoxDarwinAdditions.dist.res/$(VBOX_INSTALLER_$(f)_DARWIN_TARGET).lproj/Conclusion.rtf$(NLTAB) \
+ $(SED) \
+ -e 's+@VBOX_VENDOR@+$(VBOX_VENDOR)+g' \
+ -e 's+@VBOX_PRODUCT@+$(VBOX_PRODUCT)+g' \
+ -e 's+@VBOX_C_YEAR@+$(VBOX_C_YEAR)+g' \
+ --output $(VBOX_PATH_PACK_TMP)/VBoxDarwinAdditions.dist.res/$(VBOX_INSTALLER_$(f)_DARWIN_TARGET).lproj/Localizable.strings \
+ $(VBOX_BRAND_$(f)_VIRTUALBOX_LOCALIZABLE_STRINGS)$(NLTAB) \
+ )
+
+ @# Build the package.
+ $(VBOX_PRODUCTBUILD) \
+ --distribution $(VBOX_ADD_PATH_DI_SRC)/VBoxGuestAdditions_mpkg/distribution-$(KBUILD_TARGET_ARCH).dist \
+ --package-path $(VBOX_PATH_PACK_TMP)/Packages \
+ --resources $(VBOX_PATH_PACK_TMP)/VBoxDarwinAdditions.dist.res \
+ --identifier org.VirtualBox.mpkg.GuestAdditions \
+ --version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
+ $(if-expr defined(VBOX_MACOSX_INSTALLER_SIGN) && $(intersects darwin all 1,$(VBOX_WITH_CORP_CODE_SIGNING)) == "",--sign "$(VBOX_MACOSX_INSTALLER_SIGN)",) \
+ $@
+ifdef VBOX_SIGNING_MODE
+ if $(intersects darwin all 1,$(VBOX_WITH_CORP_CODE_SIGNING))
+ @# Sign the created pkg.
+ $(call VBOX_SIGN_PKG_FN,$@,org.VirtualBox.mpkg.GuestAdditions)
+ if $(intersects darwin all 1,$(VBOX_WITH_CORP_CODE_SIGNING))
+ @# Notarize the signed pkg (includes stapling).
+ $(call VBOX_NOTARIZE_FILE_FN,$@,org.virtualbox.VBoxGuestAdditions.$(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD).$(VBOX_SVN_REV))
+ endif
+ endif
+endif
+
+ @# Cleanup.
+ sudo rm -Rf \
+ $(VBOX_PATH_PACK_TMP)/VBoxDarwinAdditions.dist.root \
+ $(VBOX_PATH_PACK_TMP)/VBoxDarwinAdditions.dist.desc \
+ $(VBOX_PATH_PACK_TMP)/VBoxDarwinAdditions.dist.res
+
+VBoxDarwinAdditions.pkg:: $(VBOX_PATH_PACK_TMP)/VBoxDarwinAdditions.pkg
+
+#
+# The VirtualBox Kernel extensions.
+#
+VBOX_ADD_DI_KEXTS_UNIVERSAL = VBoxGuest
+VBOX_ADD_DI_KEXTS = $(VBOX_ADD_DI_KEXTS_UNIVERSAL)
+
+$(VBOX_PATH_PACK_TMP)/Packages/VBoxGuestAdditionsKEXTs.pkg: \
+ $(foreach kext,$(VBOX_ADD_DI_KEXTS_UNIVERSAL), $(call VBOX_DI_FN_DEP_BOTH,$(kext).kext/Contents/MacOS/$(kext))) \
+ $(foreach kext,$(VBOX_ADD_DI_KEXTS), $(VBOX_PATH_DIST)/additions/$(kext).kext/Contents/Info.plist) \
+ $$(wildcard $(VBOX_ADD_PATH_DI_SRC)/VBoxGuestAdditionsKEXTs/* \
+ $(VBOX_ADD_PATH_DI_SRC)/VBoxGuestAdditionsKEXTs/*.lproj/*) \
+ $(foreach f,$(VBOX_INSTALLER_ADD_LANGUAGES), \
+ $(VBOX_BRAND_$(f)_VBOXKEXTS_DESCRIPTION_PLIST) \
+ $(VBOX_BRAND_$(f)_VBOXKEXTS_README_HTML) \
+ $(VBOX_BRAND_$(f)_VBOXKEXTS_INSTALLATIONCHECK_STRINGS)) \
+ $(VBOX_ADD_PATH_DI_SRC)/VBoxGuestAdditionsKEXTs/postflight \
+ $(VBOX_ADD_PATH_DI_SRC)/VBoxGuestAdditionsKEXTs/PkgBuildComponent.plist \
+ $(VBOX_DARWIN_INST_DEP_ON_MAKEFILE)
+ $(call MSG_TOOL,pkgbuild,,,$@)
+ @# Cleanup any previously failed attempts.
+ sudo rm -Rf \
+ $@ \
+ $(VBOX_PATH_PACK_TMP)/VBoxGuestAdditionsKEXTs.pkg.root \
+ $(VBOX_PATH_PACK_TMP)/VBoxGuestAdditionsKEXTs.pkg.desc \
+ $(VBOX_PATH_PACK_TMP)/VBoxGuestAdditionsKEXTs.pkg.res
+ @# Correct directory permissions are important.
+ $(MKDIR) -p \
+ $(@D) \
+ $(VBOX_PATH_PACK_TMP)/VBoxGuestAdditionsKEXTs.pkg.desc \
+ $(VBOX_PATH_PACK_TMP)/VBoxGuestAdditionsKEXTs.pkg.res \
+ $(VBOX_PATH_PACK_TMP)/VBoxGuestAdditionsKEXTs.pkg.res/English.lproj
+ $(MKDIR) -p -m 1775 $(VBOX_PATH_PACK_TMP)/VBoxGuestAdditionsKEXTs.pkg.root/Library
+ $(MKDIR) -p -m 0755 \
+ $(VBOX_PATH_PACK_TMP)/VBoxGuestAdditionsKEXTs.pkg.root/Library/Extensions \
+ $(foreach kext,$(VBOX_ADD_DI_KEXTS), \
+ $(VBOX_PATH_PACK_TMP)/VBoxGuestAdditionsKEXTs.pkg.root/Library/Extensions/$(kext).kext \
+ $(VBOX_PATH_PACK_TMP)/VBoxGuestAdditionsKEXTs.pkg.root/Library/Extensions/$(kext).kext/Contents \
+ $(VBOX_PATH_PACK_TMP)/VBoxGuestAdditionsKEXTs.pkg.root/Library/Extensions/$(kext).kext/Contents/MacOS )
+ @# Copy the common files (Info.plist).
+ $(foreach kext,$(VBOX_ADD_DI_KEXTS), \
+ $(NLTAB)$(INSTALL) -m 0644 $(VBOX_PATH_DIST)/additions/$(kext).kext/Contents/Info.plist $(VBOX_PATH_PACK_TMP)/VBoxGuestAdditionsKEXTs.pkg.root/Library/Extensions/$(kext).kext/Contents/)
+ @# Copy the binaries and invoking lipo.
+ifdef VBOX_WITH_COMBINED_PACKAGE
+ $(foreach kext,$(VBOX_ADD_DI_KEXTS_UNIVERSAL), \
+ $(NLTAB)$(VBOX_DI_LIPO) -create \
+ $(VBOX_PATH_DIST_32)/additions/$(kext).kext/Contents/MacOS/$(kext) \
+ $(VBOX_PATH_DIST_64)/additions/$(kext).kext/Contents/MacOS/$(kext) \
+ -output $(VBOX_PATH_PACK_TMP)/VBoxGuestAdditionsKEXTs.pkg.root/Library/Extensions/$(kext).kext/Contents/MacOS/$(kext))
+else
+ $(foreach kext,$(VBOX_ADD_DI_KEXTS), \
+ $(NLTAB)$(INSTALL) -m 0755 $(VBOX_PATH_DIST)/additions/$(kext).kext/Contents/MacOS/$(kext) $(VBOX_PATH_PACK_TMP)/VBoxGuestAdditionsKEXTs.pkg.root/Library/Extensions/$(kext).kext/Contents/MacOS/)
+endif
+ @# Sign the kext bundles.
+ifdef VBOX_SIGNING_MODE
+ $(foreach kext,$(VBOX_ADD_DI_KEXTS), \
+ $(NLTAB)$(call VBOX_SIGN_BUNDLE_FN,$(VBOX_PATH_PACK_TMP)/VBoxGuestAdditionsKEXTs.pkg.root/Library/Extensions/$(kext).kext,) \
+ $(NLTAB)chmod a+r $(VBOX_PATH_PACK_TMP)/VBoxGuestAdditionsKEXTs.pkg.root/Library/Extensions/$(kext).kext/Contents/_CodeSignature/* )
+endif
+ @# Set the correct owners.
+ sudo chown root:admin $(VBOX_PATH_PACK_TMP)/VBoxGuestAdditionsKEXTs.pkg.root/Library
+ sudo chown -R root:wheel $(VBOX_PATH_PACK_TMP)/VBoxGuestAdditionsKEXTs.pkg.root/Library/Extensions
+
+ # Copy package internal files
+ $(INSTALL) $(VBOX_ADD_PATH_DI_SRC)/VBoxGuestAdditionsKEXTs/PkgBuildComponent.plist $(VBOX_PATH_PACK_TMP)/VBoxGuestAdditionsKEXTs.pkg.desc/PkgBuildComponent.plist
+
+ # Copy installer scripts
+ $(INSTALL) -m 0755 $(VBOX_ADD_PATH_DI_SRC)/VBoxGuestAdditionsKEXTs/postflight $(VBOX_PATH_PACK_TMP)/VBoxGuestAdditionsKEXTs.pkg.res
+
+ @# Build the package.
+ $(VBOX_PKGBUILD) \
+ --root $(VBOX_PATH_PACK_TMP)/VBoxGuestAdditionsKEXTs.pkg.root/Library/Extensions/ \
+ --component-plist $(VBOX_PATH_PACK_TMP)/VBoxGuestAdditionsKEXTs.pkg.desc/PkgBuildComponent.plist \
+ --script $(VBOX_PATH_PACK_TMP)/VBoxGuestAdditionsKEXTs.pkg.res \
+ --identifier org.virtualbox.pkg.additions.kexts \
+ --version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
+ --install-location /Library/Extensions/ \
+ --ownership preserve \
+ $(if-expr defined(VBOX_MACOSX_INSTALLER_SIGN) && $(intersects darwin all 1,$(VBOX_WITH_CORP_CODE_SIGNING)) == "",--sign "$(VBOX_MACOSX_INSTALLER_SIGN)",) \
+ $@
+ifdef VBOX_SIGNING_MODE
+ if $(intersects darwin all 1,$(VBOX_WITH_CORP_CODE_SIGNING))
+ @# Sign the created pkg.
+ $(call VBOX_SIGN_PKG_FN,$@,org.virtualbox.pkg.vboxguestadditionskexts)
+ endif
+endif
+ @# Cleanup
+ sudo rm -Rf \
+ $(VBOX_PATH_PACK_TMP)/VBoxGuestAdditionsKEXTs.pkg.root \
+ $(VBOX_PATH_PACK_TMP)/VBoxGuestAdditionsKEXTs.pkg.desc \
+ $(VBOX_PATH_PACK_TMP)/VBoxGuestAdditionsKEXTs.pkg.res
+
+#
+# The VirtualBox Guest Additions Tools & Services.
+#
+
+VBOX_GA_PKG = VBoxGuestAdditionsToolsAndServices.pkg
+VBOX_DI_VB_GA_BINARIES = VBoxClient VBoxControl VBoxService
+$(VBOX_PATH_PACK_TMP)/Packages/$(VBOX_GA_PKG): \
+ $(foreach f, $(VBOX_DI_VB_GA_BINARIES) \
+ ,$(call VBOX_DI_FN_DEP_BOTH,$(f)) ) \
+ $(VBOX_ADD_PATH_DI_SRC)/VBoxGuestAdditionsToolsAndServices/org.virtualbox.additions.vboxclient.plist \
+ $(VBOX_ADD_PATH_DI_SRC)/VBoxGuestAdditionsToolsAndServices/org.virtualbox.additions.vboxservice.plist \
+ $(VBOX_ADD_PATH_DI_SRC)/VBoxGuestAdditionsToolsAndServices/VBoxServiceWrapper \
+ $(VBOX_ADD_PATH_DI_SRC)/DiskImage/Uninstall.tool \
+ $(VBOX_DARWIN_INST_DEP_ON_MAKEFILE)
+ $(call MSG_TOOL,pkgbuild,,,$@)
+ @# Cleanup any previously failed attempts.
+ sudo rm -Rf \
+ $@ \
+ $(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).root \
+ $(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).desc \
+ $(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).res
+ @# Correct directory permissions are important.
+ $(MKDIR) -p \
+ $(@D) \
+ $(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).desc \
+ $(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).res \
+ $(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).res/English.lproj
+
+ @# Create directory structure within a package w/ proper permittions
+ $(MKDIR) -p -m 0775 \
+ "$(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).root/Library/Application Support/VirtualBox Guest Additions" \
+ "$(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).root/Library/LaunchAgents" \
+ "$(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).root/Library/LaunchDaemons"
+
+ @# Install binaries
+ifdef VBOX_WITH_COMBINED_PACKAGE
+ $(foreach binary, $(VBOX_DI_VB_GA_BINARIES) \
+ ,$(VBOX_DI_LIPO) -create \
+ $(VBOX_PATH_DIST_32)/additions/$(binary) \
+ $(VBOX_PATH_DIST_64)/additions/$(binary) \
+ -output "$(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).root/Library/Application Support/VirtualBox Guest Additions/$(binary)"$(NLTAB))
+ $(foreach binary, $(VBOX_DI_VB_GA_BINARIES), \
+ $(NLTAB)$(INSTALL) -m 0755 $(VBOX_PATH_DIST_32)/additions/$(binary) "$(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).root/Library/Application Support/VirtualBox Guest Additions/$(binary)-x86" \
+ $(NLTAB)$(INSTALL) -m 0755 $(VBOX_PATH_DIST_64)/additions/$(binary) "$(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).root/Library/Application Support/VirtualBox Guest Additions/$(binary)-amd64" )
+else
+ $(foreach binary, $(VBOX_DI_VB_GA_BINARIES) \
+ ,$(INSTALL) -m 0755 $(VBOX_PATH_DIST)/additions/$(binary) "$(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).root/Library/Application Support/VirtualBox Guest Additions/$(binary)"$(NLTAB))
+ $(foreach binary, $(VBOX_DI_VB_GA_BINARIES) \
+ ,$(INSTALL) -m 0755 $(VBOX_PATH_DIST)/additions/$(binary) "$(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).root/Library/Application Support/VirtualBox Guest Additions/$(binary)-$(KBUILD_TARGET_ARCH)"$(NLTAB))
+endif
+ # Add Uninstall.tool
+ $(INSTALL) -m 0755 $(VBOX_ADD_PATH_DI_SRC)/DiskImage/Uninstall.tool "$(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).root/Library/Application Support/VirtualBox Guest Additions/"
+ifdef VBOX_SIGNING_MODE
+ $(call VBOX_SIGN_FILE_FN,$(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).root/Library/Application Support/VirtualBox Guest Additions/Uninstall.tool,org.virtualbox.app.guestadditions.uninstaller)
+endif
+
+ @# Install launchd stuff
+ $(INSTALL) -m 0755 $(VBOX_ADD_PATH_DI_SRC)/VBoxGuestAdditionsToolsAndServices/VBoxServiceWrapper \
+ "$(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).root/Library/Application Support/VirtualBox Guest Additions/"
+ $(INSTALL) -m 644 $(VBOX_ADD_PATH_DI_SRC)/VBoxGuestAdditionsToolsAndServices/org.virtualbox.additions.vboxclient.plist \
+ "$(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).root/Library/LaunchAgents/"
+ $(INSTALL) -m 644 $(VBOX_ADD_PATH_DI_SRC)/VBoxGuestAdditionsToolsAndServices/org.virtualbox.additions.vboxservice.plist \
+ "$(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).root/Library/LaunchDaemons/"
+
+ @# Sign the binaries.
+ifdef VBOX_SIGNING_MODE
+ ifdef VBOX_WITH_COMBINED_PACKAGE
+ $(foreach binary, $(VBOX_DI_VB_GA_BINARIES) \
+ ,$(NLTAB)$(call VBOX_SIGN_MACHO_FN,$(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).root/Library/Application Support/VirtualBox Guest Additions/$(binary),org.virtualbox.app.guestadditions.$(notdir $(binary))) )
+ $(foreach binary, $(VBOX_DI_VB_GA_BINARIES) \
+ ,$(NLTAB)$(call VBOX_SIGN_MACHO_FN,$(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).root/Library/Application Support/VirtualBox Guest Additions/$(binary)-x86,org.virtualbox.app.guestadditions.$(notdir $(binary))-x86) )
+ $(foreach binary, $(VBOX_DI_VB_GA_BINARIES) \
+ ,$(NLTAB)$(call VBOX_SIGN_MACHO_FN,$(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).root/Library/Application Support/VirtualBox Guest Additions/$(binary)-amd64,org.virtualbox.app.guestadditions.$(notdir $(binary))-amd64) )
+ else
+ $(foreach binary, $(VBOX_DI_VB_GA_BINARIES) \
+ ,$(NLTAB)$(call VBOX_SIGN_MACHO_FN,$(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).root/Library/Application Support/VirtualBox Guest Additions/$(binary),org.virtualbox.app.guestadditions.$(notdir $(binary))) )
+ $(foreach binary, $(VBOX_DI_VB_GA_BINARIES) \
+ ,$(NLTAB)$(call VBOX_SIGN_MACHO_FN,$(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).root/Library/Application Support/VirtualBox Guest Additions/$(binary)-$(KBUILD_TARGET_ARCH),org.virtualbox.app.guestadditions.$(notdir $(binary))-$(KBUILD_TARGET_ARCH)) )
+ endif
+endif
+
+ @# Correct ownership
+ sudo chown -R root:wheel "$(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).root/Library/"
+
+ @# Build the package.
+ $(VBOX_PKGBUILD) \
+ --root "$(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).root/Library/" \
+ --script $(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).res \
+ --identifier org.virtualbox.pkg.additions.tools-and-services \
+ --version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
+ --install-location "/Library/" \
+ --ownership preserve \
+ $(if-expr defined(VBOX_MACOSX_INSTALLER_SIGN) && $(intersects darwin all 1,$(VBOX_WITH_CORP_CODE_SIGNING)) == "",--sign "$(VBOX_MACOSX_INSTALLER_SIGN)",) \
+ $@
+ifdef VBOX_SIGNING_MODE
+ if $(intersects darwin all 1,$(VBOX_WITH_CORP_CODE_SIGNING))
+ @# Sign the created pkg.
+ $(call VBOX_SIGN_PKG_FN,$@,org.virtualbox.pkg.vboxguestadditions)
+ endif
+endif
+ @# Cleanup
+ sudo rm -Rf \
+ $(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).root \
+ $(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).desc \
+ $(VBOX_PATH_PACK_TMP)/$(VBOX_GA_PKG).res
diff --git a/src/VBox/Additions/darwin/Installer/VBoxGuestAdditionsKEXTs/PkgBuildComponent.plist b/src/VBox/Additions/darwin/Installer/VBoxGuestAdditionsKEXTs/PkgBuildComponent.plist
new file mode 100644
index 00000000..56d8701b
--- /dev/null
+++ b/src/VBox/Additions/darwin/Installer/VBoxGuestAdditionsKEXTs/PkgBuildComponent.plist
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<array>
+ <dict>
+ <key>RootRelativeBundlePath</key> <string>VBoxGuest.kext</string>
+ <key>BundleIsRelocatable</key> <false/>
+ <key>BundleIsVersionChecked</key> <false/>
+ <key>BundleHasStrictIdentifier</key> <false/>
+ <key>BundleOverwriteAction</key> <string>upgrade</string>
+ <key>BundlePostInstallScriptPath</key> <string>postflight</string>
+ </dict>
+</array>
+</plist>
+
diff --git a/src/VBox/Additions/darwin/Installer/VBoxGuestAdditionsKEXTs/postflight b/src/VBox/Additions/darwin/Installer/VBoxGuestAdditionsKEXTs/postflight
new file mode 100755
index 00000000..5b0a0b8c
--- /dev/null
+++ b/src/VBox/Additions/darwin/Installer/VBoxGuestAdditionsKEXTs/postflight
@@ -0,0 +1,104 @@
+#!/bin/sh
+# $Id: postflight $
+## @file
+# Post flight installer script for the VirtualBox OS X kernel extensions.
+#
+
+#
+# Copyright (C) 2007-2023 Oracle and/or its affiliates.
+#
+# This file is part of VirtualBox base platform packages, as
+# available from https://www.virtualbox.org.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation, in version 3 of the
+# License.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <https://www.gnu.org/licenses>.
+#
+# SPDX-License-Identifier: GPL-3.0-only
+#
+
+set -e
+
+# Setup environment.
+export PATH="/bin:/usr/bin:/sbin:/usr/sbin:$PATH"
+
+unload_service()
+{
+ ITEM_ID=$1
+ ITEM_PATH=$2
+ FORCED_USER=$3
+
+ loaded="NO"
+ test -n "$(sudo -u "$FORCED_USER" launchctl list | grep $ITEM_ID)" && loaded="YES"
+ if [ "$loaded" = "YES" ] ; then
+ echo "Unloading previously installed service: $ITEM_ID"
+ sudo -u "$FORCED_USER" launchctl unload -F "$ITEM_PATH/$ITEM_ID.plist"
+ fi
+}
+
+load_service()
+{
+ ITEM_ID=$1
+ ITEM_PATH=$2
+ FORCED_USER=$3
+
+ echo "Loading newly installed service: $ITEM_ID"
+ sudo -u "$FORCED_USER" launchctl load -F "$ITEM_PATH/$ITEM_ID.plist"
+}
+
+unload_service "org.virtualbox.additions.vboxservice" "/Library/LaunchDaemons" "root"
+
+# Remove the old service for all users
+for user in $(dscl . -list /Users | grep -v -e'^_' -e'root'); do
+ system_user="YES"
+ test -n "$(dscl . -read /Users/$user NFSHomeDirectory | grep '/Users')" && system_user="NO"
+ if [ "$system_user" = "NO" ]; then
+ unload_service "org.virtualbox.additions.vboxclient" "/Library/LaunchAgents" "$user"
+ fi
+done
+
+items="VBoxGuest"
+for item in $items; do
+ kext_item="org.virtualbox.kext.$item"
+
+ loaded="NO"
+ test -n "$(kextstat | grep $kext_item)" && loaded="YES"
+ if [ "$loaded" = "YES" ] ; then
+ echo "Unloading $item kernel extension..."
+ kextunload -b $kext_item
+ fi
+done
+
+MACOS_VERS=$(sw_vers -productVersion)
+
+echo "Updating kernel cache (should trigger loading of new modules)."
+# /System/Library/Extensions is readonly in Catalina and later,
+# so touch returns always false on these systems
+if [[ ${MACOS_VERS} != 11.* ]] && [[ ${MACOS_VERS} != 10.15.* ]]; then
+ touch "/System/Library/Extensions/"
+fi
+kextcache -update-volume / || true
+
+load_service "org.virtualbox.additions.vboxservice" "/Library/LaunchDaemons" "root"
+# Add VBoxClient for all currently defined users
+for user in $(dscl . -list /Users | grep -v -e'^_' -e'root'); do
+ system_user="YES"
+ test -n "$(dscl . -read /Users/$user NFSHomeDirectory | grep '/Users')" && system_user="NO"
+ if [ "$system_user" = "NO" ]; then
+ load_service "org.virtualbox.additions.vboxclient" "/Library/LaunchAgents" "$user"
+ fi
+done
+
+echo "Warning: If VBoxService adjusts the time backwards (because of --biossystemtimeoffset), the installer may hang."
+echo "Done."
+
+exit 0;
diff --git a/src/VBox/Additions/darwin/Installer/VBoxGuestAdditionsToolsAndServices/VBoxServiceWrapper b/src/VBox/Additions/darwin/Installer/VBoxGuestAdditionsToolsAndServices/VBoxServiceWrapper
new file mode 100755
index 00000000..864fc76b
--- /dev/null
+++ b/src/VBox/Additions/darwin/Installer/VBoxGuestAdditionsToolsAndServices/VBoxServiceWrapper
@@ -0,0 +1,63 @@
+#!/bin/sh
+## @file
+# VBoxService wrapper script.
+#
+# Load required kernel extensions before start service (if necessary).
+#
+
+#
+# Copyright (C) 2007-2023 Oracle and/or its affiliates.
+#
+# This file is part of VirtualBox base platform packages, as
+# available from https://www.virtualbox.org.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation, in version 3 of the
+# License.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <https://www.gnu.org/licenses>.
+#
+# SPDX-License-Identifier: GPL-3.0-only
+#
+
+export PATH="/bin:/usr/bin:/sbin:/usr/sbin:$PATH"
+
+echo "Check if kernel extensions loaded..."
+items="VBoxGuest"
+for item in $items; do
+ kext_item="org.virtualbox.kext.$item"
+ loaded=`kextstat | grep $kext_item`
+ if [ -z "$loaded" ] ; then
+ echo "Loading $item kernel extension..."
+ XNU_VERSION=`LC_ALL=C uname -r | LC_ALL=C cut -d . -f 1`
+ if [ "$XNU_VERSION" -ge "10" ]; then
+ kextutil /Library/Extensions/$item.kext
+ else
+ kextload /Library/Extensions/$item.kext
+ fi
+ fi
+done
+
+echo "Check if VBoxClient is added for all non-system users"
+for user in $(dscl . -list /Users | grep -v -e'^_' -e'root'); do
+ system_user="YES"
+ test -n "$(dscl . -read /Users/$user NFSHomeDirectory | grep '/Users')" && system_user="NO"
+ if [ "$system_user" = "NO" ]; then
+ loaded="NO"
+ test -n "$(sudo -u "$user" launchctl list | grep 'org.virtualbox.additions.vboxclient')" && loaded="YES"
+ if [ "$loaded" = "NO" ] ; then
+ echo "Loading org.virtualbox.additions.vboxclient for $user"
+ sudo -u "$user" launchctl load -F "/Library/LaunchAgents/org.virtualbox.additions.vboxclient.plist"
+ fi
+ fi
+done
+
+exec "/Library/Application Support/VirtualBox Guest Additions/VBoxService" -f
+
diff --git a/src/VBox/Additions/darwin/Installer/VBoxGuestAdditionsToolsAndServices/org.virtualbox.additions.vboxclient.plist b/src/VBox/Additions/darwin/Installer/VBoxGuestAdditionsToolsAndServices/org.virtualbox.additions.vboxclient.plist
new file mode 100644
index 00000000..6b8b6b05
--- /dev/null
+++ b/src/VBox/Additions/darwin/Installer/VBoxGuestAdditionsToolsAndServices/org.virtualbox.additions.vboxclient.plist
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>Disabled</key> <false/>
+ <key>RunAtLoad</key> <true/>
+ <key>KeepAlive</key> <true/>
+ <key>Label</key> <string>org.virtualbox.additions.vboxclient</string>
+
+ <key>ProgramArguments</key>
+ <array>
+ <string>/Library/Application Support/VirtualBox Guest Additions/VBoxClient</string>
+ <string>-f</string>
+ </array>
+</dict>
+</plist>
+
diff --git a/src/VBox/Additions/darwin/Installer/VBoxGuestAdditionsToolsAndServices/org.virtualbox.additions.vboxservice.plist b/src/VBox/Additions/darwin/Installer/VBoxGuestAdditionsToolsAndServices/org.virtualbox.additions.vboxservice.plist
new file mode 100644
index 00000000..d462b50d
--- /dev/null
+++ b/src/VBox/Additions/darwin/Installer/VBoxGuestAdditionsToolsAndServices/org.virtualbox.additions.vboxservice.plist
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>Disabled</key> <false/>
+ <key>RunAtLoad</key> <true/>
+ <key>KeepAlive</key> <true/>
+ <key>Label</key> <string>org.virtualbox.additions.vboxservice</string>
+
+ <key>ProgramArguments</key>
+ <array>
+ <string>/Library/Application Support/VirtualBox Guest Additions/VBoxServiceWrapper</string>
+ </array>
+</dict>
+</plist>
diff --git a/src/VBox/Additions/darwin/Installer/VBoxGuestAdditions_mpkg/Conclusion.rtf b/src/VBox/Additions/darwin/Installer/VBoxGuestAdditions_mpkg/Conclusion.rtf
new file mode 100644
index 00000000..66a61b5e
--- /dev/null
+++ b/src/VBox/Additions/darwin/Installer/VBoxGuestAdditions_mpkg/Conclusion.rtf
@@ -0,0 +1,9 @@
+{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf470
+{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\vieww10800\viewh8400\viewkind0
+\deftab720
+\pard\pardeftab720\sa240
+
+\f0\fs24 \cf0 VirtualBox Guest Addition successfully installed and ready for use.\
+} \ No newline at end of file
diff --git a/src/VBox/Additions/darwin/Installer/VBoxGuestAdditions_mpkg/Localizable.strings b/src/VBox/Additions/darwin/Installer/VBoxGuestAdditions_mpkg/Localizable.strings
new file mode 100644
index 00000000..3781727e
--- /dev/null
+++ b/src/VBox/Additions/darwin/Installer/VBoxGuestAdditions_mpkg/Localizable.strings
@@ -0,0 +1,14 @@
+'VirtualBox_title' = '@VBOX_PRODUCT@';
+
+'choiceVBoxKEXTs_title' = 'Kernel Extensions';
+'choiceVBoxKEXTs_msg' = 'Installs the @VBOX_PRODUCT@ Guest Additions Kernel Extensions into /Library/Extensions.';
+
+'choiceVBoxToolsAndServices_title' = 'Tools and Services';
+'choiceVBoxToolsAndServices_msg' = 'Installs the @VBOX_PRODUCT@ Guest Additions Tools and Services to /Library/Application Support/VirtualBox Guest Additions.';
+
+'UNSUPPORTED_AMD64_OS_TLE' = "Incompatible OS version detected!";
+'UNSUPPORTED_AMD64_OS_MSG' = "VirtualBox Guest Additions require Mac OS X 10.7 or later running in 64-bit mode.";
+
+'UNSUPPORTED_X86_OS_TLE' = "Incompatible OS version detected!";
+'UNSUPPORTED_X86_OS_MSG' = "The 32-bit VirtualBox Guest Additions are only for Mac OS X 10.7 and earlier running in 32-bit mode.";
+
diff --git a/src/VBox/Additions/darwin/Installer/VBoxGuestAdditions_mpkg/Welcome.rtf b/src/VBox/Additions/darwin/Installer/VBoxGuestAdditions_mpkg/Welcome.rtf
new file mode 100644
index 00000000..344017e3
--- /dev/null
+++ b/src/VBox/Additions/darwin/Installer/VBoxGuestAdditions_mpkg/Welcome.rtf
@@ -0,0 +1,13 @@
+{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf470
+{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\vieww10800\viewh8400\viewkind0
+\deftab720
+\pard\pardeftab720\sa280
+
+\f0\b\fs36 \cf0 @VBOX_PRODUCT@ Guest Additions for Mac OS X
+\b0 \
+\pard\pardeftab720\sa240
+
+\fs24 \cf0 Welcome to @VBOX_PRODUCT@ Guest Additions @VBOX_VERSION_MAJOR@.@VBOX_VERSION_MINOR@.@VBOX_VERSION_BUILD@ for Mac OS X! This installer will guide you through the installation process.\
+} \ No newline at end of file
diff --git a/src/VBox/Additions/darwin/Installer/VBoxGuestAdditions_mpkg/distribution-amd64.dist b/src/VBox/Additions/darwin/Installer/VBoxGuestAdditions_mpkg/distribution-amd64.dist
new file mode 100644
index 00000000..9e66538a
--- /dev/null
+++ b/src/VBox/Additions/darwin/Installer/VBoxGuestAdditions_mpkg/distribution-amd64.dist
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (C) 2008-2023 Oracle and/or its affiliates.
+
+ This file is part of VirtualBox base platform packages, as
+ available from https://www.virtualbox.org.
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation, in version 3 of the
+ License.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <https://www.gnu.org/licenses>.
+
+ SPDX-License-Identifier: GPL-3.0-only
+-->
+<installer-gui-script minSpecVersion="1.0">
+ <title>VirtualBox_title</title>
+ <options customize="allow" allow-external-scripts="false" rootVolumeOnly="true" hostArchitectures="i386"/>
+ <domains enable_anywhere="false" enable_currentUserHome="false" enable_localSystem="true"/>
+ <!-- This allowes a better error message compared to allowed-os-versions: -->
+ <installation-check script="checkPrerequisites()"></installation-check>
+ <script>
+ /* js:pkmk:start */
+ function checkPrerequisites()
+ {
+ sArch = system.sysctl('hw.machine');
+ system.log("Detected hw arch: " + sArch);
+ sVer = system.version['ProductVersion'];
+ system.log("Detected OS version: " + sVer);
+ if (sArch == 'x86_64')
+ {
+ if (system.compareVersions(sVer, '10.7') &gt;= 0)
+ {
+ system.log("checkPrerequisites returns true");
+ return true;
+ }
+ }
+ system.log("checkPrerequisites returns false!");
+ my.result.type = 'Fatal';
+ my.result.title = system.localizedString('UNSUPPORTED_AMD64_OS_TLE');
+ my.result.message = system.localizedString('UNSUPPORTED_AMD64_OS_MSG');
+ return false;
+ }
+ /* js:pkmk:end */
+ </script>
+ <background file="background.tif" alignment="topleft" scaling="none"/>
+ <welcome file="Welcome.rtf" mime-type="text/rtf" uti="public.rtf"/>
+ <choices-outline>
+ <line choice="choiceVBoxToolsAndServices"></line>
+ <line choice="choiceVBoxKEXTs"></line>
+ </choices-outline>
+
+ <choice id="choiceVBoxToolsAndServices" title="choiceVBoxToolsAndServices_title" description="choiceVBoxToolsAndServices_msg" start_selected="true" start_enabled="false" start_visible="true">
+ <pkg-ref id="org.virtualbox.pkg.additions.tools-and-services"></pkg-ref>
+ </choice>
+ <choice id="choiceVBoxKEXTs" title="choiceVBoxKEXTs_title" description="choiceVBoxKEXTs_msg" start_selected="true" start_enabled="false" start_visible="true">
+ <pkg-ref id="org.virtualbox.pkg.additions.kexts"></pkg-ref>
+ </choice>
+
+ <pkg-ref id="org.virtualbox.pkg.additions.tools-and-services" auth="Root">file:./Contents/Packages/VBoxGuestAdditionsToolsAndServices.pkg</pkg-ref>
+ <pkg-ref id="org.virtualbox.pkg.additions.kexts" auth="Root">file:./Contents/Packages/VBoxGuestAdditionsKEXTs.pkg</pkg-ref>
+
+</installer-gui-script>
diff --git a/src/VBox/Additions/darwin/Installer/VBoxGuestAdditions_mpkg/distribution-x86.dist b/src/VBox/Additions/darwin/Installer/VBoxGuestAdditions_mpkg/distribution-x86.dist
new file mode 100644
index 00000000..640081b3
--- /dev/null
+++ b/src/VBox/Additions/darwin/Installer/VBoxGuestAdditions_mpkg/distribution-x86.dist
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (C) 2008-2023 Oracle and/or its affiliates.
+
+ This file is part of VirtualBox base platform packages, as
+ available from https://www.virtualbox.org.
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation, in version 3 of the
+ License.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <https://www.gnu.org/licenses>.
+
+ SPDX-License-Identifier: GPL-3.0-only
+-->
+<installer-gui-script minSpecVersion="1.0">
+ <title>VirtualBox_title</title>
+ <options customize="allow" allow-external-scripts="false" rootVolumeOnly="true" hostArchitectures="i386"/>
+ <domains enable_anywhere="false" enable_currentUserHome="false" enable_localSystem="true"/>
+ <!-- This allowes a better error message compared to allowed-os-versions: -->
+ <installation-check script="checkPrerequisites()"></installation-check>
+ <script>
+ /* js:pkmk:start */
+ function checkPrerequisites()
+ {
+ sArch = system.sysctl('hw.machine');
+ system.log("Detected hw arch: " + sArch);
+ sVer = system.version['ProductVersion'];
+ system.log("Detected OS version: " + sVer);
+ if (sArch == 'i386')
+ {
+ if (system.compareVersions(sVer, '10.8') &lt; 0)
+ {
+ system.log("checkPrerequisites returns true");
+ return true;
+ }
+ }
+ system.log("checkPrerequisites returns false!");
+ my.result.type = 'Fatal';
+ my.result.title = system.localizedString('UNSUPPORTED_X86_OS_TLE');
+ my.result.message = system.localizedString('UNSUPPORTED_X86_OS_MSG');
+ return false;
+ }
+ /* js:pkmk:end */
+ </script>
+ <background file="background.tif" alignment="topleft" scaling="none"/>
+ <welcome file="Welcome.rtf" mime-type="text/rtf" uti="public.rtf"/>
+ <choices-outline>
+ <line choice="choiceVBoxToolsAndServices"></line>
+ <line choice="choiceVBoxKEXTs"></line>
+ </choices-outline>
+
+ <choice id="choiceVBoxToolsAndServices" title="choiceVBoxToolsAndServices_title" description="choiceVBoxToolsAndServices_msg" start_selected="true" start_enabled="false" start_visible="true">
+ <pkg-ref id="org.virtualbox.pkg.additions.tools-and-services"></pkg-ref>
+ </choice>
+ <choice id="choiceVBoxKEXTs" title="choiceVBoxKEXTs_title" description="choiceVBoxKEXTs_msg" start_selected="true" start_enabled="false" start_visible="true">
+ <pkg-ref id="org.virtualbox.pkg.additions.kexts"></pkg-ref>
+ </choice>
+
+ <pkg-ref id="org.virtualbox.pkg.additions.tools-and-services" auth="Root">file:./Contents/Packages/VBoxGuestAdditionsToolsAndServices.pkg</pkg-ref>
+ <pkg-ref id="org.virtualbox.pkg.additions.kexts" auth="Root">file:./Contents/Packages/VBoxGuestAdditionsKEXTs.pkg</pkg-ref>
+
+</installer-gui-script>