summaryrefslogtreecommitdiffstats
path: root/src/VBox/Installer/darwin
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/Installer/darwin
parentInitial commit. (diff)
downloadvirtualbox-f215e02bf85f68d3a6106c2a1f4f7f063f819064.tar.xz
virtualbox-f215e02bf85f68d3a6106c2a1f4f7f063f819064.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/Installer/darwin')
-rw-r--r--src/VBox/Installer/darwin/DiskImage/DS_Storebin0 -> 12292 bytes
-rwxr-xr-xsrc/VBox/Installer/darwin/DiskImage/VirtualBox_Uninstall.tool291
-rw-r--r--src/VBox/Installer/darwin/DiskImage/vbox_folder.tiffbin0 -> 469410 bytes
-rw-r--r--src/VBox/Installer/darwin/DiskImage/vbox_folder.xcfbin0 -> 177592 bytes
-rw-r--r--src/VBox/Installer/darwin/Makefile.kmk1069
-rw-r--r--src/VBox/Installer/darwin/VBoxKEXTs/PkgBuildComponent.plist29
-rwxr-xr-xsrc/VBox/Installer/darwin/VBoxKEXTs/VirtualBoxStartup.sh277
-rw-r--r--src/VBox/Installer/darwin/VBoxKEXTs/org.virtualbox.startup.plist17
-rwxr-xr-xsrc/VBox/Installer/darwin/VBoxKEXTs/postflight117
-rw-r--r--src/VBox/Installer/darwin/VirtualBox/PkgBuildComponent.plist17
-rwxr-xr-xsrc/VBox/Installer/darwin/VirtualBox/VBoxAutostartDarwin.sh71
-rw-r--r--src/VBox/Installer/darwin/VirtualBox/org.virtualbox.vboxautostart.plist19
-rw-r--r--src/VBox/Installer/darwin/VirtualBox/org.virtualbox.vboxballoonctrl.plist14
-rw-r--r--src/VBox/Installer/darwin/VirtualBox/org.virtualbox.vboxwebsrv.plist26
-rwxr-xr-xsrc/VBox/Installer/darwin/VirtualBox/postflight117
-rwxr-xr-xsrc/VBox/Installer/darwin/VirtualBox/preflight41
-rw-r--r--src/VBox/Installer/darwin/VirtualBox_mpkg/Conclusion.html7
-rw-r--r--src/VBox/Installer/darwin/VirtualBox_mpkg/Conclusion.rtf9
-rw-r--r--src/VBox/Installer/darwin/VirtualBox_mpkg/Localizable.strings23
-rw-r--r--src/VBox/Installer/darwin/VirtualBox_mpkg/Welcome.html12
-rw-r--r--src/VBox/Installer/darwin/VirtualBox_mpkg/Welcome.rtf13
-rw-r--r--src/VBox/Installer/darwin/VirtualBox_mpkg/background.tifbin0 -> 206064 bytes
-rw-r--r--src/VBox/Installer/darwin/VirtualBox_mpkg/distribution-driverless.dist107
-rw-r--r--src/VBox/Installer/darwin/VirtualBox_mpkg/distribution.dist117
24 files changed, 2393 insertions, 0 deletions
diff --git a/src/VBox/Installer/darwin/DiskImage/DS_Store b/src/VBox/Installer/darwin/DiskImage/DS_Store
new file mode 100644
index 00000000..ede41476
--- /dev/null
+++ b/src/VBox/Installer/darwin/DiskImage/DS_Store
Binary files differ
diff --git a/src/VBox/Installer/darwin/DiskImage/VirtualBox_Uninstall.tool b/src/VBox/Installer/darwin/DiskImage/VirtualBox_Uninstall.tool
new file mode 100755
index 00000000..92138142
--- /dev/null
+++ b/src/VBox/Installer/darwin/DiskImage/VirtualBox_Uninstall.tool
@@ -0,0 +1,291 @@
+#!/bin/bash
+# $Id: VirtualBox_Uninstall.tool $
+## @file
+# VirtualBox Uninstaller 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 uninstaller script."
+echo ""
+
+#
+# Check for arguments and display
+#
+my_default_prompt=0
+if test "$#" != "0"; then
+ if test "$#" != "1" -o "$1" != "--unattended"; then
+ echo "Error: Unknown argument(s): $*"
+ echo ""
+ echo "Usage: uninstall.sh [--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
+ my_default_prompt="Yes"
+fi
+
+#
+# Collect directories and files to remove.
+# Note: Do NOT attempt adding directories or filenames with spaces!
+#
+declare -a my_directories
+declare -a my_files
+
+# Users files first
+test -f "${HOME}/Library/LaunchAgents/org.virtualbox.vboxwebsrv.plist" && my_files+=("${HOME}/Library/LaunchAgents/org.virtualbox.vboxwebsrv.plist")
+
+test -d /Library/StartupItems/VirtualBox/ && my_directories+=("/Library/StartupItems/VirtualBox/")
+test -d /Library/Receipts/VBoxStartupItems.pkg/ && my_directories+=("/Library/Receipts/VBoxStartupItems.pkg/")
+
+test -d "/Library/Application Support/VirtualBox/LaunchDaemons/" && my_directories+=("/Library/Application Support/VirtualBox/LaunchDaemons/")
+test -d "/Library/Application Support/VirtualBox/VBoxDrv.kext/" && my_directories+=("/Library/Application Support/VirtualBox/VBoxDrv.kext/")
+test -d "/Library/Application Support/VirtualBox/VBoxUSB.kext/" && my_directories+=("/Library/Application Support/VirtualBox/VBoxUSB.kext/")
+test -d "/Library/Application Support/VirtualBox/VBoxNetFlt.kext/" && my_directories+=("/Library/Application Support/VirtualBox/VBoxNetFlt.kext/")
+test -d "/Library/Application Support/VirtualBox/VBoxNetAdp.kext/" && my_directories+=("/Library/Application Support/VirtualBox/VBoxNetAdp.kext/")
+# Pre 4.3.0rc1 locations:
+test -d /Library/Extensions/VBoxDrv.kext/ && my_directories+=("/Library/Extensions/VBoxDrv.kext/")
+test -d /Library/Extensions/VBoxUSB.kext/ && my_directories+=("/Library/Extensions/VBoxUSB.kext/")
+test -d /Library/Extensions/VBoxNetFlt.kext/ && my_directories+=("/Library/Extensions/VBoxNetFlt.kext/")
+test -d /Library/Extensions/VBoxNetAdp.kext/ && my_directories+=("/Library/Extensions/VBoxNetAdp.kext/")
+# Tiger support is obsolete, but we leave it here for a clean removing of older
+# VirtualBox versions
+test -d /Library/Extensions/VBoxDrvTiger.kext/ && my_directories+=("/Library/Extensions/VBoxDrvTiger.kext/")
+test -d /Library/Extensions/VBoxUSBTiger.kext/ && my_directories+=("/Library/Extensions/VBoxUSBTiger.kext/")
+test -d /Library/Receipts/VBoxKEXTs.pkg/ && my_directories+=("/Library/Receipts/VBoxKEXTs.pkg/")
+
+test -f /usr/bin/VirtualBox && my_files+=("/usr/bin/VirtualBox")
+test -f /usr/bin/VirtualBoxVM && my_files+=("/usr/bin/VirtualBoxVM")
+test -f /usr/bin/VBoxManage && my_files+=("/usr/bin/VBoxManage")
+test -f /usr/bin/VBoxVRDP && my_files+=("/usr/bin/VBoxVRDP")
+test -f /usr/bin/VBoxHeadless && my_files+=("/usr/bin/VBoxHeadless")
+test -f /usr/bin/vboxwebsrv && my_files+=("/usr/bin/vboxwebsrv")
+test -f /usr/bin/VBoxBugReport && my_files+=("/usr/bin/VBoxBugReport")
+test -f /usr/bin/VBoxBalloonCtrl && my_files+=("/usr/bin/VBoxBalloonCtrl")
+test -f /usr/bin/VBoxAutostart && my_files+=("/usr/bin/VBoxAutostart")
+test -f /usr/bin/VBoxDTrace && my_files+=("/usr/bin/VBoxDTrace")
+test -f /usr/bin/VBoxAudioTest && my_files+=("/usr/bin/VBoxAudioTest")
+test -f /usr/bin/vbox-img && my_files+=("/usr/bin/vbox-img")
+test -f /usr/local/bin/VirtualBox && my_files+=("/usr/local/bin/VirtualBox")
+test -f /usr/local/bin/VirtualBoxVM && my_files+=("/usr/local/bin/VirtualBoxVM")
+test -f /usr/local/bin/VBoxManage && my_files+=("/usr/local/bin/VBoxManage")
+test -f /usr/local/bin/VBoxVRDP && my_files+=("/usr/local/bin/VBoxVRDP")
+test -f /usr/local/bin/VBoxHeadless && my_files+=("/usr/local/bin/VBoxHeadless")
+test -f /usr/local/bin/vboxwebsrv && my_files+=("/usr/local/bin/vboxwebsrv")
+test -f /usr/local/bin/VBoxBugReport && my_files+=("/usr/local/bin/VBoxBugReport")
+test -f /usr/local/bin/VBoxBalloonCtrl && my_files+=("/usr/local/bin/VBoxBalloonCtrl")
+test -f /usr/local/bin/VBoxAutostart && my_files+=("/usr/local/bin/VBoxAutostart")
+test -f /usr/local/bin/VBoxDTrace && my_files+=("/usr/local/bin/VBoxDTrace")
+test -f /usr/local/bin/VBoxAudioTest && my_files+=("/usr/local/bin/VBoxAudioTest")
+test -f /usr/local/bin/vbox-img && my_files+=("/usr/local/bin/vbox-img")
+test -d /Library/Receipts/VirtualBoxCLI.pkg/ && my_directories+=("/Library/Receipts/VirtualBoxCLI.pkg/")
+test -f /Library/LaunchDaemons/org.virtualbox.startup.plist && my_files+=("/Library/LaunchDaemons/org.virtualbox.startup.plist")
+
+test -d /Applications/VirtualBox.app/ && my_directories+=("/Applications/VirtualBox.app/")
+test -d /Library/Receipts/VirtualBox.pkg/ && my_directories+=("/Library/Receipts/VirtualBox.pkg/")
+
+# legacy
+test -d /Library/Receipts/VBoxDrv.pkg/ && my_directories+=("/Library/Receipts/VBoxDrv.pkg/")
+test -d /Library/Receipts/VBoxUSB.pkg/ && my_directories+=("/Library/Receipts/VBoxUSB.pkg/")
+
+# python stuff
+python_versions="2.3 2.5 2.6 2.7"
+for p in $python_versions; do
+ test -f /Library/Python/$p/site-packages/vboxapi/VirtualBox_constants.py && my_files+=("/Library/Python/$p/site-packages/vboxapi/VirtualBox_constants.py")
+ test -f /Library/Python/$p/site-packages/vboxapi/VirtualBox_constants.pyc && my_files+=("/Library/Python/$p/site-packages/vboxapi/VirtualBox_constants.pyc")
+ test -f /Library/Python/$p/site-packages/vboxapi/__init__.py && my_files+=("/Library/Python/$p/site-packages/vboxapi/__init__.py")
+ test -f /Library/Python/$p/site-packages/vboxapi/__init__.pyc && my_files+=("/Library/Python/$p/site-packages/vboxapi/__init__.pyc")
+ test -f /Library/Python/$p/site-packages/vboxapi-1.0-py$p.egg-info && my_files+=("/Library/Python/$p/site-packages/vboxapi-1.0-py$p.egg-info")
+ test -d /Library/Python/$p/site-packages/vboxapi/ && my_directories+=("/Library/Python/$p/site-packages/vboxapi/")
+done
+
+#
+# Collect KEXTs to remove.
+# Note that the unload order is significant.
+#
+declare -a my_kexts
+for kext in org.virtualbox.kext.VBoxUSB org.virtualbox.kext.VBoxNetFlt org.virtualbox.kext.VBoxNetAdp org.virtualbox.kext.VBoxDrv; do
+ if /usr/sbin/kextstat -b $kext -l | grep -q $kext; then
+ my_kexts+=("$kext")
+ fi
+done
+
+#
+# Collect packages to forget
+#
+my_pb='org\.virtualbox\.pkg\.'
+my_pkgs=`/usr/sbin/pkgutil --pkgs="${my_pb}vboxkexts|${my_pb}vboxstartupitems|${my_pb}virtualbox|${my_pb}virtualboxcli"`
+
+#
+# Did we find anything to uninstall?
+#
+if test -z "${my_directories[*]}" -a -z "${my_files[*]}" -a -z "${my_kexts[*]}" -a -z "$my_pkgs"; then
+ echo "No VirtualBox files, directories, KEXTs or packages to uninstall."
+ echo "Done."
+ exit 0;
+fi
+
+#
+# Look for running VirtualBox processes and warn the user
+# if something is running. Since deleting the files of
+# running processes isn't fatal as such, we will leave it
+# to the user to choose whether to continue or not.
+#
+# Note! comm isn't supported on Tiger, so we make -c to do the stripping.
+#
+my_processes="`ps -axco 'pid uid command' | grep -wEe '(VirtualBox|VirtualBoxVM|VBoxManage|VBoxHeadless|vboxwebsrv|VBoxXPCOMIPCD|VBoxSVC|VBoxNetDHCP|VBoxNetNAT)' | grep -vw grep | grep -vw VirtualBox_Uninstall.tool | tr '\n' '\a'`";
+if test -n "$my_processes"; then
+ echo 'Warning! Found the following active VirtualBox processes:'
+ echo "$my_processes" | tr '\a' '\n'
+ echo ""
+ echo "We recommend that you quit all VirtualBox processes before"
+ echo "uninstalling the product."
+ echo ""
+ if test "$my_default_prompt" != "Yes"; then
+ echo "Do you wish to continue none the less (Yes/No)?"
+ read my_answer
+ if test "$my_answer" != "Yes" -a "$my_answer" != "YES" -a "$my_answer" != "yes"; then
+ echo "Aborting uninstall. (answer: '$my_answer')".
+ exit 2;
+ fi
+ echo ""
+ my_answer=""
+ fi
+fi
+
+#
+# Display the files and directories that will be removed
+# and get the user's consent before continuing.
+#
+if test -n "${my_files[*]}" -o -n "${my_directories[*]}"; then
+ echo "The following files and directories (bundles) will be removed:"
+ for file in "${my_files[@]}"; do echo " $file"; done
+ for dir in "${my_directories[@]}"; do echo " $dir"; done
+ echo ""
+fi
+if test -n "${my_kexts[*]}"; then
+ echo "And the following KEXTs will be unloaded:"
+ for kext in "${my_kexts[@]}"; do echo " $kext"; done
+ echo ""
+fi
+if test -n "$my_pkgs"; then
+ echo "And the traces of following packages will be removed:"
+ for kext in $my_pkgs; do echo " $kext"; done
+ echo ""
+fi
+
+if test "$my_default_prompt" != "Yes"; then
+ echo "Do you wish to uninstall VirtualBox (Yes/No)?"
+ read my_answer
+ if test "$my_answer" != "Yes" -a "$my_answer" != "YES" -a "$my_answer" != "yes"; then
+ echo "Aborting uninstall. (answer: '$my_answer')".
+ exit 2;
+ fi
+ echo ""
+fi
+
+my_fuse_macos_core_uninstall=0
+if test "$my_default_prompt" != "Yes" -a -f "/Library/Filesystems/osxfuse.fs/Contents/Resources/uninstall_osxfuse.app/Contents/Resources/Scripts/uninstall_osxfuse.sh"; then
+ echo "VirtualBox detected the FUSE for macOS core package which might've been installed"
+ echo "by VirtualBox itself for the vboximg-mount utility. Do you wish to uninstall"
+ echo "the FUSE for macOS core package (Yes/No)?"
+ read my_answer
+ if test "$my_answer" == "Yes" -o "$my_answer" == "YES" -o "$my_answer" == "yes"; then
+ my_fuse_macos_core_uninstall=1;
+ fi
+ echo ""
+fi
+
+#
+# Unregister has to be done before the files are removed.
+#
+LSREGISTER=/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister
+if [ -e ${LSREGISTER} ]; then
+ ${LSREGISTER} -u /Applications/VirtualBox.app > /dev/null
+ ${LSREGISTER} -u /Applications/VirtualBox.app/Contents/Resources/vmstarter.app > /dev/null
+fi
+
+#
+# Display the sudo usage instructions and execute the command.
+#
+echo "The uninstallation processes requires administrative privileges"
+echo "because some of the installed files cannot be removed by a normal"
+echo "user. You may be prompted for your password now..."
+echo ""
+
+if test -n "${my_files[*]}" -o -n "${my_directories[*]}"; then
+ /usr/bin/sudo -p "Please enter %u's password:" /bin/rm -Rf "${my_files[@]}" "${my_directories[@]}"
+ my_rc=$?
+ if test "$my_rc" -ne 0; then
+ echo "An error occurred durning 'sudo rm', there should be a message above. (rc=$my_rc)"
+ test -x /usr/bin/sudo || echo "warning: Cannot find /usr/bin/sudo or it's not an executable."
+ test -x /bin/rm || echo "warning: Cannot find /bin/rm or it's not an executable"
+ echo ""
+ echo "The uninstall failed. Please retry."
+ test "$my_default_prompt" != "Yes" && read -p "Press <ENTER> to exit"
+ exit 1;
+ fi
+fi
+
+if test "$my_fuse_macos_core_uninstall" != 0; then
+ echo "Uninstalling the FUSE for macOS core package"
+ /usr/bin/sudo -p "Please enter %u's password:" /Library/Filesystems/osxfuse.fs/Contents/Resources/uninstall_osxfuse.app/Contents/Resources/Scripts/uninstall_osxfuse.sh
+fi
+
+my_rc=0
+for kext in "${my_kexts[@]}"; do
+ echo unloading $kext
+ /usr/bin/sudo -p "Please enter %u's password (unloading $kext):" /sbin/kextunload -m $kext
+ my_rc2=$?
+ if test "$my_rc2" -ne 0; then
+ echo "An error occurred durning 'sudo /sbin/kextunload -m $kext', there should be a message above. (rc=$my_rc2)"
+ test -x /usr/bin/sudo || echo "warning: Cannot find /usr/bin/sudo or it's not an executable."
+ test -x /sbin/kextunload || echo "warning: Cannot find /sbin/kextunload or it's not an executable"
+ my_rc=$my_rc2
+ fi
+done
+if test "$my_rc" -eq 0; then
+ echo "Successfully unloaded VirtualBox kernel extensions."
+else
+ echo "Failed to unload one or more KEXTs, please reboot the machine to complete the uninstall."
+ test "$my_default_prompt" != "Yes" && read -p "Press <ENTER> to exit"
+ exit 1;
+fi
+
+# Cleaning up pkgutil database
+for my_pkg in $my_pkgs; do
+ /usr/bin/sudo -p "Please enter %u's password (removing $my_pkg):" /usr/sbin/pkgutil --forget "$my_pkg"
+done
+
+echo "Done."
+exit 0;
+
diff --git a/src/VBox/Installer/darwin/DiskImage/vbox_folder.tiff b/src/VBox/Installer/darwin/DiskImage/vbox_folder.tiff
new file mode 100644
index 00000000..8b273e47
--- /dev/null
+++ b/src/VBox/Installer/darwin/DiskImage/vbox_folder.tiff
Binary files differ
diff --git a/src/VBox/Installer/darwin/DiskImage/vbox_folder.xcf b/src/VBox/Installer/darwin/DiskImage/vbox_folder.xcf
new file mode 100644
index 00000000..2497e15e
--- /dev/null
+++ b/src/VBox/Installer/darwin/DiskImage/vbox_folder.xcf
Binary files differ
diff --git a/src/VBox/Installer/darwin/Makefile.kmk b/src/VBox/Installer/darwin/Makefile.kmk
new file mode 100644
index 00000000..494fd990
--- /dev/null
+++ b/src/VBox/Installer/darwin/Makefile.kmk
@@ -0,0 +1,1069 @@
+# $Id: Makefile.kmk $
+## @file
+# Install misc stuff and create dist packages for Mac OS X.
+#
+
+#
+# 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_PATH_DI_SRC := $(PATH_SUB_CURRENT)
+VBOX_DI_OUT_DIR := $(PATH_TARGET)/Installer/darwin
+BLDDIRS += $(VBOX_DI_OUT_DIR)
+
+VBOX_DI_FN_DEP_BOTH = $(VBOX_PATH_DIST)/$1
+ifeq ($(KBUILD_TARGET_ARCH),x86)
+ VBOX_DI_FN_DEP_32 = $(VBOX_PATH_DIST)/$1
+ VBOX_DI_FN_DEP_64 =
+else
+ VBOX_DI_FN_DEP_64 = $(VBOX_PATH_DIST)/$1
+ VBOX_DI_FN_DEP_32 =
+endif
+VBOX_PATH_DIST_OTHER = $(error VBOX_PATH_DIST_OTHER used in a non-combined package deal)
+
+ifdef VBOX_WITH_QT6
+ VBOX_QT_VERSION_MAJOR = A
+else
+ VBOX_QT_VERSION_MAJOR = 5
+endif
+
+ifeq ($(KBUILD_TARGET_ARCH),arm64)
+ VBOX_DI_TARGET_ARCH = arm64
+ VBOX_DI_ARCH_LIST = arm64
+else # Assume amd64 for now
+ VBOX_DI_TARGET_ARCH = x86_64
+ VBOX_DI_ARCH_LIST = i386,arm64
+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_DI_OUT_DIR)
+endif
+
+# Shorthand for $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app
+VBOX_PATH_VBOX_APP_TMP := $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app
+
+
+#
+# Install the darwin docs/license.
+#
+INSTALLS += darwin-docs
+darwin-docs_INST = $(INST_DIST)
+darwin-docs_MODE = a+r,u+w
+darwin-docs_SOURCES = \
+ $(VBOX_BRAND_LICENSE_TXT)=>LICENSE
+
+
+#
+# The packing.
+#
+PACKING += $(VBOX_PATH_DIST)/VirtualBox-$(VBOX_VERSION_STRING)-r$(VBOX_SVN_REV).dmg
+#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
+
+
+# Check for additional manuals
+VBOX_ADD_MANUALS := $(foreach f,$(VBOX_MANUAL_ADD_LANGUAGES),$(VBOX_PATH_DIST)/VirtualBox.app/Contents/MacOS/UserManual_$(f).pdf)
+
+VBOX_ADD_MANUAL_de_DE := $(filter $(VBOX_PATH_DIST)/VirtualBox.app/Contents/MacOS/UserManual_de_DE.pdf,$(VBOX_ADD_MANUALS))
+VBOX_ADD_MANUAL_fr_FR := $(filter $(VBOX_PATH_DIST)/VirtualBox.app/Contents/MacOS/UserManual_fr_FR.pdf,$(VBOX_ADD_MANUALS))
+
+#
+# The disk image.
+#
+$(VBOX_PATH_DIST)/VirtualBox-$(VBOX_VERSION_STRING)-r$(VBOX_SVN_REV).dmg: \
+ $(VBOX_PATH_PACK_TMP)/DiskImage/VirtualBox.pkg \
+ $(VBOX_BRAND_DARWIN_DISKIMAGE_BG) \
+ $(VBOX_BRAND_DARWIN_DISKIMAGE_DS_STORE) \
+ $$(wildcard $(VBOX_PATH_DI_SRC)/DiskImage/*) \
+ $(if $(VBOX_WITH_DOCS_PACKING), \
+ $(VBOX_PATH_DIST)/VirtualBox.app/Contents/MacOS/UserManual.pdf \
+ $(VBOX_ADD_MANUALS)) \
+ $(VBOX_DARWIN_INST_DEP_ON_MAKEFILE)
+ $(call MSG_TOOL,hdiutil,,,$@)
+ @# Cleanup any previously failed attempts and various trash.
+ sudo rm -Rf $(VBOX_PATH_PACK_TMP)/DiskImage.tmp
+ $(MKDIR) -p $(VBOX_PATH_PACK_TMP)/DiskImage.tmp/
+ sudo mv $(VBOX_PATH_PACK_TMP)/DiskImage/VirtualBox.pkg $(VBOX_PATH_PACK_TMP)/DiskImage.tmp/
+ sudo rm -Rf \
+ $@ \
+ $(VBOX_PATH_PACK_TMP)/DiskImage/
+ sudo mv $(VBOX_PATH_PACK_TMP)/DiskImage.tmp $(VBOX_PATH_PACK_TMP)/DiskImage
+ @# Remove .dmg packages from old depend builds
+ $(QUIET)$(RM) -f $(wildcard $(VBOX_PATH_DIST)/VirtualBox-*-r*.dmg)
+ @# Populate the image with uninstaller, readme, picture, and .VolumeIcon.icns. (TODO)
+ $(INSTALL) $(VBOX_PATH_DI_SRC)/DiskImage/VirtualBox_Uninstall.tool $(VBOX_PATH_PACK_TMP)/DiskImage/
+ifdef VBOX_SIGNING_MODE
+ $(call VBOX_SIGN_FILE_FN,$(VBOX_PATH_PACK_TMP)/DiskImage/VirtualBox_Uninstall.tool,org.virtualbox.dmg.uninstaller)
+ @# Code signing (the non-local one) seems to be losing the execute permission.
+ chmod 0755 $(VBOX_PATH_PACK_TMP)/DiskImage/VirtualBox_Uninstall.tool
+endif
+ifeq (1,1)
+ @# Pedantic mode...
+ $(INSTALL) -m 644 $(VBOX_BRAND_DARWIN_DISKIMAGE_DS_STORE) $(VBOX_PATH_PACK_TMP)/DiskImage/.DS_Store
+ $(MKDIR) $(VBOX_PATH_PACK_TMP)/DiskImage/.background
+ $(INSTALL) -m 644 $(VBOX_BRAND_DARWIN_DISKIMAGE_BG) $(VBOX_PATH_PACK_TMP)/DiskImage/.background/vbox_folder.tiff
+ ifdef VBOX_WITH_BUNDLED_INSTALLER
+ $(if $(VBOX_WITH_DOCS_PACKING), \
+ $(INSTALL) -m 644 $(VBOX_PATH_DIST)/VirtualBox.app/Contents/MacOS/UserManual.pdf $(VBOX_PATH_PACK_TMP)/DiskImage/User\ Manual.pdf$(NLTAB) \
+ $(if $(VBOX_ADD_MANUAL_de_DE),$(INSTALL) -m 644 $(VBOX_ADD_MANUAL_de_DE) "$(VBOX_PATH_PACK_TMP)/DiskImage/$(VBOX_BRAND_de_DE_MANUAL_NAME).pdf"$(NLTAB)) \
+ $(if $(VBOX_ADD_MANUAL_fr_FR),$(INSTALL) -m 644 $(VBOX_ADD_MANUAL_fr_FR) "$(VBOX_PATH_PACK_TMP)/DiskImage/$(VBOX_BRAND_fr_FR_MANUAL_NAME).pdf"$(NLTAB)))
+ # Rename the main package
+ else
+ $(if $(VBOX_WITH_DOCS_PACKING), $(INSTALL) $(VBOX_PATH_DIST)/VirtualBox.app/Contents/MacOS/UserManual.pdf $(VBOX_PATH_PACK_TMP)/DiskImage/)
+ $(LN) -s /Applications/ $(VBOX_PATH_PACK_TMP)/DiskImage/Applications
+ endif
+endif
+ @# hdiutil of OS X 10.10 adds a .Trashes directory and some suggest this may upset the image size calculations (-5341).
+ $(MKDIR) -m 1333 $(VBOX_PATH_PACK_TMP)/DiskImage/.Trashes
+ @# Change the owners.
+ sudo chown -R root:admin $(VBOX_PATH_PACK_TMP)/DiskImage
+ @# Create the image. We calculate the size our selves, adding 32MB (was 16MB) for fudging (min 13MB fudge needed on high sierra).
+ sudo hdiutil create -format UDBZ -volname "VirtualBox" -srcfolder "$(VBOX_PATH_PACK_TMP)/DiskImage" \
+ -size $(DOLLAR)((`sudo /usr/bin/du -sk "$(VBOX_PATH_PACK_TMP)/DiskImage/" | /usr/bin/cut -f1` + 32768))k \
+ "$@"
+ @# Change (back) the owner so it can be deleted by the user.
+ sudo chown "$(shell whoami)" "$@"
+ sudo chown -R "$(shell whoami)" $(VBOX_PATH_PACK_TMP)/DiskImage
+ifdef VBOX_SIGNING_MODE
+ ifndef VBOX_WITHOUT_SIGNED_DMG
+ @# Sign the created dmg.
+ $(call VBOX_SIGN_DMG_FN,$@,org.virtualbox.dmg)
+ if $(intersects darwin darwin_notarize all 1,$(VBOX_WITH_CORP_CODE_SIGNING))
+ @# Notarize the signed dmg (includes stapling).
+ $(call VBOX_NOTARIZE_FILE_FN,$@,org.virtualbox.VirtualBox.$(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD).$(VBOX_SVN_REV))
+ endif
+ endif
+endif
+
+#
+# The meta-package.
+#
+$(VBOX_PATH_PACK_TMP)/DiskImage/VirtualBox.pkg: \
+ $(if $(VBOX_WITH_VBOXDRV), $(VBOX_PATH_PACK_TMP)/Packages/VBoxKEXTs.pkg) \
+ $(VBOX_PATH_PACK_TMP)/Packages/VirtualBoxCLI.pkg \
+ $(VBOX_PATH_PACK_TMP)/Packages/VirtualBox.pkg \
+ $$(wildcard \
+ $(VBOX_PATH_DI_SRC)/VirtualBox_mpkg/* \
+ $(VBOX_PATH_DI_SRC)/VirtualBox_mpkg/*.lproj/*) \
+ $(foreach f,$(VBOX_INSTALLER_ADD_LANGUAGES), $(VBOX_BRAND_$(f)_VIRTUALBOX_WELCOME_RTF)) \
+ $(if $(VBOX_WITH_FUSE_PACKING), $(VBOX_PATH_PACK_TMP)/Packages/OSXFuseCore.pkg) \
+ $(VBOX_DARWIN_INST_DEP_ON_MAKEFILE)
+ $(call MSG_TOOL,productbuild,,,$@)
+ @# Cleanup any previously failed attempts.
+ sudo rm -Rf \
+ $@ \
+ $(VBOX_PATH_PACK_TMP)/VirtualBox.dist.root \
+ $(VBOX_PATH_PACK_TMP)/VirtualBox.dist.desc \
+ $(VBOX_PATH_PACK_TMP)/VirtualBox.dist.res
+ @# Correct directory permissions are important.
+ $(MKDIR) -p \
+ $(@D) \
+ $(VBOX_PATH_PACK_TMP)/VirtualBox.dist.desc \
+ $(VBOX_PATH_PACK_TMP)/VirtualBox.dist.res \
+ $(VBOX_PATH_PACK_TMP)/VirtualBox.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)/VirtualBox.dist.res/English.lproj/Welcome.rtf \
+ $(VBOX_PATH_DI_SRC)/VirtualBox_mpkg/Welcome.rtf
+ @# Do keyword replacement in the distribution script.
+ $(SED) \
+ -e 's+@VBOX_TARGET_ARCH@+$(VBOX_DI_TARGET_ARCH)+g' \
+ -e 's+@VBOX_ARCH_LIST@+$(VBOX_DI_ARCH_LIST)+g' \
+ --output $(VBOX_PATH_PACK_TMP)/distribution.dist \
+ $(if $(VBOX_WITH_VBOXDRV), $(VBOX_PATH_DI_SRC)/VirtualBox_mpkg/distribution.dist, $(VBOX_PATH_DI_SRC)/VirtualBox_mpkg/distribution-driverless.dist)
+ @# Copy the resources.
+ $(INSTALL) -m 0644 $(VBOX_PATH_DI_SRC)/VirtualBox_mpkg/Conclusion.rtf $(VBOX_PATH_PACK_TMP)/VirtualBox.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)/VirtualBox.dist.res/English.lproj/Localizable.strings \
+ $(VBOX_PATH_DI_SRC)/VirtualBox_mpkg/Localizable.strings
+ $(INSTALL) -m 0644 $(VBOX_BRAND_DARWIN_INSTALLER_BG) $(VBOX_PATH_PACK_TMP)/VirtualBox.dist.res/background.tif
+ $(foreach f,$(VBOX_INSTALLER_ADD_LANGUAGES), \
+ $(MKDIR) -p \
+ $(VBOX_PATH_PACK_TMP)/VirtualBox.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)/VirtualBox.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)/VirtualBox.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)/VirtualBox.dist.res/$(VBOX_INSTALLER_$(f)_DARWIN_TARGET).lproj/Localizable.strings \
+ $(VBOX_BRAND_$(f)_VIRTUALBOX_LOCALIZABLE_STRINGS)$(NLTAB) \
+ )
+ @# Build the package.
+ $(VBOX_PRODUCTBUILD) \
+ --distribution $(VBOX_PATH_PACK_TMP)/distribution.dist \
+ --package-path $(VBOX_PATH_PACK_TMP)/Packages \
+ --resources $(VBOX_PATH_PACK_TMP)/VirtualBox.dist.res \
+ --identifier org.VirtualBox.mpkg.virtualbox \
+ --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.virtualbox)
+ endif
+endif
+ @# Cleanup.
+ sudo rm -Rf \
+ $(VBOX_PATH_PACK_TMP)/VirtualBox.dist.root \
+ $(VBOX_PATH_PACK_TMP)/VirtualBox.dist.desc \
+ $(VBOX_PATH_PACK_TMP)/VirtualBox.dist.res
+
+
+ifdef VBOX_WITH_VBOXDRV
+ #
+ # The VirtualBox Kernel extensions.
+ #
+ VBOX_DI_KEXTS_UNIVERSAL = VBoxDrv VBoxNetFlt VBoxNetAdp
+ VBOX_DI_KEXTS = $(VBOX_DI_KEXTS_UNIVERSAL)
+
+ $(VBOX_PATH_PACK_TMP)/Packages/VBoxKEXTs.pkg: \
+ $(foreach kext,$(VBOX_DI_KEXTS_UNIVERSAL), $(call VBOX_DI_FN_DEP_BOTH,$(kext).kext/Contents/MacOS/$(kext))) \
+ $(foreach kext,$(VBOX_DI_KEXTS), $(VBOX_PATH_DIST)/$(kext).kext/Contents/Info.plist) \
+ $$(wildcard \
+ $(VBOX_PATH_DI_SRC)/VBoxKEXTs/* \
+ $(VBOX_PATH_DI_SRC)/VBoxKEXTs/*.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_DARWIN_INST_DEP_ON_MAKEFILE)
+ $(call MSG_TOOL,pkgbuild,,,$@)
+ @# Cleanup any previously failed attempts.
+ sudo rm -Rf \
+ $@ \
+ $(VBOX_PATH_PACK_TMP)/VBoxKEXTs.pkg.root \
+ $(VBOX_PATH_PACK_TMP)/VBoxKEXTs.pkg.desc \
+ $(VBOX_PATH_PACK_TMP)/VBoxKEXTs.pkg.res
+ @# Correct directory permissions are important.
+ $(MKDIR) -p \
+ $(@D) \
+ $(VBOX_PATH_PACK_TMP)/VBoxKEXTs.pkg.desc \
+ $(VBOX_PATH_PACK_TMP)/VBoxKEXTs.pkg.res \
+ $(VBOX_PATH_PACK_TMP)/VBoxKEXTs.pkg.res/English.lproj
+ $(MKDIR) -p -m 0755 \
+ $(VBOX_PATH_PACK_TMP)/VBoxKEXTs.pkg.root \
+ $(VBOX_PATH_PACK_TMP)/VBoxKEXTs.pkg.root/LaunchDaemons \
+ $(foreach kext,$(VBOX_DI_KEXTS), \
+ $(VBOX_PATH_PACK_TMP)/VBoxKEXTs.pkg.root/$(kext).kext \
+ $(VBOX_PATH_PACK_TMP)/VBoxKEXTs.pkg.root/$(kext).kext/Contents \
+ $(VBOX_PATH_PACK_TMP)/VBoxKEXTs.pkg.root/$(kext).kext/Contents/MacOS )
+ @# Copy the launch daemon bits.
+ $(INSTALL) -m 0755 $(VBOX_PATH_DI_SRC)/VBoxKEXTs/VirtualBoxStartup.sh $(VBOX_PATH_PACK_TMP)/VBoxKEXTs.pkg.root/LaunchDaemons/
+ $(INSTALL) -m 0644 $(VBOX_PATH_DI_SRC)/VBoxKEXTs/org.virtualbox.startup.plist $(VBOX_PATH_PACK_TMP)/VBoxKEXTs.pkg.root/LaunchDaemons/
+ @# Copy the common files (Info.plist).
+ $(foreach kext,$(VBOX_DI_KEXTS), \
+ $(NLTAB)$(INSTALL) -m 0644 $(VBOX_PATH_DIST)/$(kext).kext/Contents/Info.plist $(VBOX_PATH_PACK_TMP)/VBoxKEXTs.pkg.root/$(kext).kext/Contents/)
+ @# Copy the binaries and invoking lipo.
+ $(foreach kext,$(VBOX_DI_KEXTS), \
+ $(NLTAB)$(INSTALL) -m 0755 $(VBOX_PATH_DIST)/$(kext).kext/Contents/MacOS/$(kext) $(VBOX_PATH_PACK_TMP)/VBoxKEXTs.pkg.root/$(kext).kext/Contents/MacOS/)
+ @# Sign the kext bundles.
+ ifdef VBOX_SIGNING_MODE
+ $(foreach kext,$(VBOX_DI_KEXTS) \
+ ,$(NLTAB)$(call VBOX_SIGN_MACHO_FN,$(VBOX_PATH_PACK_TMP)/VBoxKEXTs.pkg.root/$(kext).kext/Contents/MacOS/$(kext),org.virtualbox.app.kext.$(kext)) )
+ $(foreach kext,$(VBOX_DI_KEXTS) \
+ ,$(NLTAB)$(call VBOX_SIGN_BUNDLE_FN,$(VBOX_PATH_PACK_TMP)/VBoxKEXTs.pkg.root/$(kext).kext,org.virtualbox.app.kext.$(kext)) \
+ $(NLTAB)chmod a+r $(VBOX_PATH_PACK_TMP)/VBoxKEXTs.pkg.root/$(kext).kext/Contents/_CodeSignature/* )
+ ## @TODO check why this fails on the build box: $(foreach kext,$(VBOX_DI_KEXTS), $(NLTAB)codesign --verify --verbose=1 $(VBOX_PATH_PACK_TMP)/VBoxKEXTs.pkg.root/$(kext).kext )
+ endif
+ @# Set the correct owners.
+ sudo chown -R root:wheel $(VBOX_PATH_PACK_TMP)/VBoxKEXTs.pkg.root/
+ @# 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)/VBoxKEXTs.pkg.desc/PkgBuildComponent.plist \
+ $(VBOX_PATH_DI_SRC)/VBoxKEXTs/PkgBuildComponent.plist
+ @# Copy the resources.
+ $(INSTALL) -m 0755 $(VBOX_PATH_DI_SRC)/VBoxKEXTs/postflight $(VBOX_PATH_PACK_TMP)/VBoxKEXTs.pkg.res/
+ @# Build the package.
+ $(VBOX_PKGBUILD) \
+ --root $(VBOX_PATH_PACK_TMP)/VBoxKEXTs.pkg.root/ \
+ --component-plist $(VBOX_PATH_PACK_TMP)/VBoxKEXTs.pkg.desc/PkgBuildComponent.plist \
+ --script $(VBOX_PATH_PACK_TMP)/VBoxKEXTs.pkg.res \
+ --identifier org.virtualbox.pkg.vboxkexts \
+ --version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
+ --install-location "/Library/Application Support/VirtualBox" \
+ --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.vboxkexts)
+ endif
+ endif
+ @# Cleanup
+ sudo chown -R "$(shell whoami)" \
+ $(VBOX_PATH_PACK_TMP)/VBoxKEXTs.pkg.root
+ sudo rm -Rf \
+ $(VBOX_PATH_PACK_TMP)/VBoxKEXTs.pkg.root \
+ $(VBOX_PATH_PACK_TMP)/VBoxKEXTs.pkg.desc \
+ $(VBOX_PATH_PACK_TMP)/VBoxKEXTs.pkg.res
+endif # !VBOX_WITH_VBOXDRV
+
+
+#
+# Figure out which languages that we support and construct
+# .qm and .lproj lists for these.
+#
+include $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/nls/ApprovedLanguages.kmk
+ifdef VBOX_WITH_QTGUI
+ VBOX_INSTALL_LANG_FILES := $(foreach f,$(VBOX_APPROVED_GUI_LANGUAGES), VirtualBox_$(f).qm qt_$(f).qm)
+else
+ VBOX_INSTALL_LANG_FILES :=
+endif
+VBOX_INSTALL_LANG_LPROJ := $(addsuffix .lproj,$(VBOX_APPROVED_GUI_LANGUAGES))
+
+
+#
+# The VirtualBox Application.
+#
+
+VBOX_DI_VBAPP_PROGS_HARDENED = \
+ MacOS/VBoxHeadless \
+ MacOS/VBoxNetDHCP \
+ MacOS/VBoxNetNAT \
+ MacOS/VBoxVMMPreload
+ifdef VBOX_WITH_QTGUI
+ VBOX_DI_VBAPP_PROGS_HARDENED += \
+ Resources/VirtualBoxVM.app/Contents/MacOS/VirtualBoxVM
+endif
+
+VBOX_DI_VBAPP_PROGS = \
+ MacOS/VBoxManage \
+ MacOS/VBoxSVC \
+ MacOS/VBoxXPCOMIPCD \
+ MacOS/VBoxNetAdpCtl \
+ MacOS/VBoxExtPackHelperApp \
+ MacOS/VBoxBugReport \
+ MacOS/VBoxBalloonCtrl \
+ MacOS/VBoxAutostart \
+ $(if $(VBOX_WITH_WEBSERVICES),MacOS/vboxwebsrv) \
+ $(if $(VBOX_WITH_DTRACE),MacOS/VBoxDTrace,) \
+ $(if $(VBOX_WITH_HOST_SHIPPING_AUDIO_TEST),MacOS/VBoxAudioTest,)
+ifdef VBOX_WITH_QTGUI
+ VBOX_DI_VBAPP_PROGS += \
+ MacOS/VirtualBox
+endif
+
+VBOX_DI_VBAPP_DYLIBS = \
+ MacOS/VBoxDD.dylib \
+ MacOS/VBoxDD2.dylib \
+ MacOS/VBoxDDU.dylib \
+ MacOS/VBoxRT.dylib \
+ $(if $(VBOX_WITH_LIBSSH),MacOS/VBoxLibSsh.dylib,) \
+ $(if $(VBOX_WITH_SHARED_FOLDERS),MacOS/VBoxSharedFolders.dylib,) \
+ $(if $(VBOX_WITH_SHARED_CLIPBOARD),MacOS/VBoxSharedClipboard.dylib,) \
+ $(if $(VBOX_WITH_DRAG_AND_DROP),MacOS/VBoxDragAndDropSvc.dylib,) \
+ $(if $(VBOX_WITH_GUEST_PROPS),MacOS/VBoxGuestPropSvc.dylib,) \
+ MacOS/VBoxHostChannel.dylib \
+ MacOS/VBoxVMM.dylib \
+ MacOS/VBoxXPCOM.dylib \
+ MacOS/VBoxXPCOMC.dylib \
+ MacOS/components/VBoxC.dylib \
+ MacOS/components/VBoxSVCM.dylib \
+ MacOS/components/VBoxXPCOMIPCC.dylib \
+ MacOS/VBoxAuth.dylib \
+ MacOS/VBoxAuthSimple.dylib \
+ $(if $(VBOX_WITH_GUEST_CONTROL),MacOS/VBoxGuestControlSvc.dylib,)
+ifdef VBOX_WITH_QTGUI
+ VBOX_DI_VBAPP_DYLIBS += \
+ MacOS/UICommon.dylib
+ ifneq ($(wildcard $(VBOX_PATH_DIST)/VirtualBox.app/Contents/MacOS/accessible/libqtaccessiblewidgets.dylib),)
+ VBOX_DI_VBAPP_DYLIBS += \
+ MacOS/accessible/libqtaccessiblewidgets.dylib
+ endif
+endif
+if defined(VBOX_WITH_VRDP) && !defined(VBOX_WITH_EXTPACK_PUEL)
+ VBOX_DI_VBAPP_DYLIBS += \
+ MacOS/VBoxVRDP.dylib
+endif
+ifdef VBOX_WITH_DEBUGGER
+ VBOX_DI_VBAPP_DYLIBS += \
+ MacOS/DbgPlugInDiggers.dylib
+ if defined(VBOX_WITH_QTGUI) && defined(VBOX_WITH_DEBUGGER_GUI)
+ VBOX_DI_VBAPP_DYLIBS += \
+ MacOS/VBoxDbg.dylib
+ endif
+endif
+ifdef VBOX_WITH_HARDENING
+ VBOX_DI_VBAPP_DYLIBS += $(addprefix MacOS/,$(addsuffix .dylib,$(notdir $(VBOX_DI_VBAPP_PROGS_HARDENED))))
+endif
+ifdef VBOX_WITH_HDDPARALLELS_INSTALL
+ VBOX_DI_VBAPP_DYLIBS += \
+ MacOS/VBoxHDDParallels.dylib
+endif
+if defined(VBOX_WITH_PYTHON) && !defined(VBOX_WITHOUT_VBOXPYTHON_FOR_OSX_10_6) && "$(VBOX_DEF_MACOSX_VERSION_MIN)" vlt "10.13"
+ VBOX_DI_VBAPP_DYLIBS += \
+ MacOS/VBoxPython2_6.so
+endif
+if defined(VBOX_WITH_PYTHON) && !defined(VBOX_WITHOUT_VBOXPYTHON_FOR_OSX_10_7)
+ VBOX_DI_VBAPP_DYLIBS += \
+ MacOS/VBoxPython2_7.so
+endif
+ifdef VBOX_WITH_VMSVGA3D
+ VBOX_DI_VBAPP_DYLIBS += \
+ MacOS/VBoxSVGA3D.dylib \
+ MacOS/VBoxSVGA3DObjC.dylib
+endif
+
+ifdef VBOX_WITH_PYTHON
+ VBOX_DI_VBAPP_DYLIBS.x86 += \
+ MacOS/VBoxPython2_5.so \
+ $(if-expr defined(VBOX_WITH_MAC_OS_X_10_4_SUPPORT),MacOS/VBoxPython2_3.so,)
+endif
+
+VBOX_DI_VBAPP_DYLIBS.amd64 :=
+if defined(VBOX_WITH_PYTHON) && defined(VBOX_WITHOUT_VBOXPYTHON_FOR_OSX_10_6) && "$(VBOX_DEF_MACOSX_VERSION_MIN)" vlt "10.13"
+ VBOX_DI_VBAPP_DYLIBS.amd64 += \
+ MacOS/VBoxPython2_6.so
+endif
+
+if defined(VBOX_WITH_JXPCOM)
+ VBOX_DI_VBAPP_DYLIBS += \
+ MacOS/libvboxjxpcom.jnilib
+endif
+
+if1of ($(VBOX_DI_VBAPP_DYLIBS.amd64), $(VBOX_DI_VBAPP_DYLIBS.x86))
+ $(error Conflict.$(NLTAB)VBOX_DI_VBAPP_DYLIBS.amd64=$(VBOX_DI_VBAPP_DYLIBS.amd64)$(NLTAB)VBOX_DI_VBAPP_DYLIBS.x86 =$(VBOX_DI_VBAPP_DYLIBS.x86))
+endif
+if1of ($(VBOX_DI_VBAPP_DYLIBS.amd64) $(VBOX_DI_VBAPP_DYLIBS.x86), $(VBOX_DI_VBAPP_DYLIBS))
+ $(error Conflict.$(NLTAB)VBOX_DI_VBAPP_DYLIBS.amd64=$(VBOX_DI_VBAPP_DYLIBS.amd64)$(NLTAB)VBOX_DI_VBAPP_DYLIBS.x86 =$(VBOX_DI_VBAPP_DYLIBS.x86)$(NLTAB)VBOX_DI_VBAPP_DYLIBS=$(VBOX_DI_VBAPP_DYLIBS))
+endif
+
+VBOX_DI_VBAPP_UNIVERSAL_PROGS = \
+ $(if $(VBOX_WITH_VBOX_IMG)$(VBOX_WITH_TESTCASES),MacOS/vbox-img,) \
+ $(if $(VBOX_WITH_VBOXIMGMOUNT),MacOS/vboximg-mount,)
+ifdef VBOX_WITH_QTGUI
+ VBOX_DI_VBAPP_UNIVERSAL_PROGS += \
+ MacOS/vmstarter
+endif
+
+ifdef VBOX_WITH_R0_MODULES
+ VBOX_DI_VBAPP_OTHER_UNIVERSAL_BINS = \
+ MacOS/VMMR0.r0 \
+ MacOS/VBoxDDR0.r0
+else
+ VBOX_DI_VBAPP_OTHER_UNIVERSAL_BINS =
+endif
+
+ifdef VBOX_WITH_RAW_MODE
+ VBOX_DI_VBAPP_OTHER_BINS = \
+ MacOS/VMMRC.rc \
+ MacOS/VBoxDDRC.rc
+else
+ VBOX_DI_VBAPP_OTHER_BINS =
+endif
+
+VBOX_DI_VBAPP_DUPLICATED_RESOURCE_FILES = \
+ Resources/virtualbox.icns \
+ Resources/virtualbox.png \
+ Resources/virtualbox-vbox.icns \
+ Resources/virtualbox-vbox-extpack.icns \
+ Resources/virtualbox-ovf.icns \
+ Resources/virtualbox-ova.icns \
+ Resources/virtualbox-vdi.icns \
+ Resources/virtualbox-vmdk.icns \
+ Resources/virtualbox-vhd.icns \
+ Resources/virtualbox-hdd.icns
+
+VBOX_DI_VBAPP_MISC_FILES = \
+ MacOS/components/VBoxXPCOMBase.xpt \
+ MacOS/components/VirtualBox_XPCOM.xpt
+ifdef VBOX_WITH_QTGUI # Yeah, the output w/o the qt gui is a bit useless. But we just want it building now.
+ VBOX_DI_VBAPP_MISC_FILES += \
+ Info.plist \
+ PkgInfo \
+ $(VBOX_DI_VBAPP_DUPLICATED_RESOURCE_FILES) \
+ Resources/VirtualBoxVM.app/Contents/Info.plist \
+ Resources/VirtualBoxVM.app/Contents/PkgInfo \
+ $(addprefix Resources/VirtualBoxVM.app/Contents/,$(VBOX_DI_VBAPP_DUPLICATED_RESOURCE_FILES)) \
+ Resources/vmstarter.app/Contents/Info.plist \
+ Resources/vmstarter.app/Contents/PkgInfo \
+ $(addprefix Resources/vmstarter.app/Contents/,$(VBOX_DI_VBAPP_DUPLICATED_RESOURCE_FILES))
+endif
+ifdef VBOX_WITH_DOCS_PACKING
+ VBOX_DI_VBAPP_MISC_FILES += \
+ MacOS/UserManual.pdf
+ ifdef VBOX_WITH_DOCS_QHELP_PACKING
+ VBOX_DI_VBAPP_MISC_FILES += \
+ MacOS/UserManual.qch \
+ MacOS/UserManual.qhc
+ endif
+endif
+ifdef VBOX_WITH_ADDITIONS_PACKING
+ ifneq ($(wildcard $(VBOX_PATH_DIST)/VirtualBox.app/Contents/MacOS/VBoxGuestAdditions.iso),)
+ VBOX_DI_VBAPP_MISC_FILES += \
+ MacOS/VBoxGuestAdditions.iso
+ endif
+endif
+ifdef VBOX_WITH_EFIFW_PACKING
+ VBOX_DI_VBAPP_MISC_FILES += \
+ MacOS/VBoxEFI32.fd \
+ MacOS/VBoxEFI64.fd
+endif
+VBOX_DI_VBAPP_SYMLINKS =
+ifdef VBOX_WITH_QTGUI
+ VBOX_DI_VBAPP_DYLIBS += \
+ $(foreach qtmod, $(VBOX_QT_MOD_NAMES), Frameworks/$(qtmod).framework/Versions/$(VBOX_QT_VERSION_MAJOR)/$(qtmod)) \
+ plugins/platforms/libqcocoa$(SUFF_DLL) \
+ plugins/platforms/libqminimal$(SUFF_DLL) \
+ plugins/platforms/libqoffscreen$(SUFF_DLL) \
+ plugins/sqldrivers/libqsqlite$(SUFF_DLL) \
+ plugins/styles/libqmacstyle$(SUFF_DLL)
+ VBOX_DI_VBAPP_MISC_FILES += \
+ $(foreach qtmod, $(VBOX_QT_MOD_NAMES), Frameworks/$(qtmod).framework/Versions/$(VBOX_QT_VERSION_MAJOR)/Resources/Info.plist)
+ VBOX_DI_VBAPP_SYMLINKS += \
+ Resources/vmstarter.app/Contents/MacOS=>../../../MacOS/ \
+ $(foreach qtmod, $(VBOX_QT_MOD_NAMES) \
+ ,Frameworks/$(qtmod).framework/Versions/Current=>$(VBOX_QT_VERSION_MAJOR) )
+endif
+ifdef VBOX_WITH_PYTHON
+ # Python XPCOM glue
+ VBOX_DI_VBAPP_PYTHON_FILES = \
+ $(VBOXINST_SDK_BINDINGS_XPCOM_PYTHON_FILES) \
+ $(VBOXINST_SDK_INSTALLER_PYTHON_FILES)
+endif
+ifdef VBOX_WITH_INTNET_SERVICE_IN_R3
+ VBOX_DI_VBAPP_PROGS += \
+ XPCServices/org.virtualbox.intnet.xpc/Contents/MacOS/VBoxIntNetSwitch
+ VBOX_DI_VBAPP_MISC_FILES += \
+ XPCServices/org.virtualbox.intnet.xpc/Contents/Info.plist
+ ifdef VBOX_WITH_QTGUI
+ VBOX_DI_VBAPP_SYMLINKS += \
+ Resources/VirtualBoxVM.app/Contents/XPCServices=>../../../XPCServices
+ endif
+endif
+
+VBOX_VIRTUALBOX_APP_ENTITLEMENTS := $(PATH_ROOT)/src/VBox/HostDrivers/Support/darwin/SUPR3HardenedEntitlements.plist
+VBOX_VIRTUALBOXVM_APP_ENTITLEMENTS := $(PATH_ROOT)/src/VBox/HostDrivers/Support/darwin/SUPR3HardenedEntitlementsVM.plist
+
+##
+# Add application and team ID into entitlement file
+# $(evalcall def_vbox_entitlement_add_app_and_team_id)
+# @param 1 Source entitlement file.
+# @param 2 Target entitlement file.
+# @param 3 Application ID.
+# @param 4 Team ID.
+define def_vbox_entitlement_add_app_and_team_id =
+ $(2): $(1) $$(VBOX_DARWIN_INST_DEP_ON_MAKEFILE) | $$$$(dir $$$$@)
+ $$(QUIET)$$(SED) \
+ -e '/^<dict>$$$$/a \ <key>com.apple.application-identifier</key>\n <string>$(strip $(4)).$(strip $(3))</string>\n <key>com.apple.developer.team-identifier</key>\n <string>$(strip $(4))</string>' \
+ --output $$@ $$<
+endef
+
+if defined(VBOX_WITH_MACOS_HARDENED_RUNTIME) && defined(VBOX_SIGNING_MODE) && defined(VBOX_PROVISIONPROFILE_TEAM_ID)
+ ifdef VBOX_VIRTUALBOX_APP_ID
+ VBOX_VIRTUALBOX_APP_ENTITLEMENTS := $(VBOX_PATH_PACK_TMP)/SUPR3HardenedEntitlements.plist
+ $(evalcall2 def_vbox_entitlement_add_app_and_team_id,$(PATH_ROOT)/src/VBox/HostDrivers/Support/darwin/SUPR3HardenedEntitlements.plist,$(VBOX_VIRTUALBOX_APP_ENTITLEMENTS),$(VBOX_VIRTUALBOX_APP_ID),$(VBOX_PROVISIONPROFILE_TEAM_ID))
+ endif
+
+ ifdef VBOX_VIRTUALBOXVM_APP_ID
+ VBOX_VIRTUALBOXVM_APP_ENTITLEMENTS := $(VBOX_PATH_PACK_TMP)/SUPR3HardenedEntitlementsVM.plist
+ $(evalcall2 def_vbox_entitlement_add_app_and_team_id,$(PATH_ROOT)/src/VBox/HostDrivers/Support/darwin/SUPR3HardenedEntitlementsVM.plist,$(VBOX_VIRTUALBOXVM_APP_ENTITLEMENTS),$(VBOX_VIRTUALBOXVM_APP_ID),$(VBOX_PROVISIONPROFILE_TEAM_ID))
+ endif
+endif
+
+# (The dependencies are including way too much here because I'm lazy.)
+$(VBOX_PATH_PACK_TMP)/Packages/VirtualBox.pkg: \
+ $(foreach f,$(VBOX_INSTALLER_ADD_LANGUAGES), \
+ $(VBOX_BRAND_$(f)_VIRTUALBOX_DESCRIPTION_PLIST)) \
+ $(foreach f, $(VBOX_DI_VBAPP_DYLIBS) $(VBOX_DI_VBAPP_OTHER_UNIVERSAL_BINS) $(VBOX_DI_VBAPP_UNIVERSAL_PROGS) \
+ $(VBOX_DI_VBAPP_OTHER_BINS) $(VBOX_DI_VBAPP_PROGS) $(VBOX_DI_VBAPP_PROGS_HARDENED) $(VBOX_DI_VBAPP_MISC_FILES) \
+ ,$(call VBOX_DI_FN_DEP_BOTH,VirtualBox.app/Contents/$(f)) ) \
+ $(foreach f, $(VBOX_DI_VBAPP_DYLIBS.x86) $(VBOX_DI_VBAPP_MISC_FILES.x86) \
+ ,$(call VBOX_DI_FN_DEP_32,VirtualBox.app/Contents/$(f)) ) \
+ $(foreach f, $(VBOX_DI_VBAPP_DYLIBS.amd64) $(VBOX_DI_VBAPP_MISC_FILES.amd64) \
+ ,$(call VBOX_DI_FN_DEP_64,VirtualBox.app/Contents/$(f)) ) \
+ \
+ $(if $(VBOX_WITH_DOCS_PACKING),$(VBOX_ADD_MANUALS),) \
+ $(VBOX_BRAND_LICENSE_TXT) \
+ $(wildcard $(VBOX_PATH_DI_SRC)/VirtualBox/*) \
+ $(wildcard $(VBOX_PATH_DI_SRC)/VirtualBox/*.lproj/*) \
+ $$(addprefix $(VBOX_PATH_DIST)/VirtualBox.app/Contents/MacOS/nls/,$(VBOX_INSTALL_LANG_FILES)) \
+ \
+ $$(wildcard $(VBOX_PATH_DIST)/VirtualBox.app/*) \
+ $(filter-out Disabled, $(wildcard $(VBOX_PATH_DIST)/VirtualBox.app/Contents/*)) \
+ $$(wildcard $(VBOX_PATH_DIST)/VirtualBox.app/Contents/Resources/*) \
+ $$(wildcard $(VBOX_PATH_DIST)/VirtualBox.app/Contents/Resources/VirtualBoxVM.app/Contents/*) \
+ $$(wildcard $(VBOX_PATH_DIST)/VirtualBox.app/Contents/Resources/VirtualBoxVM.app/Contents/Resources/*) \
+ $$(wildcard $(VBOX_PATH_DIST)/VirtualBox.app/Contents/Resources/VirtualBoxVM.app/Contents/Resources/*.lproj/*) \
+ $$(wildcard $(VBOX_PATH_DIST)/VirtualBox.app/Contents/Resources/vmstarter.app/Contents/*) \
+ $$(wildcard $(VBOX_PATH_DIST)/VirtualBox.app/Contents/Resources/vmstarter.app/Contents/Resources/*) \
+ $$(wildcard $(VBOX_PATH_DIST)/VirtualBox.app/Contents/Resources/vmstarter.app/Contents/Resources/*.lproj/*) \
+ $$(wildcard $(VBOX_PATH_DIST)/VirtualBox.app/Contents/Resources/*.lproj/*) \
+ $$(wildcard $(VBOX_PATH_DIST)/VirtualBox.app/Contents/MacOS/*) \
+ $$(wildcard $(VBOX_PATH_DIST)/VirtualBox.app/Contents/MacOS/additions/*) \
+ $$(wildcard $(VBOX_PATH_DIST)/VirtualBox.app/Contents/MacOS/components/*) \
+ $$(wildcard $(VBOX_PATH_DIST)/VirtualBox.app/Contents/MacOS/accessible/*) \
+ $(addprefix $(VBOX_PATH_DIST)/VirtualBox.app/Contents/MacOS/UnattendedTemplates/, $(VBOX_UNATTENDED_TEMPLATES)) \
+ $(if-expr defined(VBOX_WITH_PYTHON), $(addprefix $(VBOX_PATH_DIST)/, $(VBOX_DI_VBAPP_PYTHON_FILES)),) \
+ $(if-expr defined(VBOX_WITH_JXPCOM), $(addprefix $(VBOX_PATH_DIST)/, sdk/bindings/xpcom/java/vboxjxpcom.jar),) \
+ $(if-expr defined(VBOX_PROVISIONPROFILE_TEAM_ID),$(VBOX_PATH_DI_SRC)/VirtualBox/$(VBOX_PROVISIONPROFILE_TEAM_ID).provisionprofile,) \
+ $(if $(VBOX_WITH_WEBSERVICES),$(VBOX_PATH_DI_SRC)/VirtualBox/org.virtualbox.vboxwebsrv.plist,) \
+ $(VBOX_PATH_DI_SRC)/VirtualBox/org.virtualbox.vboxballoonctrl.plist \
+ $(VBOX_PATH_DI_SRC)/VirtualBox/org.virtualbox.vboxautostart.plist \
+ $(VBOX_PATH_DI_SRC)/VirtualBox/VBoxAutostartDarwin.sh \
+ $(if-expr defined(VBOX_WITH_DTRACE), \
+ $(foreach f, $(VBOXINST_DTRACE_LIB_ARCH_FILES), \
+ $(call VBOX_DI_FN_DEP_32,VirtualBox.app/Contents/MacOS/dtrace/lib/x86/$f) \
+ $(call VBOX_DI_FN_DEP_64,VirtualBox.app/Contents/MacOS/dtrace/lib/amd64/$f)) \
+ $(foreach f, $(VBOXINST_DTRACE_TESTCASE_ARCH_FILES), \
+ $(call VBOX_DI_FN_DEP_32,VirtualBox.app/Contents/MacOS/dtrace/testcase/x86/$f) \
+ $(call VBOX_DI_FN_DEP_64,VirtualBox.app/Contents/MacOS/dtrace/testcase/amd64/$f)) \
+ $(addprefix $(VBOX_PATH_DIST)/VirtualBox.app/Contents/MacOS/dtrace/scripts/,$(VBOXINST_DTRACE_SCRIPTS_FILES)) \
+ ,) \
+ $(if-expr defined(VBOX_WITH_MACOS_HARDENED_RUNTIME) && defined(VBOX_SIGNING_MODE), \
+ $(VBOX_VIRTUALBOX_APP_ENTITLEMENTS) $(VBOX_VIRTUALBOXVM_APP_ENTITLEMENTS),) \
+ $(VBOX_DARWIN_INST_DEP_ON_MAKEFILE)
+ $(call MSG_TOOL,pkgbuild,,,$@)
+ @# Cleanup any previously failed attempts.
+ sudo rm -Rf \
+ $@ \
+ $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root \
+ $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.desc \
+ $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.res
+ @# Correct directory permissions are important.
+ $(MKDIR) -p \
+ $(@D) \
+ $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.desc \
+ $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.res \
+ $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.res/English.lproj
+ $(MKDIR) -p -m 0775 \
+ $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications
+ $(MKDIR) -p -m 0755 $(sort \
+ $(VBOX_PATH_VBOX_APP_TMP)/Contents \
+ $(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS \
+ $(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS/components \
+ $(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS/nls \
+ $(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS/accessible \
+ $(VBOX_PATH_VBOX_APP_TMP)/Contents/Resources \
+ $(if-expr defined(VBOX_WITH_QTGUI), \
+ $(VBOX_PATH_VBOX_APP_TMP)/Contents/Resources/VirtualBoxVM.app \
+ $(VBOX_PATH_VBOX_APP_TMP)/Contents/Resources/VirtualBoxVM.app/Contents \
+ $(VBOX_PATH_VBOX_APP_TMP)/Contents/Resources/vmstarter.app \
+ $(VBOX_PATH_VBOX_APP_TMP)/Contents/Resources/vmstarter.app/Contents,) \
+ $(if-expr defined(VBOX_WITH_PYTHON), \
+ $(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS/sdk \
+ $(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS/sdk/installer \
+ $(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS/sdk/installer/vboxapi \
+ $(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS/sdk/bindings/ \
+ $(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS/sdk/bindings/xpcom \
+ $(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS/sdk/bindings/xpcom/python \
+ $(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS/sdk/bindings/xpcom/python/xpcom \
+ $(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS/sdk/bindings/xpcom/python/xpcom/client \
+ $(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS/sdk/bindings/xpcom/python/xpcom/server,) \
+ $(if-expr defined(VBOX_WITH_JXPCOM), \
+ $(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS/sdk/bindings/xpcom/java,) \
+ $(addprefix $(VBOX_PATH_VBOX_APP_TMP)/Contents/,$(dir \
+ $(VBOX_DI_VBAPP_DYLIBS) \
+ $(VBOX_DI_VBAPP_OTHER_UNIVERSAL_BINS) \
+ $(VBOX_DI_VBAPP_UNIVERSAL_PROGS) \
+ $(VBOX_DI_VBAPP_OTHER_BINS) \
+ $(VBOX_DI_VBAPP_PROGS) \
+ $(VBOX_DI_VBAPP_PROGS_HARDENED) \
+ $(VBOX_DI_VBAPP_MISC_FILES) \
+ $(VBOX_DI_VBAPP_DYLIBS.$(KBUILD_TARGET_ARCH)) \
+ $(VBOX_DI_VBAPP_MISC_FILES.$(KBUILD_TARGET_ARCH)) \
+ ))\
+ )
+# Create the .lproj language directories
+ $(MKDIR) -p -m 0755 \
+ $(addprefix $(VBOX_PATH_VBOX_APP_TMP)/Contents/Resources/,$(VBOX_INSTALL_LANG_LPROJ))
+# Install all supported language files
+ $(foreach f, $(VBOX_INSTALL_LANG_FILES) \
+ ,$(INSTALL) -m 0644 $(VBOX_PATH_DIST)/VirtualBox.app/Contents/MacOS/nls/$(f) $(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS/nls/$(f)$(NLTAB))
+ifdef VBOX_PROVISIONPROFILE_TEAM_ID
+ $(INSTALL) -m 0644 $(VBOX_PATH_DI_SRC)/VirtualBox/$(VBOX_PROVISIONPROFILE_TEAM_ID).provisionprofile $(VBOX_PATH_VBOX_APP_TMP)/Contents/embedded.provisionprofile
+endif
+ifdef VBOX_WITH_WEBSERVICES
+ $(INSTALL) -m 0644 $(VBOX_PATH_DI_SRC)/VirtualBox/org.virtualbox.vboxwebsrv.plist $(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS/
+endif
+ $(INSTALL) -m 0644 $(VBOX_PATH_DI_SRC)/VirtualBox/org.virtualbox.vboxballoonctrl.plist $(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS/
+ $(INSTALL) -m 0644 $(VBOX_PATH_DI_SRC)/VirtualBox/org.virtualbox.vboxautostart.plist $(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS/
+ $(INSTALL) -m 0755 $(VBOX_PATH_DI_SRC)/VirtualBox/VBoxAutostartDarwin.sh $(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS/
+# Install the python bridge stuff
+ifdef VBOX_WITH_PYTHON
+ $(foreach f,$(VBOX_DI_VBAPP_PYTHON_FILES) \
+ ,$(INSTALL) -m 0644 $(VBOX_PATH_DIST)/$(f) $(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS/$(f)$(NLTAB) )
+ $(INSTALL) -m 0755 $(PATH_ROOT)/src/VBox/Frontends/VBoxShell/vboxshell.py $(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS
+endif
+# Install the java bridge stuff
+ifdef VBOX_WITH_JXPCOM
+ $(INSTALL) -m 0755 $(VBOX_PATH_DIST)/sdk/bindings/xpcom/java/vboxjxpcom.jar $(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS/sdk/bindings/xpcom/java/vboxjxpcom.jar
+endif
+# Copy misc files.
+ $(foreach f,$(VBOX_DI_VBAPP_MISC_FILES) \
+ ,$(INSTALL) -m 0644 $(VBOX_PATH_DIST)/VirtualBox.app/Contents/$(f) $(VBOX_PATH_VBOX_APP_TMP)/Contents/$(f)$(NLTAB) )
+ $(INSTALL) -m 644 $(VBOX_BRAND_LICENSE_TXT) $(VBOX_PATH_VBOX_APP_TMP)/Contents/Resources/LICENSE
+ifdef VBOX_WITH_DOCS_PACKING
+ $(foreach f,$(VBOX_ADD_MANUALS) \
+ ,$(INSTALL) -m 0644 $(f) $(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS/$(NLTAB))
+endif
+ @# Create symlinks.
+ $(foreach symlink,$(VBOX_DI_VBAPP_SYMLINKS) $(VBOX_DI_VBAPP_SYMLINKS.$(KBUILD_TARGET_ARCH)) \
+ ,$(LN) -s $(word 2,$(subst =>, ,$(symlink))) $(VBOX_PATH_VBOX_APP_TMP)/Contents/$(word 1,$(subst =>, ,$(symlink)))$(NLTAB))
+ @# Copy the dylibs.
+ $(foreach dylib, $(VBOX_DI_VBAPP_DYLIBS) $(VBOX_DI_VBAPP_DYLIBS.$(KBUILD_TARGET_ARCH)) \
+ ,$(INSTALL) -m 0644 $(VBOX_PATH_DIST)/VirtualBox.app/Contents/$(dylib) $(VBOX_PATH_VBOX_APP_TMP)/Contents/$(dylib)$(NLTAB))
+ @# Copy the other binaries.
+ $(foreach otherbin, $(VBOX_DI_VBAPP_OTHER_UNIVERSAL_BINS) $(VBOX_DI_VBAPP_OTHER_BINS) \
+ ,$(INSTALL) -m 0644 $(VBOX_PATH_DIST)/VirtualBox.app/Contents/$(otherbin) $(VBOX_PATH_VBOX_APP_TMP)/Contents/$(otherbin)$(NLTAB))
+ @# Create/copy the universal executable binaries.
+ $(foreach otherbin, $(VBOX_DI_VBAPP_UNIVERSAL_PROGS) \
+ ,$(INSTALL) -m 0755 $(VBOX_PATH_DIST)/VirtualBox.app/Contents/$(otherbin) $(VBOX_PATH_VBOX_APP_TMP)/Contents/$(otherbin)$(NLTAB))
+ @# Copy the binaries.
+ $(foreach prog, $(VBOX_DI_VBAPP_PROGS) $(VBOX_DI_VBAPP_PROGS_HARDENED) \
+ ,$(INSTALL) -m 0755 $(VBOX_PATH_DIST)/VirtualBox.app/Contents/$(prog) $(VBOX_PATH_VBOX_APP_TMP)/Contents/$(prog)$(NLTAB))
+ifdef VBOX_UNATTENDED_TEMPLATES
+ # Unattended installation template scripts.
+ $(MKDIR) -p -m 0755 -- $(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS/UnattendedTemplates
+ $(foreach file, $(VBOX_UNATTENDED_TEMPLATES) \
+ ,$(INSTALL) -m 0655 $(VBOX_PATH_DIST)/VirtualBox.app/Contents/MacOS/UnattendedTemplates/$(file) \
+ $(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS/UnattendedTemplates/$(file)$(NLTAB))
+endif
+ifdef VBOX_WITH_DTRACE
+ # DTrace library, testcases and scripts.
+ $(MKDIR) -p -m 0755 -- \
+ $(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS/dtrace/lib/$(KBUILD_TARGET_ARCH)/ \
+ $(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS/dtrace/testcase/$(KBUILD_TARGET_ARCH)/ \
+ $(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS/dtrace/scripts/
+ $(foreach file, $(addprefix lib/$(KBUILD_TARGET_ARCH)/,$(VBOXINST_DTRACE_LIB_ARCH_FILES)) \
+ $(addprefix testcase/$(KBUILD_TARGET_ARCH)/,$(VBOXINST_DTRACE_TESTCASE_ARCH_FILES)) \
+ $(addprefix scripts/,$(VBOXINST_DTRACE_SCRIPTS_FILES)) \
+ ,$(INSTALL) -m 0655 $(VBOX_PATH_DIST)/VirtualBox.app/Contents/MacOS/dtrace/$(file) \
+ $(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS/dtrace/$(file)$(NLTAB))
+endif
+ifndef VBOX_WITH_QTGUI
+ # Hack alert! Just something to make pkgbuild happy.
+ $(APPEND) -tn "$(VBOX_PATH_VBOX_APP_TMP)/Contents/PkgInfo" "APPLVBOX"
+ $(APPEND) -tn "$(VBOX_PATH_VBOX_APP_TMP)/Contents/Info.plist" \
+ '<?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>CFBundlePackageType</key> <string>APPL</string>' \
+ ' <key>CFBundleSignature</key> <string>VBOX</string>' \
+ ' <key>CFBundleDevelopmentRegion</key> <string>English</string>' \
+ ' <key>CFBundleIdentifier</key> <string>org.virtualbox.app.VBoxManage</string>' \
+ ' <key>CFBundleName</key> <string>VirtualBox</string>' \
+ ' <key>CFBundleExecutable</key> <string>VBoxManage</string>' \
+ ' <key>CFBundleVersion</key> <string>$(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD)</string>' \
+ ' <key>CFBundleShortVersionString</key> <string>$(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD)</string>' \
+ ' <key>CFBundleGetInfoString</key> <string>$(VBOX_PRODUCT) Manager $(VBOX_VERSION_STRING), © 2007-$(VBOX_C_YEAR) $(VBOX_VENDOR)</string>' \
+ ' <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string>' \
+ '</dict>' \
+ '</plist>'
+endif
+ @# Sign the binaries and the application bundle.
+ifdef VBOX_SIGNING_MODE
+ ifdef VBOX_WITH_QTGUI
+ $(foreach qtmod, $(VBOX_QT_MOD_NAMES) \
+ ,$(NLTAB)$(call VBOX_SIGN_MACHO_FN,$(VBOX_PATH_VBOX_APP_TMP)/Contents/Frameworks/$(qtmod).framework/Versions/$(VBOX_QT_VERSION_MAJOR)/$(qtmod),org.virtualbox.app.frameworks.$(qtmod)) )
+ $(foreach qtmod, $(VBOX_QT_MOD_NAMES) \
+ ,$(NLTAB)$(call VBOX_SIGN_BUNDLE_FN,$(VBOX_PATH_VBOX_APP_TMP)/Contents/Frameworks/$(qtmod).framework/Versions/$(VBOX_QT_VERSION_MAJOR),org.virtualbox.app.frameworks.$(qtmod)) )
+ endif
+ $(foreach dylib, \
+ $(VBOX_DI_VBAPP_DYLIBS) \
+ $(VBOX_DI_VBAPP_DYLIBS.$(KBUILD_TARGET_ARCH)) \
+ , $(NLTAB)$(call VBOX_SIGN_MACHO_FN,$(VBOX_PATH_VBOX_APP_TMP)/Contents/$(dylib),org.virtualbox.app.macos.$(notdir $(dylib))) )
+ $(foreach bin, $(VBOX_DI_VBAPP_UNIVERSAL_PROGS) \
+ , $(NLTAB)$(call VBOX_SIGN_MACHO_FN,$(VBOX_PATH_VBOX_APP_TMP)/Contents/$(bin),org.virtualbox.app.macos.$(notdir $(bin))) )
+ $(foreach other, $(VBOX_DI_VBAPP_OTHER_UNIVERSAL_BINS) $(VBOX_DI_VBAPP_OTHER_BINS)\
+ , $(NLTAB)$(call VBOX_SIGN_MACHO_FN,$(VBOX_PATH_VBOX_APP_TMP)/Contents/$(other),org.virtualbox.app.macos.$(notdir $(other))) )
+ $(foreach bin, $(filter-out MacOS/VirtualBox,$(VBOX_DI_VBAPP_PROGS) $(if-expr !defined(VBOX_WITH_MACOS_HARDENED_RUNTIME),$(VBOX_DI_VBAPP_PROGS_HARDENED),)) \
+ , $(NLTAB)$(call VBOX_SIGN_MACHO_FN,$(VBOX_PATH_VBOX_APP_TMP)/Contents/$(bin),org.virtualbox.app.macos.$(notdir $(bin))) )
+ $(foreach file, $(if-expr defined(VBOX_WITH_WEBSERVICES),MacOS/org.virtualbox.vboxwebsrv.plist,) \
+ MacOS/org.virtualbox.vboxballoonctrl.plist \
+ MacOS/org.virtualbox.vboxautostart.plist \
+ MacOS/VBoxAutostartDarwin.sh \
+ $(if-expr defined(VBOX_WITH_PYTHON),$(addprefix MacOS/, $(VBOX_DI_VBAPP_PYTHON_FILES) vboxshell.py),) \
+ $(if-expr defined(VBOX_WITH_JXPCOM),MacOS/sdk/bindings/xpcom/java/vboxjxpcom.jar,) \
+ $(filter MacOS/%,$(VBOX_DI_VBAPP_MISC_FILES)) \
+ $(if-expr defined(VBOX_WITH_DOCS_PACKING),$(addprefix MacOS/,$(VBOX_ADD_MANUALS)),) \
+ $(if-expr defined(VBOX_WITH_DTRACE),\
+ $(addprefix MacOS/dtrace/lib/$(KBUILD_TARGET_ARCH)/,$(VBOXINST_DTRACE_LIB_ARCH_FILES)) \
+ $(addprefix MacOS/dtrace/testcase/$(KBUILD_TARGET_ARCH)/,$(VBOXINST_DTRACE_TESTCASE_ARCH_FILES)) \
+ $(addprefix MacOS/dtrace/scripts/,$(VBOXINST_DTRACE_SCRIPTS_FILES)) ,) \
+ $(addprefix MacOS/nls/,$(VBOX_INSTALL_LANG_FILES)) \
+ , $(NLTAB)$(call VBOX_SIGN_FILE_FN,$(VBOX_PATH_VBOX_APP_TMP)/Contents/$(file),org.virtualbox.app.$(tolower $(subst $(SP),,$(subst /,.,$(file))))) )
+
+ ifdef VBOX_PROVISIONPROFILE_TEAM_ID
+ # $(INSTALL) -m 0644 $(VBOX_PATH_DI_SRC)/VirtualBox/$(VBOX_PROVISIONPROFILE_TEAM_ID).provisionprofile $(VBOX_PATH_VBOX_APP_TMP)/Contents/Resources/VirtualBoxVM.app/Contents/embedded.provisionprofile
+ endif
+ $(call VBOX_SIGN_BUNDLE_FN,$(VBOX_PATH_VBOX_APP_TMP)/Contents/Resources/VirtualBoxVM.app,,$(if-expr defined(VBOX_WITH_MACOS_HARDENED_RUNTIME)\
+ ,--entitlements="$(VBOX_VIRTUALBOX_APP_ENTITLEMENTS)",))
+ ifdef VBOX_WITH_QTGUI
+ $(call VBOX_SIGN_BUNDLE_FN,$(VBOX_PATH_VBOX_APP_TMP)/Contents/Resources/vmstarter.app,,)
+ endif
+ $(call VBOX_SIGN_BUNDLE_FN,$(VBOX_PATH_VBOX_APP_TMP),,--deep)
+ ifdef VBOX_WITH_MACOS_HARDENED_RUNTIME # HACK ALERT! --deep fries the entitlements, so redo w/o --deep now.
+ $(foreach bin, $(filter-out MacOS/VirtualBoxVM MacOS/VBoxHeadless,$(VBOX_DI_VBAPP_PROGS_HARDENED)) \
+ , $(NLTAB)$(call VBOX_SIGN_MACHO_FN,$(VBOX_PATH_VBOX_APP_TMP)/Contents/$(bin),org.virtualbox.app.macos.$(notdir $(bin)), \
+ --entitlements="$(VBOX_VIRTUALBOX_APP_ENTITLEMENTS)"))
+ $(foreach bin, $(filter MacOS/VirtualBoxVM MacOS/VBoxHeadless,$(VBOX_DI_VBAPP_PROGS_HARDENED)) \
+ , $(NLTAB)$(call VBOX_SIGN_MACHO_FN,$(VBOX_PATH_VBOX_APP_TMP)/Contents/$(bin),org.virtualbox.app.macos.$(notdir $(bin)), \
+ --entitlements="$(VBOX_VIRTUALBOXVM_APP_ENTITLEMENTS)"))
+ $(call VBOX_SIGN_BUNDLE_FN,$(VBOX_PATH_VBOX_APP_TMP)/Contents/Resources/VirtualBoxVM.app,,\
+ --entitlements="$(VBOX_VIRTUALBOXVM_APP_ENTITLEMENTS)",)
+ $(call VBOX_SIGN_BUNDLE_FN,$(VBOX_PATH_VBOX_APP_TMP),,\
+ --entitlements="$(VBOX_VIRTUALBOX_APP_ENTITLEMENTS)",)
+ $(foreach bin, $(VBOX_DI_VBAPP_PROGS_HARDENED) \
+ , $(NLTAB)codesign -d -v -v -v --entitlements :- $(VBOX_PATH_VBOX_APP_TMP)/Contents/$(bin) )
+ $(foreach bin, $(VBOX_DI_VBAPP_PROGS) \
+ , $(NLTAB)codesign -d -v -v -v --entitlements :- $(VBOX_PATH_VBOX_APP_TMP)/Contents/$(bin) )
+ endif
+endif
+ @# Set the correct owner and set the set-user-ID-on-execution bit on the relevant executables.
+ sudo chown -R root:admin $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root
+ sudo chmod u+s $(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS/VBoxNetAdpCtl
+ifdef VBOX_WITH_HARDENING
+ sudo chmod u+s $(foreach bin,$(VBOX_DI_VBAPP_PROGS_HARDENED),$(VBOX_PATH_VBOX_APP_TMP)/Contents/$(bin))
+endif
+if 0 # Handy for testing the app bundle w/o having to reinstall all the time (just untar it into -C /Applications/)
+ $(RM) -f -- "$(PATH_OUT)/VirtualBox.app.tar.gz"
+ tar -czf "$(PATH_OUT)/VirtualBox.app.tar.gz" -C "$(VBOX_PATH_VBOX_APP_TMP)/.." VirtualBox.app
+endif
+ @# 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)/VirtualBox.pkg.desc/PkgBuildComponent.plist \
+ $(VBOX_PATH_DI_SRC)/VirtualBox/PkgBuildComponent.plist
+ @# Copy the resources.
+ $(INSTALL) -m 0755 $(VBOX_PATH_DI_SRC)/VirtualBox/preflight $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.res/
+ifdef VBOX_WITH_HARDENING
+ $(INSTALL) -m 0755 $(VBOX_PATH_DI_SRC)/VirtualBox/postflight $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.res/
+else
+ $(SED) -s '/WITH_HARDENING/d' -o $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.res/postflight $(VBOX_PATH_DI_SRC)/VirtualBox/postflight
+ $(CHMOD) 0755 $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.res/postflight
+endif
+ ls -lR $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/
+ @# Build the package.
+ $(VBOX_PKGBUILD) \
+ --root $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/ \
+ --component-plist $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.desc/PkgBuildComponent.plist \
+ --script $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.res \
+ --identifier org.virtualbox.pkg.virtualbox \
+ --version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
+ --install-location /Applications/ \
+ --ownership preserve \
+ --preserve-xattr \
+ $(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.virtualbox)
+ endif
+endif
+ @# Cleanup
+ sudo chown -R "$(shell whoami)" \
+ $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root
+ sudo chmod -R a-s \
+ $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root
+ sudo rm -Rf \
+ $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root \
+ $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.desc \
+ $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.res
+
+#
+# The VirtualBox CLI wrapper scripts.
+#
+$(VBOX_PATH_PACK_TMP)/Packages/VirtualBoxCLI.pkg: \
+ $$(wildcard \
+ $(VBOX_PATH_DI_SRC)/VirtualBoxCLI/* \
+ $(VBOX_PATH_DI_SRC)/VirtualBoxCLI/*.lproj/*) \
+ $(foreach f,$(VBOX_INSTALLER_ADD_LANGUAGES) \
+ ,$(VBOX_BRAND_$(f)_VIRTUALBOXCLI_DESCRIPTION_PLIST)) \
+ $(VBOX_DARWIN_INST_DEP_ON_MAKEFILE)
+ $(call MSG_TOOL,pkgbuild,,,$@)
+ @# Cleanup any previously failed attempts.
+ sudo rm -Rf \
+ $@ \
+ $(VBOX_PATH_PACK_TMP)/VirtualBoxCLI.pkg.root \
+ $(VBOX_PATH_PACK_TMP)/VirtualBoxCLI.pkg.desc \
+ $(VBOX_PATH_PACK_TMP)/VirtualBoxCLI.pkg.res
+ @# Correct directory permissions are important.
+ $(MKDIR) -p \
+ $(@D) \
+ $(VBOX_PATH_PACK_TMP)/VirtualBoxCLI.pkg.desc \
+ $(VBOX_PATH_PACK_TMP)/VirtualBoxCLI.pkg.res \
+ $(VBOX_PATH_PACK_TMP)/VirtualBoxCLI.pkg.res/English.lproj
+ $(MKDIR) -p -m 0755 \
+ $(VBOX_PATH_PACK_TMP)/VirtualBoxCLI.pkg.root/usr \
+ $(VBOX_PATH_PACK_TMP)/VirtualBoxCLI.pkg.root/usr/local/bin
+ @# Generate the wrapper scripts.
+ $(APPEND) -tn $(VBOX_PATH_PACK_TMP)/VirtualBoxCLI.pkg.root/usr/local/bin/VirtualBox \
+ '#!/bin/bash' 'exec /Applications/VirtualBox.app/Contents/MacOS/VirtualBox "$$@"'
+ $(APPEND) -tn $(VBOX_PATH_PACK_TMP)/VirtualBoxCLI.pkg.root/usr/local/bin/VirtualBoxVM \
+ '#!/bin/bash' 'exec /Applications/VirtualBox.app/Contents/Resources/VirtualBoxVM.app/Contents/MacOS/VirtualBoxVM "$$@"'
+ $(APPEND) -tn $(VBOX_PATH_PACK_TMP)/VirtualBoxCLI.pkg.root/usr/local/bin/VBoxManage \
+ '#!/bin/bash' 'exec /Applications/VirtualBox.app/Contents/MacOS/VBoxManage "$$@"'
+ $(APPEND) -tn $(VBOX_PATH_PACK_TMP)/VirtualBoxCLI.pkg.root/usr/local/bin/VBoxVRDP \
+ '#!/bin/bash' 'exec /Applications/VirtualBox.app/Contents/MacOS/VBoxHeadless "$$@"'
+ $(APPEND) -tn $(VBOX_PATH_PACK_TMP)/VirtualBoxCLI.pkg.root/usr/local/bin/VBoxHeadless \
+ '#!/bin/bash' 'exec /Applications/VirtualBox.app/Contents/MacOS/VBoxHeadless "$$@"'
+ifdef VBOX_WITH_WEBSERVICES
+ $(APPEND) -tn $(VBOX_PATH_PACK_TMP)/VirtualBoxCLI.pkg.root/usr/local/bin/vboxwebsrv \
+ '#!/bin/bash' 'exec /Applications/VirtualBox.app/Contents/MacOS/vboxwebsrv "$$@"'
+endif
+if defined(VBOX_WITH_VBOX_IMG) || defined(VBOX_WITH_TESTCASES)
+ $(APPEND) -tn $(VBOX_PATH_PACK_TMP)/VirtualBoxCLI.pkg.root/usr/local/bin/vbox-img \
+ '#!/bin/bash' 'exec /Applications/VirtualBox.app/Contents/MacOS/vbox-img "$$@"'
+endif
+if defined(VBOX_WITH_VBOXIMGMOUNT)
+ $(APPEND) -tn $(VBOX_PATH_PACK_TMP)/VirtualBoxCLI.pkg.root/usr/local/bin/vboximg-mount \
+ '#!/bin/bash' 'exec /Applications/VirtualBox.app/Contents/MacOS/vboximg-mount "$$@"'
+endif
+ $(APPEND) -tn $(VBOX_PATH_PACK_TMP)/VirtualBoxCLI.pkg.root/usr/local/bin/VBoxBugReport \
+ '#!/bin/bash' 'exec /Applications/VirtualBox.app/Contents/MacOS/VBoxBugReport "$$@"'
+ $(APPEND) -tn $(VBOX_PATH_PACK_TMP)/VirtualBoxCLI.pkg.root/usr/local/bin/VBoxBalloonCtrl \
+ '#!/bin/bash' 'exec /Applications/VirtualBox.app/Contents/MacOS/VBoxBalloonCtrl "$$@"'
+ $(APPEND) -tn $(VBOX_PATH_PACK_TMP)/VirtualBoxCLI.pkg.root/usr/local/bin/VBoxAutostart \
+ '#!/bin/bash' 'exec /Applications/VirtualBox.app/Contents/MacOS/VBoxAutostart "$$@"'
+ifdef VBOX_WITH_DTRACE
+ $(APPEND) -tn $(VBOX_PATH_PACK_TMP)/VirtualBoxCLI.pkg.root/usr/local/bin/VBoxDTrace \
+ '#!/bin/bash' 'exec /Applications/VirtualBox.app/Contents/MacOS/VBoxDTrace "$$@"'
+endif
+ifdef VBOX_WITH_HOST_SHIPPING_AUDIO_TEST
+ $(APPEND) -tn $(VBOX_PATH_PACK_TMP)/VirtualBoxCLI.pkg.root/usr/local/bin/VBoxAudioTest \
+ '#!/bin/bash' 'exec /Applications/VirtualBox.app/Contents/MacOS/VBoxAudioTest "$$@"'
+endif
+ @# Set the correct owners and file permissions.
+ sudo chmod 0755 $(VBOX_PATH_PACK_TMP)/VirtualBoxCLI.pkg.root/usr/local/bin/*
+ sudo chown root:admin $(VBOX_PATH_PACK_TMP)/VirtualBoxCLI.pkg.root
+ sudo chown -R root:wheel $(VBOX_PATH_PACK_TMP)/VirtualBoxCLI.pkg.root/usr
+ @# Build the package.
+ $(VBOX_PKGBUILD) \
+ --root $(VBOX_PATH_PACK_TMP)/VirtualBoxCLI.pkg.root/usr/local/bin \
+ --identifier org.virtualbox.pkg.virtualboxcli \
+ --version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
+ --install-location /usr/local/bin \
+ --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.virtualboxcli)
+ endif
+endif
+ @# Cleanup
+ sudo chown -R "$(shell whoami)" \
+ $(VBOX_PATH_PACK_TMP)/VirtualBoxCLI.pkg.root
+ sudo rm -Rf \
+ $(VBOX_PATH_PACK_TMP)/VirtualBoxCLI.pkg.root \
+ $(VBOX_PATH_PACK_TMP)/VirtualBoxCLI.pkg.desc \
+ $(VBOX_PATH_PACK_TMP)/VirtualBoxCLI.pkg.res
+
+ifdef VBOX_WITH_FUSE_PACKING
+ #
+ # The FUSE for macOS core package.
+ #
+ VBOX_PATH_FUSE_CORE_PKG ?= $(lastword $(sort $(wildcard $(KBUILD_DEVTOOLS_TRG)/osxfuse/v*)))/Core.pkg
+ $(VBOX_PATH_PACK_TMP)/Packages/OSXFuseCore.pkg: \
+ $(VBOX_PATH_FUSE_CORE_PKG)
+ $(call MSG_TOOL,Preparing FUSE for macOS core package,,,$@)
+ @# Cleanup any previously failed attempts.
+ sudo rm -Rf $@
+ $(MKDIR) -p $(@D)
+ pkgutil --flatten $(VBOX_PATH_FUSE_CORE_PKG) $@
+endif
+
+
+#
+# Aliases.
+#
+VBoxKEXTs.pkg: $(VBOX_PATH_PACK_TMP)/Packages/VBoxKEXTs.pkg
+VirtualBoxCLI.pkg: $(VBOX_PATH_PACK_TMP)/Packages/VirtualBoxCLI.pkg
+VirtualBox.pkg: $(VBOX_PATH_PACK_TMP)/Packages/VirtualBox.pkg
+VirtualBox.mpkg: $(VBOX_PATH_PACK_TMP)/DiskImage/VirtualBox.pkg
+VirtualBox.dmg: $(VBOX_PATH_DIST)/VirtualBox-$(VBOX_VERSION_STRING)-r$(VBOX_SVN_REV).dmg
diff --git a/src/VBox/Installer/darwin/VBoxKEXTs/PkgBuildComponent.plist b/src/VBox/Installer/darwin/VBoxKEXTs/PkgBuildComponent.plist
new file mode 100644
index 00000000..c7569703
--- /dev/null
+++ b/src/VBox/Installer/darwin/VBoxKEXTs/PkgBuildComponent.plist
@@ -0,0 +1,29 @@
+<?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>VBoxDrv.kext</string>
+ <key>BundleIsRelocatable</key> <false/>
+ <key>BundleIsVersionChecked</key> <false/>
+ <key>BundleHasStrictIdentifier</key> <false/>
+ <key>BundleOverwriteAction</key> <string>upgrade</string>
+ </dict>
+ <dict>
+ <key>RootRelativeBundlePath</key> <string>VBoxNetAdp.kext</string>
+ <key>BundleIsRelocatable</key> <false/>
+ <key>BundleIsVersionChecked</key> <false/>
+ <key>BundleHasStrictIdentifier</key> <false/>
+ <key>BundleOverwriteAction</key> <string>upgrade</string>
+ </dict>
+ <dict>
+ <key>RootRelativeBundlePath</key> <string>VBoxNetFlt.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/Installer/darwin/VBoxKEXTs/VirtualBoxStartup.sh b/src/VBox/Installer/darwin/VBoxKEXTs/VirtualBoxStartup.sh
new file mode 100755
index 00000000..8700db33
--- /dev/null
+++ b/src/VBox/Installer/darwin/VBoxKEXTs/VirtualBoxStartup.sh
@@ -0,0 +1,277 @@
+#!/bin/sh
+# $Id: VirtualBoxStartup.sh $
+## @file
+# Startup service for loading the kernel extensions and select the set of VBox
+# binaries that matches the kernel architecture.
+#
+
+#
+# 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
+#
+
+if false; then
+ . /etc/rc.common
+else
+ # Fake the startup item functions we're using.
+
+ ConsoleMessage()
+ {
+ if [ "$1" != "-f" ]; then
+ echo "$@"
+ else
+ shift
+ echo "Fatal error: $@"
+ exit 1;
+ fi
+ }
+
+ RunService()
+ {
+ case "$1" in
+ "start")
+ StartService
+ exit $?;
+ ;;
+ "stop")
+ StopService
+ exit $?;
+ ;;
+ "restart")
+ RestartService
+ exit $?;
+ ;;
+ "launchd")
+ if RestartService; then
+ while true;
+ do
+ sleep 3600
+ done
+ fi
+ exit $?;
+ ;;
+ **)
+ echo "Error: Unknown action '$1'"
+ exit 1;
+ esac
+ }
+fi
+
+
+StartService()
+{
+ VBOX_RC=0
+ VBOXDRV="VBoxDrv"
+ MACOS_VERSION_MAJOR=$(sw_vers -productVersion | /usr/bin/sed -e 's/^\([0-9]*\).*$/\1/')
+
+ #
+ # Check that all the directories exist first.
+ #
+ if [ ! -d "/Library/Application Support/VirtualBox/${VBOXDRV}.kext" ]; then
+ ConsoleMessage "Error: /Library/Application Support/VirtualBox/${VBOXDRV}.kext is missing"
+ VBOX_RC=1
+ fi
+ if [ ! -d "/Library/Application Support/VirtualBox/VBoxNetFlt.kext" ]; then
+ ConsoleMessage "Error: /Library/Application Support/VirtualBox/VBoxNetFlt.kext is missing"
+ VBOX_RC=1
+ fi
+ if [ ! -d "/Library/Application Support/VirtualBox/VBoxNetAdp.kext" ]; then
+ ConsoleMessage "Error: /Library/Application Support/VirtualBox/VBoxNetAdp.kext is missing"
+ VBOX_RC=1
+ fi
+
+ #
+ # Check that no drivers are currently running.
+ # (Try stop the service if this is the case.)
+ #
+ if [ $VBOX_RC -eq 0 ]; then
+ if [[ ${MACOS_VERSION_MAJOR} -lt 11 ]]; then
+ if kextstat -lb org.virtualbox.kext.VBoxDrv 2>&1 | grep -q org.virtualbox.kext.VBoxDrv; then
+ ConsoleMessage "Error: ${VBOXDRV}.kext is already loaded"
+ VBOX_RC=1
+ fi
+ if kextstat -lb org.virtualbox.kext.VBoxNetFlt 2>&1 | grep -q org.virtualbox.kext.VBoxNetFlt; then
+ ConsoleMessage "Error: VBoxNetFlt.kext is already loaded"
+ VBOX_RC=1
+ fi
+ if kextstat -lb org.virtualbox.kext.VBoxNetAdp 2>&1 | grep -q org.virtualbox.kext.VBoxNetAdp; then
+ ConsoleMessage "Error: VBoxNetAdp.kext is already loaded"
+ VBOX_RC=1
+ fi
+ else
+ #
+ # Use kmutil directly on BigSur or grep will erroneously trigger because kextstat dumps the kmutil
+ # invocation to stdout...
+ #
+ if kmutil showloaded --list-only -b org.virtualbox.kext.VBoxDrv 2>&1 | grep -q org.virtualbox.kext.VBoxDrv; then
+ ConsoleMessage "Error: ${VBOXDRV}.kext is already loaded"
+ VBOX_RC=1
+ fi
+ if kmutil showloaded --list-only -b org.virtualbox.kext.VBoxNetFlt 2>&1 | grep -q org.virtualbox.kext.VBoxNetFlt; then
+ ConsoleMessage "Error: VBoxNetFlt.kext is already loaded"
+ VBOX_RC=1
+ fi
+ if kmutil showloaded --list-only -b org.virtualbox.kext.VBoxNetAdp 2>&1 | grep -q org.virtualbox.kext.VBoxNetAdp; then
+ ConsoleMessage "Error: VBoxNetAdp.kext is already loaded"
+ VBOX_RC=1
+ fi
+ fi
+ fi
+
+ #
+ # Load the drivers.
+ #
+ if [ $VBOX_RC -eq 0 ]; then
+ if [[ ${MACOS_VERSION_MAJOR} -lt 11 ]]; then
+ ConsoleMessage "Loading ${VBOXDRV}.kext"
+ if ! kextload "/Library/Application Support/VirtualBox/${VBOXDRV}.kext"; then
+ ConsoleMessage "Error: Failed to load /Library/Application Support/VirtualBox/${VBOXDRV}.kext"
+ VBOX_RC=1
+ fi
+
+ ConsoleMessage "Loading VBoxNetFlt.kext"
+ if ! kextload -d "/Library/Application Support/VirtualBox/${VBOXDRV}.kext" "/Library/Application Support/VirtualBox/VBoxNetFlt.kext"; then
+ ConsoleMessage "Error: Failed to load /Library/Application Support/VirtualBox/VBoxNetFlt.kext"
+ VBOX_RC=1
+ fi
+
+ ConsoleMessage "Loading VBoxNetAdp.kext"
+ if ! kextload -d "/Library/Application Support/VirtualBox/${VBOXDRV}.kext" "/Library/Application Support/VirtualBox/VBoxNetAdp.kext"; then
+ ConsoleMessage "Error: Failed to load /Library/Application Support/VirtualBox/VBoxNetAdp.kext"
+ VBOX_RC=1
+ fi
+ else
+ #
+ # On BigSur we can only load by bundle ID because the drivers are baked into a kext collection image
+ # and the real path is never loaded actually.
+ #
+ ConsoleMessage "Loading ${VBOXDRV}.kext"
+ if ! kmutil load -b org.virtualbox.kext.VBoxDrv; then
+ ConsoleMessage "Error: Failed to load org.virtualbox.kext.VBoxDrv"
+ VBOX_RC=1
+ fi
+
+ ConsoleMessage "Loading VBoxNetFlt.kext"
+ if ! kmutil load -b org.virtualbox.kext.VBoxNetFlt; then
+ ConsoleMessage "Error: Failed to load org.virtualbox.kext.VBoxNetFlt"
+ VBOX_RC=1
+ fi
+
+ ConsoleMessage "Loading VBoxNetAdp.kext"
+ if ! kmutil load -b org.virtualbox.kext.VBoxNetAdp; then
+ ConsoleMessage "Error: Failed to load org.virtualbox.kext.VBoxNetAdp"
+ VBOX_RC=1
+ fi
+ fi
+
+ if [ $VBOX_RC -ne 0 ]; then
+ # unload the drivers (ignoring failures)
+ kextunload -b org.virtualbox.kext.VBoxNetAdp
+ kextunload -b org.virtualbox.kext.VBoxNetFlt
+ kextunload -b org.virtualbox.kext.VBoxDrv
+ fi
+ fi
+
+ #
+ # Set the error on failure.
+ #
+ if [ "$VBOX_RC" -ne "0" ]; then
+ ConsoleMessage -f VirtualBox
+ exit $VBOX_RC
+ fi
+}
+
+
+StopService()
+{
+ VBOX_RC=0
+ VBOXDRV="VBoxDrv"
+ VBOXUSB="VBoxUSB"
+ MACOS_VERSION_MAJOR=$(sw_vers -productVersion | /usr/bin/sed -e 's/^\([0-9]*\).*$/\1/')
+
+ if [[ ${MACOS_VERSION_MAJOR} -lt 11 ]]; then
+ if kextstat -lb org.virtualbox.kext.VBoxNetFlt 2>&1 | grep -q org.virtualbox.kext.VBoxNetFlt; then
+ ConsoleMessage "Unloading VBoxNetFlt.kext"
+ if ! kextunload -m org.virtualbox.kext.VBoxNetFlt; then
+ ConsoleMessage "Error: Failed to unload VBoxNetFlt.kext"
+ VBOX_RC=1
+ fi
+ fi
+
+ if kextstat -lb org.virtualbox.kext.VBoxNetAdp 2>&1 | grep -q org.virtualbox.kext.VBoxNetAdp; then
+ ConsoleMessage "Unloading VBoxNetAdp.kext"
+ if ! kextunload -m org.virtualbox.kext.VBoxNetAdp; then
+ ConsoleMessage "Error: Failed to unload VBoxNetAdp.kext"
+ VBOX_RC=1
+ fi
+ fi
+
+ # This must come last because of dependencies.
+ if kextstat -lb org.virtualbox.kext.VBoxDrv 2>&1 | grep -q org.virtualbox.kext.VBoxDrv; then
+ ConsoleMessage "Unloading ${VBOXDRV}.kext"
+ if ! kextunload -m org.virtualbox.kext.VBoxDrv; then
+ ConsoleMessage "Error: Failed to unload VBoxDrv.kext"
+ VBOX_RC=1
+ fi
+ fi
+ else
+ if kmutil showloaded --list-only -b org.virtualbox.kext.VBoxNetFlt 2>&1 | grep -q org.virtualbox.kext.VBoxNetFlt; then
+ ConsoleMessage "Unloading VBoxNetFlt.kext"
+ if ! kmutil unload -b org.virtualbox.kext.VBoxNetFlt; then
+ ConsoleMessage "Error: Failed to unload VBoxNetFlt.kext"
+ VBOX_RC=1
+ fi
+ fi
+
+ if kmutil showloaded --list-only -b org.virtualbox.kext.VBoxNetAdp 2>&1 | grep -q org.virtualbox.kext.VBoxNetAdp; then
+ ConsoleMessage "Unloading VBoxNetAdp.kext"
+ if ! kmutil unload -b org.virtualbox.kext.VBoxNetAdp; then
+ ConsoleMessage "Error: Failed to unload VBoxNetAdp.kext"
+ VBOX_RC=1
+ fi
+ fi
+
+ # This must come last because of dependencies.
+ if kmutil showloaded --list-only -b org.virtualbox.kext.VBoxDrv 2>&1 | grep -q org.virtualbox.kext.VBoxDrv; then
+ ConsoleMessage "Unloading ${VBOXDRV}.kext"
+ if ! kmutil unload -b org.virtualbox.kext.VBoxDrv; then
+ ConsoleMessage "Error: Failed to unload VBoxDrv.kext"
+ VBOX_RC=1
+ fi
+ fi
+ fi
+
+ # Set the error on failure.
+ if [ "$VBOX_RC" -ne "0" ]; then
+ ConsoleMessage -f VirtualBox
+ exit $VBOX_RC
+ fi
+}
+
+
+RestartService()
+{
+ StopService
+ StartService
+}
+
+
+RunService "$1"
+
diff --git a/src/VBox/Installer/darwin/VBoxKEXTs/org.virtualbox.startup.plist b/src/VBox/Installer/darwin/VBoxKEXTs/org.virtualbox.startup.plist
new file mode 100644
index 00000000..490c9ba6
--- /dev/null
+++ b/src/VBox/Installer/darwin/VBoxKEXTs/org.virtualbox.startup.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>Label</key> <string>org.virtualbox.startup</string>
+ <key>Disabled</key> <false/>
+ <key>RunAtLoad</key> <true/>
+ <key>KeepAlive</key> <false/>
+ <key>LaunchOnlyOnce</key> <true/>
+ <key>ProgramArguments</key>
+ <array>
+ <string>/Library/Application Support/VirtualBox/LaunchDaemons/VirtualBoxStartup.sh</string>
+ <string>restart</string>
+ </array>
+</dict>
+</plist>
+
diff --git a/src/VBox/Installer/darwin/VBoxKEXTs/postflight b/src/VBox/Installer/darwin/VBoxKEXTs/postflight
new file mode 100755
index 00000000..4f00d2ef
--- /dev/null
+++ b/src/VBox/Installer/darwin/VBoxKEXTs/postflight
@@ -0,0 +1,117 @@
+#!/bin/sh
+# $Id$
+## @file
+# Reloads the new kernel extension at the end of installation.
+#
+
+#
+# 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
+#
+
+#
+# Make sure the old startup items are gone.
+#
+if [ -d /Library/StartupItems/VirtualBox/ ]; then
+ rm -vf "/Library/StartupItems/VirtualBox/StartupParameters.plist"
+ rm -vf "/Library/StartupItems/VirtualBox/VirtualBox"
+ rm -vf "/Library/StartupItems/VirtualBox/Resources/English.lproj/Localizable.strings"
+ test -d "/Library/StartupItems/VirtualBox/Resources/English.lproj/" && rmdir "/Library/StartupItems/VirtualBox/Resources/English.lproj/"
+ test -d "/Library/StartupItems/VirtualBox/Resources/" && rmdir "/Library/StartupItems/VirtualBox/Resources/"
+ test -d "/Library/StartupItems/VirtualBox/" && rmdir "/Library/StartupItems/VirtualBox/"
+fi
+
+#
+# Make sure old kernel extensions are gone (moved to "/Library/Application Support/VirtualBox/" with 4.3).
+#
+rm -Rfv \
+ "/Library/Extensions/VBoxDrv.kext/" \
+ "/Library/Extensions/VBoxNetFlt.kext/" \
+ "/Library/Extensions/VBoxNetAdp.kext/" \
+ "/Library/Extensions/VBoxUSB.kext/" \
+ "/Library/Extensions/VBoxDrvTiger.kext/" \
+ "/Library/Extensions/VBoxUSBTiger.kext/"
+
+#
+# Install the launchd script.
+#
+# Make sure "/Library/LaunchDaemons/ exists first as some uninstallers/users
+# may be silly enough to remove it. We assume that /Library exists and will
+# not try create it because it normally has extra ACLs.
+#
+if [ ! -e "/Library/LaunchDaemons/" ]; then
+ set -e
+ mkdir "/Library/LaunchDaemons"
+ chmod 755 "/Library/LaunchDaemons"
+ chown root:wheel "/Library/LaunchDaemons"
+ set +e
+fi
+rm -vf "/Library/LaunchDaemons/org.virtualbox.startup.plist"
+set -e
+ln -s "../Application Support/VirtualBox/LaunchDaemons/org.virtualbox.startup.plist" \
+ "/Library/LaunchDaemons/org.virtualbox.startup.plist"
+set +e
+
+#
+# Unload any old extension that might be loaded already (ignore failures).
+#
+sync
+if kextstat -lb org.virtualbox.kext.VBoxNetAdp 2>&1 | grep -q org.virtualbox.kext.VBoxNetAdp; then
+ kextunload -m org.virtualbox.kext.VBoxNetAdp
+fi
+if kextstat -lb org.virtualbox.kext.VBoxNetFlt 2>&1 | grep -q org.virtualbox.kext.VBoxNetFlt; then
+ kextunload -m org.virtualbox.kext.VBoxNetFlt
+fi
+if kextstat -lb org.virtualbox.kext.VBoxUSB 2>&1 | grep -q org.virtualbox.kext.VBoxUSB; then
+ kextunload -m org.virtualbox.kext.VBoxUSB
+fi
+if kextstat -lb org.virtualbox.kext.VBoxDrv 2>&1 | grep -q org.virtualbox.kext.VBoxDrv; then
+ kextunload -m org.virtualbox.kext.VBoxDrv
+fi
+
+#
+# Load the extension, exit on first error except on BigSur onwards as an error
+# is expected there and the user has to reboot.
+#
+MACOS_VERSION_MAJOR=$(sw_vers -productVersion | /usr/bin/sed -e 's/^\([0-9]*\).*$/\1/')
+sync
+if [[ ${MACOS_VERSION_MAJOR} -lt 11 ]]; then
+ set -e
+ kextload '/Library/Application Support/VirtualBox/VBoxDrv.kext'
+ kextload -d '/Library/Application Support/VirtualBox/VBoxDrv.kext' '/Library/Application Support/VirtualBox/VBoxNetFlt.kext'
+ kextload -d '/Library/Application Support/VirtualBox/VBoxDrv.kext' '/Library/Application Support/VirtualBox/VBoxNetAdp.kext'
+else
+ VBOX_RC=0
+ if ! kmutil load -p '/Library/Application Support/VirtualBox/VBoxDrv.kext'; then
+ VBOX_RC=1
+ fi
+
+ if ! kmutil load -p '/Library/Application Support/VirtualBox/VBoxNetFlt.kext'; then
+ VBOX_RC=1
+ fi
+
+ if ! kmutil load -p '/Library/Application Support/VirtualBox/VBoxNetAdp.kext'; then
+ VBOX_RC=1
+ fi
+
+ if [ $VBOX_RC -ne 1 ]; then
+ osascript -e 'display dialog "A reboot is required on macOS BigSur and onwards in order to be able to load the installed kernel extensions" buttons { "Ok" } with icon caution'
+ fi
+fi
diff --git a/src/VBox/Installer/darwin/VirtualBox/PkgBuildComponent.plist b/src/VBox/Installer/darwin/VirtualBox/PkgBuildComponent.plist
new file mode 100644
index 00000000..a67ae42c
--- /dev/null
+++ b/src/VBox/Installer/darwin/VirtualBox/PkgBuildComponent.plist
@@ -0,0 +1,17 @@
+<?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>VirtualBox.app</string>
+ <key>BundleIsRelocatable</key> <false/>
+ <key>BundleIsVersionChecked</key> <false/>
+ <key>BundleHasStrictIdentifier</key> <false/>
+ <key>BundleOverwriteAction</key> <string>upgrade</string>
+ <key>BundlePreInstallScriptPath</key> <string>preflight</string>
+ <key>BundlePostInstallScriptPath</key> <string>postflight</string>
+ </dict>
+</array>
+</plist>
+
+
diff --git a/src/VBox/Installer/darwin/VirtualBox/VBoxAutostartDarwin.sh b/src/VBox/Installer/darwin/VirtualBox/VBoxAutostartDarwin.sh
new file mode 100755
index 00000000..03672d8c
--- /dev/null
+++ b/src/VBox/Installer/darwin/VirtualBox/VBoxAutostartDarwin.sh
@@ -0,0 +1,71 @@
+#!/bin/sh
+
+#
+# Copyright (C) 2012-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
+#
+
+#
+# Wrapper for the per user autostart daemon. Gets a list of all users
+# and starts the VMs.
+#
+
+function vboxStartStopAllUserVms()
+{
+ # Go through the list and filter out all users without a shell and a
+ # non existing home.
+ for user in `dscl . -list /Users`
+ do
+ HOMEDIR=`dscl . -read /Users/"${user}" NFSHomeDirectory | sed 's/NFSHomeDirectory: //g'`
+ USERSHELL=`dscl . -read /Users/"${user}" UserShell | sed 's/UserShell: //g'`
+
+ # Check for known home directories and shells for daemons
+ if [[ "${HOMEDIR}" == "/var/empty" || "${HOMEDIR}" == "/dev/null" || "${HOMEDIR}" == "/var/root"
+ || "${USERSHELL}" == "/usr/bin/false" || "${USERSHELL}" == "/dev/null" || "${USERSHELL}" == "/usr/sbin/uucico" ]]
+ then
+ continue
+ fi
+
+ case "${1}" in
+ start)
+ # Start the daemon
+ su "${user}" -c "/Applications/VirtualBox.app/Contents/MacOS/VBoxAutostart --quiet --start --background --config ${CONFIG}"
+ ;;
+ stop)
+ # Stop the daemon
+ su "${user}" -c "/Applications/VirtualBox.app/Contents/MacOS/VBoxAutostart --quiet --stop --config ${CONFIG}"
+ ;;
+ *)
+ echo "Usage: start|stop"
+ exit 1
+ esac
+ done
+}
+
+function vboxStopAllUserVms()
+{
+ vboxStartStopAllUserVms "stop"
+}
+
+CONFIG=${1}
+vboxStartStopAllUserVms "start"
+trap vboxStopAllUserVms HUP KILL TERM
+
+
diff --git a/src/VBox/Installer/darwin/VirtualBox/org.virtualbox.vboxautostart.plist b/src/VBox/Installer/darwin/VirtualBox/org.virtualbox.vboxautostart.plist
new file mode 100644
index 00000000..ca0b770e
--- /dev/null
+++ b/src/VBox/Installer/darwin/VirtualBox/org.virtualbox.vboxautostart.plist
@@ -0,0 +1,19 @@
+<?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">
+<dict>
+ <key>Disabled</key>
+ <true/>
+ <key>Label</key>
+ <string>org.virtualbox.vboxautostart</string>
+ <key>ProgramArguments</key>
+ <array>
+ <string>/Applications/VirtualBox.app/Contents/MacOS/VBoxAutostartDarwin.sh</string>
+ <string>/etc/vbox/autostart.cfg</string>
+ </array>
+ <key>RunAtLoad</key>
+ <true/>
+ <key>LaunchOnlyOnce</key>
+ <true/>
+</dict>
+</plist>
diff --git a/src/VBox/Installer/darwin/VirtualBox/org.virtualbox.vboxballoonctrl.plist b/src/VBox/Installer/darwin/VirtualBox/org.virtualbox.vboxballoonctrl.plist
new file mode 100644
index 00000000..f70805f0
--- /dev/null
+++ b/src/VBox/Installer/darwin/VirtualBox/org.virtualbox.vboxballoonctrl.plist
@@ -0,0 +1,14 @@
+<?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">
+<dict>
+ <key>Disabled</key>
+ <true/>
+ <key>KeepAlive</key>
+ <false/>
+ <key>Label</key>
+ <string>org.virtualbox.vboxballoonctrl</string>
+ <key>Program</key>
+ <string>/Applications/VirtualBox.app/Contents/MacOS/VBoxBalloonCtrl</string>
+</dict>
+</plist>
diff --git a/src/VBox/Installer/darwin/VirtualBox/org.virtualbox.vboxwebsrv.plist b/src/VBox/Installer/darwin/VirtualBox/org.virtualbox.vboxwebsrv.plist
new file mode 100644
index 00000000..95cbf994
--- /dev/null
+++ b/src/VBox/Installer/darwin/VirtualBox/org.virtualbox.vboxwebsrv.plist
@@ -0,0 +1,26 @@
+<?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">
+<dict>
+ <key>Disabled</key>
+ <true/>
+ <key>KeepAlive</key>
+ <false/>
+ <key>Label</key>
+ <string>org.virtualbox.vboxwebsvc</string>
+ <key>Program</key>
+ <string>/Applications/VirtualBox.app/Contents/MacOS/vboxwebsrv</string>
+ <key>Sockets</key>
+ <dict>
+ <key>Listeners</key>
+ <dict>
+ <key>SockServiceName</key>
+ <string>18083</string>
+ <key>SockType</key>
+ <string>stream</string>
+ <key>SockFamily</key>
+ <string>IPv4</string>
+ </dict>
+ </dict>
+</dict>
+</plist>
diff --git a/src/VBox/Installer/darwin/VirtualBox/postflight b/src/VBox/Installer/darwin/VirtualBox/postflight
new file mode 100755
index 00000000..742ee221
--- /dev/null
+++ b/src/VBox/Installer/darwin/VirtualBox/postflight
@@ -0,0 +1,117 @@
+#!/bin/sh
+# $Id: postflight $
+## @file
+# Post installation 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
+#
+
+CPDIR="/bin/cp -f -R"
+INSTALL=/usr/bin/install
+
+
+#
+# Install the Python bindings
+#
+VBOX_INSTALL_PATH=/Applications/VirtualBox.app/Contents/MacOS
+PYTHON="python python2.3 python2.5 python2.6 python2.7"
+if [ -e "${VBOX_INSTALL_PATH}/sdk/installer/vboxapisetup.py" ]; then
+ for p in $PYTHON; do
+ # Install the python bindings if python is in the path
+ if [ "`\${p} -c 'print "test"' 2> /dev/null`" = "test" ]; then
+ echo 1>&2 "Python found: ${p}, installing bindings..."
+ # Pass install path via environment
+ export VBOX_INSTALL_PATH
+ /bin/sh -c "cd $VBOX_INSTALL_PATH/sdk/installer && ${p} vboxapisetup.py install"
+ /bin/sh -c "cd $VBOX_INSTALL_PATH/sdk/installer && ${p} vboxapisetup.py clean --all"
+ fi
+ done
+fi
+
+#
+# Install the vboxweb service file for launchd
+#
+VBOXWEBSRV="${VBOX_INSTALL_PATH}/org.virtualbox.vboxwebsrv.plist"
+VBOXWEBSRV_TRG="${HOME}/Library/LaunchAgents"
+if [ -e "${VBOXWEBSRV}" -a -e "${VBOXWEBSRV_TRG}" ]; then
+ echo "Installing vboxwebsrv launchd file to ${VBOXWEBSRV_TRG}"
+ if [ "x" != "x${USER}" ]; then
+ ${INSTALL} -S -o "${USER}" -m 0644 "${VBOXWEBSRV}" "${VBOXWEBSRV_TRG}/"
+ else
+ ${INSTALL} -S -m 0644 "${VBOXWEBSRV}" "${VBOXWEBSRV_TRG}/"
+ fi
+fi
+
+#
+# Install any custom files
+#
+DATAPATH="`/usr/bin/dirname "${0}"`/../../../../../.."
+if [ -d "${DATAPATH}/.custom" ]; then
+ echo 1>&2 "Copy ${DATAPATH}/.custom to ${VBOX_INSTALL_PATH}...";
+ ${CPDIR} "${DATAPATH}/.custom/" "${VBOX_INSTALL_PATH}/custom"
+fi
+
+#
+# Register our file extensions
+#
+LSREGISTER=/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister
+if [ -e "${LSREGISTER}" -a "x" != "x${USER}" ]; then
+ echo "Register file extensions for \"${USER}\""
+ /usr/bin/sudo -u "${USER}" ${LSREGISTER} -f /Applications/VirtualBox.app
+ /usr/bin/sudo -u "${USER}" ${LSREGISTER} -f /Applications/VirtualBox.app/Contents/Resources/vmstarter.app
+fi
+
+# Check environment.
+if [ "${INSTALLER_TEMP}x" == "x" ]; then
+ echo "Required environment variable INSTALLER_TEMP is missing. Aborting installation."
+ exit 1;
+fi
+
+# Restore previously installed Extension Packs (if any)
+if [ -d "${INSTALLER_TEMP}/ExtensionPacks" ]; then
+ cp -r "${INSTALLER_TEMP}/ExtensionPacks" "${VBOX_INSTALL_PATH}"
+ rm -rf "${INSTALLER_TEMP}/ExtensionPacks"
+fi
+
+#
+# Correct the ownership of the directories in case there
+# was an existing installation.
+#
+chown -R root:admin /Applications/VirtualBox.app
+
+#
+# Workaround for 10.11 beta 6 in which the above chown strips the set-uid-to-root bit.
+#
+SET_UID_BINARIES="MacOS/VBoxNetAdpCtl"
+SET_UID_BINARIES="${SET_UID_BINARIES} MacOS/VBoxHeadless MacOS/VBoxNetDHCP MacOS/VBoxNetNAT Resources/VirtualBoxVM.app/Contents/MacOS/VirtualBoxVM" # WITH_HARDENING
+for bin in ${SET_UID_BINARIES}; do
+ chmod u+s "/Applications/VirtualBox.app/Contents/${bin}"
+done
+
+# Install provisioning profile if present, needed by VBoxHeadless.
+if [ -f /Applications/VirtualBox.app/Contents/embedded.provisionprofile ]; then
+ profiles -i -F /Applications/VirtualBox.app/Contents/embedded.provisionprofile
+fi
+
+exit 0;
+
diff --git a/src/VBox/Installer/darwin/VirtualBox/preflight b/src/VBox/Installer/darwin/VirtualBox/preflight
new file mode 100755
index 00000000..b604ea63
--- /dev/null
+++ b/src/VBox/Installer/darwin/VirtualBox/preflight
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+#
+# 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
+
+# Check environment.
+if [ "x${INSTALLER_TEMP}" = "x" ]; then
+ echo "Required environment variable INSTALLER_TEMP is missing. Aborting installation."
+ exit 1;
+fi
+
+# Backup previously installed Extension Packs before
+# installation process will completely remove previously installed
+# VirtualBox distribution.
+EXTPACKS_ROOT_PATH="/Applications/VirtualBox.app/Contents/MacOS/ExtensionPacks"
+if [ -d "${EXTPACKS_ROOT_PATH}" ]; then
+ cp -r "${EXTPACKS_ROOT_PATH}" "${INSTALLER_TEMP}"
+fi
+
+exit 0;
diff --git a/src/VBox/Installer/darwin/VirtualBox_mpkg/Conclusion.html b/src/VBox/Installer/darwin/VirtualBox_mpkg/Conclusion.html
new file mode 100644
index 00000000..780149a6
--- /dev/null
+++ b/src/VBox/Installer/darwin/VirtualBox_mpkg/Conclusion.html
@@ -0,0 +1,7 @@
+<font face="sans-serif">
+
+<p>To start VirtualBox, go to your Applications folder and double click on the
+VirtualBox icon.</p>
+
+</font>
+
diff --git a/src/VBox/Installer/darwin/VirtualBox_mpkg/Conclusion.rtf b/src/VBox/Installer/darwin/VirtualBox_mpkg/Conclusion.rtf
new file mode 100644
index 00000000..09d3de53
--- /dev/null
+++ b/src/VBox/Installer/darwin/VirtualBox_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 To start VirtualBox, go to your Applications folder and double click on the VirtualBox icon.\
+} \ No newline at end of file
diff --git a/src/VBox/Installer/darwin/VirtualBox_mpkg/Localizable.strings b/src/VBox/Installer/darwin/VirtualBox_mpkg/Localizable.strings
new file mode 100644
index 00000000..b3cd4b3e
--- /dev/null
+++ b/src/VBox/Installer/darwin/VirtualBox_mpkg/Localizable.strings
@@ -0,0 +1,23 @@
+'VirtualBox_title' = '@VBOX_PRODUCT@';
+
+'choiceVBoxKEXTs_title' = '@VBOX_PRODUCT@ Kernel Extensions';
+'choiceVBoxKEXTs_msg' = 'Installs the @VBOX_PRODUCT@ Kernel Extensions into /Library/Application Support/VirtualBox.';
+
+'choiceVBox_title' = '@VBOX_PRODUCT@';
+'choiceVBox_msg' = 'Installs the @VBOX_PRODUCT@ application into /Applications.';
+
+'choiceVBoxCLI_title' = '@VBOX_PRODUCT@ Command Line Utilities';
+'choiceVBoxCLI_msg' = 'Installs the @VBOX_PRODUCT@ command line utilities into /usr/bin.';
+
+'choiceOSXFuseCore_title' = 'FUSE for macOS core package';
+'choiceOSXFuseCore_msg' = 'Installs the FUSE for macOS core package for the image mounter.';
+
+'RUNNING_VMS_TLE' = "Running VirtualBox virtual machines detected!";
+'RUNNING_VMS_MSG' = "The installer has detected running virtual machines. Please shut down all running VirtualBox machines and then restart the installation.";
+
+'UNSUPPORTED_HW_MACHINE_TLE' = "Unsupported hardware architecture detected!";
+'UNSUPPORTED_HW_MACHINE_MSG' = "The installer has detected an unsupported architecture. VirtualBox only runs on the amd64 architecture.";
+
+'UNSUPPORTED_OS_TLE' = "Unsupported OS version detected!";
+'UNSUPPORTED_OS_MSG' = "The installer has detected an unsupported operation system. VirtualBox requires Mac OS X 10.9 or later.";
+
diff --git a/src/VBox/Installer/darwin/VirtualBox_mpkg/Welcome.html b/src/VBox/Installer/darwin/VirtualBox_mpkg/Welcome.html
new file mode 100644
index 00000000..956c2504
--- /dev/null
+++ b/src/VBox/Installer/darwin/VirtualBox_mpkg/Welcome.html
@@ -0,0 +1,12 @@
+<font face="sans-serif">
+<h2>@VBOX_PRODUCT@ for macOS</h2>
+
+<p>Welcome to @VBOX_PRODUCT@
+@VBOX_VERSION_MAJOR@.@VBOX_VERSION_MINOR@.@VBOX_VERSION_BUILD@ for macOS!
+This installer will guide you through the installation process. In a minute
+from now, you will be able to execute virtual machines running different
+operating systems on your desktop. You will find that VirtualBox delivers a
+great feature set and excellent performance.</p>
+
+</font>
+
diff --git a/src/VBox/Installer/darwin/VirtualBox_mpkg/Welcome.rtf b/src/VBox/Installer/darwin/VirtualBox_mpkg/Welcome.rtf
new file mode 100644
index 00000000..4a8bbaf3
--- /dev/null
+++ b/src/VBox/Installer/darwin/VirtualBox_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@ for macOS
+\b0 \
+\pard\pardeftab720\sa240
+
+\fs24 \cf0 Welcome to @VBOX_PRODUCT@ @VBOX_VERSION_MAJOR@.@VBOX_VERSION_MINOR@.@VBOX_VERSION_BUILD@ for macOS! This installer will guide you through the installation process. In a minute from now, you will be able to execute virtual machines running different operating systems on your desktop. You will find that VirtualBox delivers a great feature set and excellent performance.\
+}
diff --git a/src/VBox/Installer/darwin/VirtualBox_mpkg/background.tif b/src/VBox/Installer/darwin/VirtualBox_mpkg/background.tif
new file mode 100644
index 00000000..9b99f142
--- /dev/null
+++ b/src/VBox/Installer/darwin/VirtualBox_mpkg/background.tif
Binary files differ
diff --git a/src/VBox/Installer/darwin/VirtualBox_mpkg/distribution-driverless.dist b/src/VBox/Installer/darwin/VirtualBox_mpkg/distribution-driverless.dist
new file mode 100644
index 00000000..7a963fb0
--- /dev/null
+++ b/src/VBox/Installer/darwin/VirtualBox_mpkg/distribution-driverless.dist
@@ -0,0 +1,107 @@
+<?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" rootVolumeOnly="true" hostArchitectures="@VBOX_ARCH_LIST@"/>
+ <installation-check script="checkPrerequisite()"></installation-check>
+ <domains enable_anywhere="false" enable_currentUserHome="false" enable_localSystem="true"/>
+ <script>
+//<![CDATA[
+ /* js:pkmk:start */
+ function checkPrerequisite()
+ {
+ try
+ {
+ test = system.version['ProductVersion'];
+ system.log("OS version detected: " + test);
+ result = (system.compareVersions(test, '10.9') >= 0);
+ } catch (e) { system.log(e); result = false; }
+
+ if (!result)
+ {
+ my.result.type = 'Fatal';
+ my.result.title = system.localizedString('UNSUPPORTED_OS_TLE');
+ my.result.message = system.localizedString('UNSUPPORTED_OS_MSG');
+ return result;
+ }
+
+ try
+ {
+ test = system.sysctl('hw.machine');
+ system.log("Hardware architecture detected: " + test);
+ result = (test == '@VBOX_TARGET_ARCH@');
+ } catch (e) { system.log(e); result = false; }
+
+ if (!result)
+ {
+ my.result.type = 'Fatal';
+ my.result.title = system.localizedString('UNSUPPORTED_HW_MACHINE_TLE');
+ my.result.message = system.localizedString('UNSUPPORTED_HW_MACHINE_MSG');
+ return result;
+ }
+
+ try
+ {
+ /* Embedded scripts are not available here. Instead, run command to check for running VMs or running VBOX instance */
+ runAppArr = system.applications.all()
+ for (let i = 0; i < runAppArr.length; i++)
+ {
+ if (runAppArr[i]["FileCreator"] == "VBOX" || runAppArr[i]["FileCreator"] == "VBVM")
+ {
+ result = false;
+ }
+ }
+ system.log("system.applications check => result=" + result);
+ } catch (e) { system.log(e); result = false; }
+
+ if (!result)
+ {
+
+ my.result.type = 'Fatal';
+ my.result.title = system.localizedString('RUNNING_VMS_TLE');
+ my.result.message = system.localizedString('RUNNING_VMS_MSG');
+ return result;
+ }
+
+ system.log("result:" + result);
+ return result;
+ }
+ /* 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="choiceVBox"></line>
+ <line choice="choiceVBoxCLI"></line>
+ </choices-outline>
+ <choice id="choiceVBox" title="choiceVBox_title" description="choiceVBox_msg" start_selected="true" start_enabled="false" start_visible="true">
+ <pkg-ref id="org.virtualbox.pkg.virtualbox"></pkg-ref>
+ </choice>
+ <choice id="choiceVBoxCLI" title="choiceVBoxCLI_title" description="choiceVBoxCLI_msg" start_selected="true" start_enabled="true" start_visible="true">
+ <pkg-ref id="org.virtualbox.pkg.virtualboxcli"></pkg-ref>
+ </choice>
+ <pkg-ref id="org.virtualbox.pkg.virtualbox" auth="Root">file:./Contents/Packages/VirtualBox.pkg</pkg-ref>
+ <pkg-ref id="org.virtualbox.pkg.virtualboxcli" auth="Root">file:./Contents/Packages/VirtualBoxCLI.pkg</pkg-ref>
+</installer-gui-script>
+
diff --git a/src/VBox/Installer/darwin/VirtualBox_mpkg/distribution.dist b/src/VBox/Installer/darwin/VirtualBox_mpkg/distribution.dist
new file mode 100644
index 00000000..bfa7cead
--- /dev/null
+++ b/src/VBox/Installer/darwin/VirtualBox_mpkg/distribution.dist
@@ -0,0 +1,117 @@
+<?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" rootVolumeOnly="true" hostArchitectures="@VBOX_ARCH_LIST@"/>
+ <installation-check script="checkPrerequisite()"></installation-check>
+ <domains enable_anywhere="false" enable_currentUserHome="false" enable_localSystem="true"/>
+ <script>
+//<![CDATA[
+ /* js:pkmk:start */
+ function checkPrerequisite()
+ {
+ try
+ {
+ test = system.version['ProductVersion'];
+ system.log("OS version detected: " + test);
+ result = (system.compareVersions(test, '10.9') >= 0);
+ } catch (e) { system.log(e); result = false; }
+
+ if (!result)
+ {
+ my.result.type = 'Fatal';
+ my.result.title = system.localizedString('UNSUPPORTED_OS_TLE');
+ my.result.message = system.localizedString('UNSUPPORTED_OS_MSG');
+ return result;
+ }
+
+ try
+ {
+ test = system.sysctl('hw.machine');
+ system.log("Hardware architecture detected: " + test);
+ result = (test == '@VBOX_TARGET_ARCH@');
+ } catch (e) { system.log(e); result = false; }
+
+ if (!result)
+ {
+ my.result.type = 'Fatal';
+ my.result.title = system.localizedString('UNSUPPORTED_HW_MACHINE_TLE');
+ my.result.message = system.localizedString('UNSUPPORTED_HW_MACHINE_MSG');
+ return result;
+ }
+
+ try
+ {
+ /* Embedded scripts are not available here. Instead, run command to check for running VMs or running VBOX instance */
+ runAppArr = system.applications.all()
+ for (let i = 0; i < runAppArr.length; i++)
+ {
+ if (runAppArr[i]["FileCreator"] == "VBOX" || runAppArr[i]["FileCreator"] == "VBVM")
+ {
+ result = false;
+ }
+ }
+ system.log("system.applications check => result=" + result);
+ } catch (e) { system.log(e); result = false; }
+
+ if (!result)
+ {
+
+ my.result.type = 'Fatal';
+ my.result.title = system.localizedString('RUNNING_VMS_TLE');
+ my.result.message = system.localizedString('RUNNING_VMS_MSG');
+ return result;
+ }
+
+ system.log("result:" + result);
+ return result;
+ }
+ /* 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="choiceVBoxKEXTs"></line>
+ <line choice="choiceVBox"></line>
+ <line choice="choiceVBoxCLI"></line>
+ <line choice="choiceOSXFuseCore"></line>
+ </choices-outline>
+ <choice id="choiceVBoxKEXTs" title="choiceVBoxKEXTs_title" description="choiceVBoxKEXTs_msg" start_selected="true" start_enabled="true" start_visible="true">
+ <pkg-ref id="org.virtualbox.pkg.vboxkexts"></pkg-ref>
+ </choice>
+ <choice id="choiceVBox" title="choiceVBox_title" description="choiceVBox_msg" start_selected="true" start_enabled="false" start_visible="true">
+ <pkg-ref id="org.virtualbox.pkg.virtualbox"></pkg-ref>
+ </choice>
+ <choice id="choiceVBoxCLI" title="choiceVBoxCLI_title" description="choiceVBoxCLI_msg" start_selected="true" start_enabled="true" start_visible="true">
+ <pkg-ref id="org.virtualbox.pkg.virtualboxcli"></pkg-ref>
+ </choice>
+ <choice id="choiceOSXFuseCore" title="choiceOSXFuseCore_title" description="choiceOSXFuseCore_msg" start_selected="true" start_enabled="true" start_visible="true">
+ <pkg-ref id="com.github.osxfuse.pkg.Core"></pkg-ref>
+ </choice>
+ <pkg-ref id="org.virtualbox.pkg.vboxkexts" auth="Root">file:./Contents/Packages/VBoxKEXTs.pkg</pkg-ref>
+ <pkg-ref id="org.virtualbox.pkg.virtualbox" auth="Root">file:./Contents/Packages/VirtualBox.pkg</pkg-ref>
+ <pkg-ref id="org.virtualbox.pkg.virtualboxcli" auth="Root">file:./Contents/Packages/VirtualBoxCLI.pkg</pkg-ref>
+ <pkg-ref id="com.github.osxfuse.pkg.Core" auth="Root">file:./Contents/Packages/OSXFuseCore.pkg</pkg-ref>
+</installer-gui-script>
+