summaryrefslogtreecommitdiffstats
path: root/src/VBox/Installer/solaris
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/solaris
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/solaris')
-rw-r--r--src/VBox/Installer/solaris/Makefile.kmk771
-rwxr-xr-xsrc/VBox/Installer/solaris/VBox.sh82
-rw-r--r--src/VBox/Installer/solaris/VBoxISAExec.c53
-rw-r--r--src/VBox/Installer/solaris/VBoxZoneAccess.c100
-rwxr-xr-xsrc/VBox/Installer/solaris/checkinstall.sh345
-rwxr-xr-xsrc/VBox/Installer/solaris/makepackage.sh307
-rwxr-xr-xsrc/VBox/Installer/solaris/pkginstall.sh70
-rwxr-xr-xsrc/VBox/Installer/solaris/postinstall.sh42
-rwxr-xr-xsrc/VBox/Installer/solaris/preremove.sh42
-rwxr-xr-xsrc/VBox/Installer/solaris/smf-vboxautostart.sh128
-rwxr-xr-xsrc/VBox/Installer/solaris/smf-vboxballoonctrl.sh121
-rwxr-xr-xsrc/VBox/Installer/solaris/smf-vboxwebsrv.sh146
-rw-r--r--src/VBox/Installer/solaris/vbox-ips.mog71
-rw-r--r--src/VBox/Installer/solaris/vbox.pkginfo16
-rw-r--r--src/VBox/Installer/solaris/vbox.pkgresponse12
-rw-r--r--src/VBox/Installer/solaris/vbox.space5
-rwxr-xr-xsrc/VBox/Installer/solaris/vboxconfig.sh1480
-rw-r--r--src/VBox/Installer/solaris/virtualbox-autostart.xml124
-rw-r--r--src/VBox/Installer/solaris/virtualbox-balloonctrl.xml124
-rw-r--r--src/VBox/Installer/solaris/virtualbox-webservice.xml125
-rw-r--r--src/VBox/Installer/solaris/virtualbox-zoneaccess.xml86
-rw-r--r--src/VBox/Installer/solaris/virtualbox.applications.in8
-rw-r--r--src/VBox/Installer/solaris/virtualbox.keys79
-rw-r--r--src/VBox/Installer/solaris/virtualbox.mime23
24 files changed, 4360 insertions, 0 deletions
diff --git a/src/VBox/Installer/solaris/Makefile.kmk b/src/VBox/Installer/solaris/Makefile.kmk
new file mode 100644
index 00000000..0af3c570
--- /dev/null
+++ b/src/VBox/Installer/solaris/Makefile.kmk
@@ -0,0 +1,771 @@
+# $Id: Makefile.kmk $
+## @file
+# Sub-Makefile for the Solaris installer.
+#
+
+#
+# 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
+#
+
+SUB_DEPTH = ../../../..
+include $(KBUILD_PATH)/subheader.kmk
+
+ifneq ($(KBUILD_HOST),solaris)
+ $(error "The Solaris installer can only be built on Solaris!") # yeah, right.
+endif
+
+
+#
+# Globals
+#
+VBOX_PATH_SOL_INST_SRC := $(PATH_SUB_CURRENT)
+VBOX_PATH_SI_SCRATCH := $(PATH_TARGET)/Installer-solaris
+VBOX_PATH_SI_SCRATCH_PKG := $(PATH_TARGET)/Installer-solaris/pkg
+VBOX_PATH_SI_SCRATCH_DBG := $(PATH_TARGET)/Installer-solaris/DebugPkg
+VBOX_SI_ARCH := $(subst x86,i386,$(KBUILD_TARGET_ARCH))
+VBOX_SI_ICON_TYPES := ova ovf vbox vbox-extpack vdi vmdk vhd hdd
+VBOX_SI_ICON_SIZES := 16 20 24 32 48 64 72 96 128 256
+VBOX_SI_GTAR := /usr/sfw/bin/gtar
+VBOX_SI_OBJCOPY_STRIP := /usr/sfw/bin/gobjcopy --strip-debug -R .comment
+ifeq ($(KBUILD_TARGET_ARCH),amd64)
+ VBOX_SI_OBJCOPY_DBGINFO := /usr/sfw/bin/gobjcopy --only-keep-debug
+else
+ VBOX_SI_OBJCOPY_DBGINFO := $(CP) -p # Solaris ld/gobjcopy(2.15) don't get along on x86, works only on amd64. So just using cp for now.
+endif
+
+# Unset this to speed up things during makefile hacking.
+VBOX_SI_DEP_ON_MAKEFILE := $(MAKEFILE_CURRENT)
+
+
+# Base package
+PKGINFO_ARCH = $(shell uname -p)
+PKGINFO_DATE = $(date %Y.%m.%d.%H.%M.%S)
+PKGINFO_REVSTAMP = $(PKGINFO_DATE).$(VBOX_SVN_REV)
+PKGINFO_PSTAMP = vbox_$(subst .,,$(PKGINFO_DATE))_r$(VBOX_SVN_REV)
+PKG_FILENAME := VirtualBox-$(VBOX_VERSION_STRING)-SunOS-$(KBUILD_TARGET_ARCH)-r$(VBOX_SVN_REV)
+
+# For Alpha, Beta, RC and releases VBOX_VERSION_STRING needs to be converted into the variant
+# which complies to Solaris 11 Image Packaging System (IPS) versioning convention. For GA release,
+# we add '.3.0' to the end of the version string in order to make its version look newer from
+# IPS point of view.
+VBOX_VERSION_SMF_STYLE := $(subst _ALPHA,.0.,$(VBOX_VERSION_STRING))
+VBOX_VERSION_SMF_STYLE := $(subst _BETA,.1.,$(VBOX_VERSION_SMF_STYLE))
+VBOX_VERSION_SMF_STYLE := $(subst _RC,.2.,$(VBOX_VERSION_SMF_STYLE))
+VBOX_VERSION_SMF_STYLE := $(if $(VBOX_VERSION_PRERELEASE),$(VBOX_VERSION_SMF_STYLE),$(VBOX_VERSION_SMF_STYLE).3.0)
+PKG_FILENAME_SMF_STYLE := VirtualBox-$(VBOX_VERSION_SMF_STYLE)-SunOS-$(KBUILD_TARGET_ARCH)-r$(VBOX_SVN_REV)
+
+#
+# Targets
+#
+PROGRAMS += VBoxZoneAccess VBoxISAExec
+INSTALLS += solaris-doc solaris-bin solaris-drv-confs solaris-icons
+BLDDIRS += $(VBOX_PATH_SI_SCRATCH)
+PACKING += \
+ $(PATH_STAGE_BIN)/$(PKG_FILENAME).tar.gz \
+ $(if $(VBOX_WITH_SOLARIS_IPS_PACKAGE),$(PATH_STAGE_BIN)/$(PKG_FILENAME_SMF_STYLE).p5p,) \
+ $(PATH_STAGE_BIN)/VirtualBoxDebug.tar.bz2
+OTHER_CLEAN += \
+ $(VBOX_PATH_SI_SCRATCH)/$(PKG_FILENAME).pkg \
+ $(PATH_STAGE_BIN)/$(PKG_FILENAME).tar.gz \
+ $(PATH_STAGE_BIN)/$(PKG_FILENAME_SMF_STYLE).p5p \
+ $(PATH_STAGE_BIN)/VirtualBoxDebug.tar.bz2 \
+ $(VBOX_PATH_SI_SCRATCH)/dist-copy.ts
+
+#
+# VBoxZoneAccess
+#
+VBoxZoneAccess_TEMPLATE = VBoxR3Exe
+VBoxZoneAccess_DEPS = $(VBOX_SVN_REV_KMK)
+VBoxZoneAccess_SOURCES = VBoxZoneAccess.c
+VBoxZoneAccess_LIBS = $(LIB_RUNTIME)
+
+#
+# VBoxISAExec
+#
+VBoxISAExec_TEMPLATE = VBoxR3Exe
+VBoxISAExec_DEPS = $(VBOX_SVN_REV_KMK)
+VBoxISAExec_SOURCES = VBoxISAExec.c
+
+#
+# Solaris installs.
+#
+solaris-doc_INST = bin/
+solaris-doc_MODE = a+r,u+w
+solaris-doc_SOURCES = \
+ $(VBOX_BRAND_LICENSE_TXT)=>LICENSE \
+ $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/$(if $(VBOX_OSE),OSE,NonOSE)/VirtualBox_64px.png=>VBox.png \
+ $(PATH_ROOT)/src/VBox/Artwork/$(if $(VBOX_OSE),OSE,NonOSE)/virtualbox-128px.png=>virtualbox.png
+
+solaris-bin_INST = bin/
+solaris-bin_MODE = a+rx,u+w
+solaris-bin_SOURCES = \
+ $(if $(VBOX_WITH_PYTHON),$(PATH_ROOT)/src/VBox/Frontends/VBoxShell/vboxshell.py,) \
+ $(VBOX_PATH_SOL_INST_SRC)/vboxconfig.sh \
+ $(VBOX_PATH_SOL_INST_SRC)/VBox.sh \
+ $(VBOX_PATH_SOL_INST_SRC)/pkginstall.sh \
+ $(VBOX_PATH_SOL_INST_SRC)/smf-vboxballoonctrl.sh \
+ $(VBOX_PATH_SOL_INST_SRC)/smf-vboxautostart.sh \
+ $(if $(VBOX_WITH_WEBSERVICES),$(VBOX_PATH_SOL_INST_SRC)/smf-vboxwebsrv.sh,)
+
+solaris-drv-confs_INST = bin/
+solaris-drv-confs_MODE = a+r,u+w
+solaris-drv-confs_SOURCES = \
+ $(PATH_ROOT)/src/VBox/HostDrivers/Support/solaris/vboxdrv.conf \
+ $(if $(VBOX_WITH_NETFLT),$(PATH_ROOT)/src/VBox/HostDrivers/VBoxNetFlt/solaris/vboxflt.conf) \
+ $(if $(VBOX_WITH_NETFLT_CROSSBOW),$(PATH_ROOT)/src/VBox/HostDrivers/VBoxNetFlt/solaris/vboxbow.conf) \
+ $(if $(VBOX_WITH_NETADP),$(PATH_ROOT)/src/VBox/HostDrivers/VBoxNetAdp/solaris/vboxnet.conf) \
+ $(if $(VBOX_WITH_USB),$(PATH_ROOT)/src/VBox/HostDrivers/VBoxUSB/solaris/vboxusbmon.conf) \
+ $(if $(VBOX_WITH_USB),$(PATH_ROOT)/src/VBox/HostDrivers/VBoxUSB/solaris/vboxusb.conf)
+
+solaris-icons_INST = bin/icons/
+solaris-icons_MODE = a+r,u+w
+solaris-icons_SOURCES = $(foreach f,$(VBOX_SI_ICON_TYPES), $(foreach s,$(VBOX_SI_ICON_SIZES) \
+ ,$(PATH_ROOT)/src/VBox/Artwork/other/virtualbox-$(f)-$(s)px.png=>$(s)x$(s)/mimetypes/virtualbox-$(f).png))
+
+
+#
+# What follows is various files lists (and a symlink list) that lists various
+# types of files going from/to various places during installation.
+#
+# Each list has the following attributes (used by makefile command and
+# dependency generation):
+# .SUBDIRS := <yes|no>
+# .STRIP := <yes|objcopy|no>
+# .MODE := <0644|0755>
+# .SRC := <Directory to copy the files from>
+# .DST := <Directory to copy the files to>
+#
+
+
+## List of file list variable names.
+SOLARIS_FILE_LIST_VARS :=
+
+## @def SOLARIS_ETC_FILES
+# System-wide configuration files to copy from VBOX_PATH_SOL_INST_SRC to /etc.
+SOLARIS_FILE_LIST_VARS += SOLARIS_ETC_FILES
+SOLARIS_ETC_FILES.SUBDIRS := yes
+SOLARIS_ETC_FILES.STRIP := no
+SOLARIS_ETC_FILES.MODE := 0644
+SOLARIS_ETC_FILES.SRC := $(PATH_ROOT)/src/VBox/HostDrivers/VBoxNetAdp/solaris
+SOLARIS_ETC_FILES.DST := $(VBOX_PATH_SI_SCRATCH_PKG)/etc
+SOLARIS_ETC_FILES := $(if-expr defined(VBOX_WITH_NETADP),hostname.vboxnet0,)
+
+## @def SOLARIS_SMF_FILES
+# Service management facility manifest files to copy from VBOX_PATH_SOL_INST_SRC to /var/svc/manifest/application/virtualbox/.
+SOLARIS_FILE_LIST_VARS += SOLARIS_SMF_FILES
+SOLARIS_SMF_FILES.SUBDIRS := yes
+SOLARIS_SMF_FILES.STRIP := no
+SOLARIS_SMF_FILES.MODE := 0644
+SOLARIS_SMF_FILES.SRC := $(VBOX_PATH_SOL_INST_SRC)
+SOLARIS_SMF_FILES.DST := $(VBOX_PATH_SI_SCRATCH_PKG)/var/svc/manifest/application/virtualbox
+SOLARIS_SMF_FILES = \
+ virtualbox-zoneaccess.xml \
+ virtualbox-balloonctrl.xml \
+ virtualbox-autostart.xml \
+ $(if-expr defined(VBOX_WITH_WEBSERVICES),virtualbox-webservice.xml,)
+
+## @def SOLARIS_MIME_INFO_FILES
+# MIME info files to be copied directly from VBOX_PATH_SOL_INST_SRC to /usr/share/mime-info/.
+SOLARIS_FILE_LIST_VARS += SOLARIS_MIME_INFO_FILES
+SOLARIS_MIME_INFO_FILES.SUBDIRS := yes
+SOLARIS_MIME_INFO_FILES.STRIP := no
+SOLARIS_MIME_INFO_FILES.MODE := 0644
+SOLARIS_MIME_INFO_FILES.SRC := $(VBOX_PATH_SOL_INST_SRC)
+SOLARIS_MIME_INFO_FILES.DST := $(VBOX_PATH_SI_SCRATCH_PKG)/usr/share/mime-info
+SOLARIS_MIME_INFO_FILES = \
+ virtualbox.keys \
+ virtualbox.mime
+
+## @def SOLARIS_PIXMAP_FILES
+# Bitmap files to copy directly from INST_BIN to /usr/share/pixmaps/.
+SOLARIS_FILE_LIST_VARS += SOLARIS_PIXMAP_FILES
+SOLARIS_PIXMAP_FILES.SUBDIRS = no
+SOLARIS_PIXMAP_FILES.STRIP = no
+SOLARIS_PIXMAP_FILES.MODE = 0644
+SOLARIS_PIXMAP_FILES.SRC = $(PATH_STAGE_BIN)
+SOLARIS_PIXMAP_FILES.DST = $(VBOX_PATH_SI_SCRATCH_PKG)/usr/share/pixmaps
+SOLARIS_PIXMAP_FILES = \
+ VBox.png \
+ virtualbox.png
+
+
+## @def SOLARIS_INSTALLER_SCRIPTS
+# Installer shell scripts that gets copied directly from VBOX_PATH_SOL_INST_SRC to VBOX_PATH_SI_SCRATCH_PKG (/).
+SOLARIS_FILE_LIST_VARS += SOLARIS_INSTALLER_SCRIPTS
+SOLARIS_INSTALLER_SCRIPTS.SUBDIRS = no
+SOLARIS_INSTALLER_SCRIPTS.STRIP = no
+SOLARIS_INSTALLER_SCRIPTS.MODE = 0755
+SOLARIS_INSTALLER_SCRIPTS.SRC = $(VBOX_PATH_SOL_INST_SRC)
+SOLARIS_INSTALLER_SCRIPTS.DST = $(VBOX_PATH_SI_SCRATCH_PKG)
+SOLARIS_INSTALLER_SCRIPTS = \
+ postinstall.sh \
+ checkinstall.sh \
+ preremove.sh \
+ makepackage.sh
+
+## @def SOLARIS_INSTALLER_FILES
+# Installer files that gets copied directly from VBOX_PATH_SOL_INST_SRC to VBOX_PATH_SI_SCRATCH_PKG (/).
+SOLARIS_FILE_LIST_VARS += SOLARIS_INSTALLER_FILES
+SOLARIS_INSTALLER_FILES.SUBDIRS = no
+SOLARIS_INSTALLER_FILES.STRIP = no
+SOLARIS_INSTALLER_FILES.MODE = 0644
+SOLARIS_INSTALLER_FILES.SRC = $(VBOX_PATH_SOL_INST_SRC)
+SOLARIS_INSTALLER_FILES.DST = $(VBOX_PATH_SI_SCRATCH_PKG)
+SOLARIS_INSTALLER_FILES = \
+ vbox.space
+
+## @def SOLARIS_INSTALLER_LICENSE
+# List of files that are copied directly from INST_BIN to VBOX_PATH_SI_SCRATCH_PKG (/).
+# LICENSE is needed by IPS packaging only.
+SOLARIS_FILE_LIST_VARS += SOLARIS_INSTALLER_LICENSE
+SOLARIS_INSTALLER_LICENSE.SUBDIRS := no
+SOLARIS_INSTALLER_LICENSE.STRIP := no
+SOLARIS_INSTALLER_LICENSE.MODE := 0644
+SOLARIS_INSTALLER_LICENSE.SRC := $(PATH_STAGE_BIN)
+SOLARIS_INSTALLER_LICENSE.DST := $(VBOX_PATH_SI_SCRATCH_PKG)
+SOLARIS_INSTALLER_LICENSE = \
+ LICENSE
+
+## @def SOLARIS_DRIVER_BINS
+# List of kernel module files that are copied from INST_BIN to platform/i86pc/kernel/drv/[amd64/] and stripped of debug info.
+SOLARIS_FILE_LIST_VARS += SOLARIS_DRIVER_BINS
+SOLARIS_DRIVER_BINS.SUBDIRS := no
+SOLARIS_DRIVER_BINS.STRIP := no
+SOLARIS_DRIVER_BINS.MODE := 0644
+SOLARIS_DRIVER_BINS.SRC := $(PATH_STAGE_BIN)
+SOLARIS_DRIVER_BINS.DST := $(VBOX_PATH_SI_SCRATCH_PKG)/platform/i86pc/kernel/drv/$(subst x86,,$(KBUILD_TARGET_ARCH))
+SOLARIS_DRIVER_BINS = \
+ vboxdrv \
+ $(if $(VBOX_WITH_NETFLT),vboxflt,) \
+ $(if $(VBOX_WITH_NETFLT_CROSSBOW),vboxbow,) \
+ $(if $(VBOX_WITH_NETADP),vboxnet,) \
+ $(if $(VBOX_WITH_USB),vboxusbmon,) \
+ $(if $(VBOX_WITH_USB),vboxusb,)
+
+## @def SOLARIS_DRIVER_CONFS
+# List of kernel module configuration files that are copied directly from INST_BIN to platform/i86pc/kernel/drv/.
+SOLARIS_FILE_LIST_VARS += SOLARIS_DRIVER_CONFS
+SOLARIS_DRIVER_CONFS.SUBDIRS := no
+SOLARIS_DRIVER_CONFS.STRIP := no
+SOLARIS_DRIVER_CONFS.MODE := 0644
+SOLARIS_DRIVER_CONFS.SRC := $(PATH_STAGE_BIN)
+SOLARIS_DRIVER_CONFS.DST := $(VBOX_PATH_SI_SCRATCH_PKG)/platform/i86pc/kernel/drv
+SOLARIS_DRIVER_CONFS = \
+ vboxdrv.conf \
+ $(if $(VBOX_WITH_NETFLT),vboxflt.conf,) \
+ $(if $(VBOX_WITH_NETFLT_CROSSBOW),vboxbow.conf,) \
+ $(if $(VBOX_WITH_NETADP),vboxnet.conf,) \
+ $(if $(VBOX_WITH_USB),vboxusbmon.conf,) \
+ $(if $(VBOX_WITH_USB),vboxusb.conf,)
+
+## @def SOLARIS_COMMON
+# List of files that are copied directly from INST_BIN to /opt/VirtualBox/.
+SOLARIS_FILE_LIST_VARS += SOLARIS_COMMON
+SOLARIS_COMMON.SUBDIRS := yes
+SOLARIS_COMMON.STRIP := no
+SOLARIS_COMMON.MODE := 0644
+SOLARIS_COMMON.SRC := $(PATH_STAGE_BIN)
+SOLARIS_COMMON.DST := $(VBOX_PATH_SI_SCRATCH_PKG)/opt/VirtualBox
+SOLARIS_COMMON = \
+ LICENSE
+
+## @def SOLARIS_COMMON_EXES
+# List of executable script (and VBoxISAExec) files that are copied directly from INST_BIN to /opt/VirtualBox/.
+SOLARIS_FILE_LIST_VARS += SOLARIS_COMMON_EXES
+SOLARIS_COMMON_EXES.SUBDIRS := no
+SOLARIS_COMMON_EXES.STRIP := no
+SOLARIS_COMMON_EXES.MODE := 0755
+SOLARIS_COMMON_EXES.SRC := $(PATH_STAGE_BIN)
+SOLARIS_COMMON_EXES.DST := $(VBOX_PATH_SI_SCRATCH_PKG)/opt/VirtualBox
+SOLARIS_COMMON_EXES = \
+ VBoxISAExec
+
+## @def SOLARIS_COMMON_BINS
+# List of INST_BIN shared libraries that should be copied into /opt/VirtualBox/ and stripped.
+SOLARIS_FILE_LIST_VARS += SOLARIS_COMMON_STRIP_BINS
+SOLARIS_COMMON_STRIP_BINS.SUBDIRS := yes
+SOLARIS_COMMON_STRIP_BINS.STRIP := yes
+SOLARIS_COMMON_STRIP_BINS.MODE := 0644
+SOLARIS_COMMON_STRIP_BINS.SRC := $(PATH_STAGE_BIN)
+SOLARIS_COMMON_STRIP_BINS.DST := $(VBOX_PATH_SI_SCRATCH_PKG)/opt/VirtualBox/
+SOLARIS_COMMON_STRIP_BINS =
+
+## @def SOLARIS_STRIP_EXES
+# List of exectuables files that are copied from INST_BIN to /opt/VirtualBox/$(VBOX_SI_ARCH)/ and stripped of debug info.
+SOLARIS_FILE_LIST_VARS += SOLARIS_STRIP_EXES
+SOLARIS_STRIP_EXES.SUBDIRS := no
+SOLARIS_STRIP_EXES.STRIP := yes
+SOLARIS_STRIP_EXES.MODE := 0755
+SOLARIS_STRIP_EXES.SRC := $(PATH_STAGE_BIN)
+SOLARIS_STRIP_EXES.DST := $(VBOX_PATH_SI_SCRATCH_PKG)/opt/VirtualBox/$(VBOX_SI_ARCH)
+SOLARIS_STRIP_EXES = \
+ VBoxZoneAccess \
+ $(if $(VBOX_WITH_QTGUI),VirtualBox VirtualBoxVM,) \
+ VBoxManage \
+ $(if $(VBOX_WITH_VBOXSDL),VBoxSDL,) \
+ $(if $(VBOX_WITH_NETADP),VBoxNetAdpCtl,) \
+ VBoxNetDHCP \
+ VBoxNetNAT \
+ $(if $(VBOX_WITH_EXTPACK),VBoxExtPackHelperApp,) \
+ VBoxSVC \
+ $(if $(VBOX_WITH_VMSVGA3D), VBoxTestOGL,) \
+ VBoxXPCOMIPCD \
+ $(if $(VBOX_WITH_DTRACE),VBoxDTrace,) \
+ $(if $(VBOX_WITH_HOST_SHIPPING_AUDIO_TEST),VBoxAudioTest,)
+
+## @def SOLARIS_STRIP_BINS
+# List of shared libraries that are copied from INST_BIN to /opt/VirtualBox/$(VBOX_SI_ARCH)/ and stripped of debug info.
+SOLARIS_FILE_LIST_VARS += SOLARIS_STRIP_BINS
+SOLARIS_STRIP_BINS.SUBDIRS := yes
+SOLARIS_STRIP_BINS.STRIP := yes
+SOLARIS_STRIP_BINS.MODE := 0644
+SOLARIS_STRIP_BINS.SRC := $(PATH_STAGE_BIN)
+SOLARIS_STRIP_BINS.DST := $(VBOX_PATH_SI_SCRATCH_PKG)/opt/VirtualBox/$(VBOX_SI_ARCH)
+SOLARIS_STRIP_BINS = \
+ VBoxDD.so \
+ VBoxDD2.so \
+ VBoxRT.so \
+ VBoxDDU.so \
+ VBoxVMM.so \
+ $(if $(VBOX_WITH_LIBSSH),VBoxLibSsh.so,) \
+ VBoxXPCOM.so \
+ VBoxXPCOMC.so \
+ $(if $(VBOX_WITH_SHARED_FOLDERS),VBoxSharedFolders.so,) \
+ $(if $(VBOX_WITH_SHARED_CLIPBOARD),VBoxSharedClipboard.so,) \
+ $(if $(VBOX_WITH_DRAG_AND_DROP),VBoxDragAndDropSvc.so,) \
+ $(if $(VBOX_WITH_GUEST_PROPS),VBoxGuestPropSvc.so,) \
+ $(if $(VBOX_WITH_GUEST_CONTROL),VBoxGuestControlSvc.so,) \
+ VBoxHostChannel.so \
+ $(if $(VBOX_WITH_JXPCOM),libvboxjxpcom.so,) \
+ $(if $(VBOX_WITH_QTGUI), \
+ VBoxKeyboard.so) \
+ $(if $(VBOX_WITH_DEBUGGER_GUI),VBoxDbg.so DbgPlugInDiggers.so,) \
+ components/VBoxC.so \
+ components/VBoxSVCM.so \
+ components/VBoxXPCOMIPCC.so
+
+ifdef VBOX_WITH_QTGUI
+ ifdef VBOX_WITH_ORACLE_QT
+ SOLARIS_STRIP_BINS += \
+ $(notdir $(wildcard $(PATH_STAGE_BIN)/lib*VBox*)) \
+ $(VBOX_QT_PLUGINS)
+ endif
+endif #VBOX_WITH_QTGUI
+
+ifdef VBOX_WITH_32_ON_64_MAIN_API
+ SOLARIS_STRIP_BINS += \
+ VBoxRT-x86.so \
+ VBoxXPCOM-x86.so \
+ components/VBoxClient-x86.so \
+ components/VBoxSVCM-x86.so \
+ components/VBoxXPCOMIPCC-x86.so
+endif
+ifdef VBOX_WITH_HARDENING
+ SOLARIS_STRIP_BINS += \
+ VBoxNetDHCP.so \
+ VBoxNetNAT.so \
+ $(if $(VBOX_WITH_VBOXSDL),VBoxSDL.so,) \
+ $(if $(VBOX_WITH_QTGUI),VirtualBoxVM.so UICommon.so,)
+endif
+
+## @def SOLARIS_STRIP_OBJS
+# List of relocable object files to be copied from INST_BIN to /opt/VirtualBox/$(VBOX_SI_ARCH)/ and carefully
+# stripped of debug info but not relocation information. These are the ring-0 and raw-mode context modules.
+SOLARIS_FILE_LIST_VARS += SOLARIS_STRIP_OBJS
+SOLARIS_STRIP_OBJS.SUBDIRS := no
+SOLARIS_STRIP_OBJS.STRIP := objcopy
+SOLARIS_STRIP_OBJS.MODE := 0644
+SOLARIS_STRIP_OBJS.SRC := $(PATH_STAGE_BIN)
+SOLARIS_STRIP_OBJS.DST := $(VBOX_PATH_SI_SCRATCH_PKG)/opt/VirtualBox/$(VBOX_SI_ARCH)
+SOLARIS_STRIP_OBJS = \
+ VBoxDDR0.r0 \
+ VMMR0.r0
+ifdef VBOX_WITH_RAW_MODE
+ SOLARIS_STRIP_OBJS += \
+ VBoxDDRC.rc \
+ VMMRC.rc
+endif
+
+## @def SOLARIS_NO_STRIP
+# List of data files that should be copied from INST_BIN to /opt/VirtualBox/$(VBOX_SI_ARCH)/.
+SOLARIS_FILE_LIST_VARS += SOLARIS_NO_STRIP
+SOLARIS_NO_STRIP.SUBDIRS := yes
+SOLARIS_NO_STRIP.STRIP := no
+SOLARIS_NO_STRIP.MODE := 0644
+SOLARIS_NO_STRIP.SRC := $(PATH_STAGE_BIN)
+SOLARIS_NO_STRIP.DST := $(VBOX_PATH_SI_SCRATCH_PKG)/opt/VirtualBox/$(VBOX_SI_ARCH)
+SOLARIS_NO_STRIP = \
+ components/VBoxXPCOMBase.xpt \
+ components/VirtualBox_XPCOM.xpt \
+ $(if $(and $(VBOX_LICENSE_FILES),$(VBOX_WITH_QTGUI)),$(VBOX_LICENSE_FILES))
+
+## @def SOLARIS_USRBIN_LINKS
+# List of links to create in /usr/bin to /opt/VirtualBox/VBox.sh.
+# Naturally no subdirectories.
+SOLARIS_USRBIN_LINKS = \
+ $(if $(VBOX_WITH_QTGUI),VirtualBox VirtualBoxVM,) \
+ $(if $(VBOX_WITH_HEADLESS),VBoxHeadless,) \
+ $(if $(VBOX_WITH_VBOXSDL),VBoxSDL,) \
+ VBoxManage \
+ $(if $(VBOX_WITH_DTRACE),VBoxDTrace,) \
+ $(if $(VBOX_WITH_HOST_SHIPPING_AUDIO_TEST),VBoxAudioTest,)
+
+SOLARIS_COMMON_EXES += \
+ vboxconfig.sh \
+ VBox.sh \
+ pkginstall.sh \
+ smf-vboxballoonctrl.sh \
+ smf-vboxautostart.sh \
+ $(if $(VBOX_WITH_WEBSERVICES),smf-vboxwebsrv.sh,)
+
+
+# Documentation (packed as DOCS as they are arch. neutral)
+ifdef VBOX_WITH_DOCS_PACKING
+ SOLARIS_COMMON += \
+ $(if-expr defined(VBOX_WITH_DOCS_CHM_PACKING),VirtualBox.chm,) \
+ $(if-expr defined(VBOX_WITH_DOCS_QHELP_PACKING),UserManual.qch UserManual.qhc,) \
+ UserManual.pdf \
+ $(foreach f,$(VBOX_MANUAL_ADD_LANGUAGES), \
+ $(if-expr defined(VBOX_WITH_DOCS_CHM_PACKING),VirtualBox_$(f).chm,) \
+ $(if-expr defined(VBOX_WITH_DOCS_QHELP_PACKING),UserManual_$(f).qch UserManual_$(f).qhc,) \
+ UserManual_$(f).pdf)
+endif
+
+# Python XPCOM glue
+ifdef VBOX_WITH_PYTHON
+ SOLARIS_COMMON += \
+ $(VBOXINST_SDK_BINDINGS_XPCOM_PYTHON_FILES) \
+ $(VBOXINST_SDK_INSTALLER_PYTHON_FILES)
+ ifeq ($(KBUILD_TARGET_ARCH),amd64)
+ SOLARIS_PYTHON_32_ON_64_BINS = $(notdir $(wildcard $(PATH_STAGE_BIN)/VBoxPython*_x86.so))
+ ifdef VBOX_WITH_32_ON_64_MAIN_API
+ SOLARIS_COMMON_STRIP_BINS += $(SOLARIS_PYTHON_32_ON_64_BINS)
+ endif
+ SOLARIS_COMMON_STRIP_BINS += $(filter-out $(SOLARIS_PYTHON_32_ON_64_BINS), $(notdir $(wildcard $(PATH_STAGE_BIN)/VBoxPython*.so)))
+ else
+ SOLARIS_COMMON_STRIP_BINS += $(notdir $(wildcard $(PATH_STAGE_BIN)/VBoxPython*.so)))
+ endif
+endif
+
+ifdef VBOX_WITH_JXPCOM
+ SOLARIS_COMMON += \
+ sdk/bindings/xpcom/java/vboxjxpcom.jar
+endif
+
+# auth stuff
+SOLARIS_STRIP_BINS += \
+ VBoxAuth.so \
+ VBoxAuthSimple.so
+
+# VRDP
+ifdef VBOX_WITH_VRDP
+ ifndef VBOX_WITH_EXTPACK_PUEL
+ SOLARIS_STRIP_BINS += \
+ VBoxVRDP.so
+ endif
+endif
+
+SOLARIS_STRIP_BINS += \
+ $(if $(and $(VBOX_WITH_HARDENING),$(VBOX_WITH_HEADLESS)),VBoxHeadless.so,)
+
+SOLARIS_STRIP_EXES += \
+ $(if $(VBOX_WITH_HEADLESS),VBoxHeadless) \
+ VBoxBugReport \
+ VBoxBalloonCtrl \
+ VBoxAutostart \
+ $(if $(VBOX_WITH_WEBSERVICES),vboxwebsrv) \
+ $(if $(VBOX_WITH_VBOX_IMG)$(VBOX_WITH_TESTCASES),vbox-img)
+
+# Guest Additions
+ifdef VBOX_WITH_ADDITIONS_PACKING
+ # SOLARIS_COMMON += \
+ # additions/VBoxGuestAdditions.iso
+endif
+
+
+# EFI firmware
+ifdef VBOX_WITH_EFIFW_PACKING
+ SOLARIS_COMMON += \
+ VBoxEFI32.fd \
+ VBoxEFI64.fd
+endif
+
+# Unattended installation template scripts.
+ifdef VBOX_UNATTENDED_TEMPLATES
+ SOLARIS_COMMON += $(addprefix UnattendedTemplates/,$(VBOX_UNATTENDED_TEMPLATES))
+endif
+
+# DTrace library, testcase and scripts (as the rest of this file, this makes bold
+# ASSUMPTIONS about VBPX_INST_XXX variable values).
+ifdef VBOX_WITH_DTRACE
+ SOLARIS_COMMON += \
+ $(addprefix dtrace/lib/$(KBUILD_TARGET_ARCH)/,$(VBOXINST_DTRACE_LIB_ARCH_FILES)) \
+ $(addprefix dtrace/testcase/$(KBUILD_TARGET_ARCH)/,$(VBOXINST_DTRACE_TESTCASE_ARCH_FILES)) \
+ $(addprefix dtrace/scripts/,$(VBOXINST_DTRACE_SCRIPTS_FILES))
+endif
+
+
+#
+# End of file lists.
+#
+
+
+
+include $(FILE_KBUILD_SUB_FOOTER)
+
+
+#
+# Copy all files needed for packaging into the final directory structure
+#
+$(VBOX_PATH_SI_SCRATCH)/dist-copy.ts: \
+ $(VBOX_VERSION_STAMP) \
+ \
+ $(VBOX_PATH_INST_COMMON_SRC)/virtualbox.desktop.in \
+ $(VBOX_PATH_INST_COMMON_SRC)/virtualboxvm.desktop.in \
+ $(VBOX_PATH_INST_COMMON_SRC)/virtualbox.xml \
+ $(VBOX_PATH_SOL_INST_SRC)/virtualbox.applications.in \
+ $(VBOX_PATH_SOL_INST_SRC)/vbox.pkginfo \
+ $(VBOX_PATH_SOL_INST_SRC)/vbox-ips.mog \
+ \
+ $(if-expr defined(VBOX_WITH_ADDITIONS_PACKING),$(PATH_STAGE_BIN)/additions/VBoxGuestAdditions.iso,) \
+ $(if-expr !defined(VBOX_OSE) && defined(VBOX_WITH_VBOXSDL), $(KBUILD_DEVTOOLS_TRG)/libsdl/v1.2.13/lib/libSDL-1.2.so.0.11.2,) \
+ \
+ $(foreach var, $(SOLARIS_FILE_LIST_VARS),$(foreach file, $($(var)), $($(var).SRC)/$(file))) \
+ \
+ $(foreach size, $(VBOX_SI_ICON_SIZES), $(foreach type, $(VBOX_SI_ICON_TYPES) \
+ ,$(PATH_ROOT)/src/VBox/Artwork/other/virtualbox-$(type)-$(size)px.png)) \
+ \
+ $(VBOX_SI_DEP_ON_MAKEFILE) \
+ | $$(dir $$@)
+ $(call MSG_L1,Copying files to package staging area)
+# Start with a clean slate, don't want to pick up random garbage.
+ $(RM) -Rf -- "$(VBOX_PATH_SI_SCRATCH_PKG)/"
+ $(QUIET)$(RM) -f -- "$@"
+
+# Create all the directories we need. We specify each sub directory to make sure the mode is correct.
+ $(MKDIR) -p -m 0755 -- $(sort $(VBOX_PATH_SI_SCRATCH_PKG)/ \
+ $(VBOX_PATH_SI_SCRATCH_PKG)/opt/ \
+ $(VBOX_PATH_SI_SCRATCH_PKG)/opt/VirtualBox/ \
+ $(VBOX_PATH_SI_SCRATCH_PKG)/opt/VirtualBox/amd64/ \
+ $(VBOX_PATH_SI_SCRATCH_PKG)/platform/ \
+ $(VBOX_PATH_SI_SCRATCH_PKG)/platform/i86pc/ \
+ $(VBOX_PATH_SI_SCRATCH_PKG)/platform/i86pc/kernel/ \
+ $(VBOX_PATH_SI_SCRATCH_PKG)/platform/i86pc/kernel/drv/ \
+ $(VBOX_PATH_SI_SCRATCH_PKG)/usr/ \
+ $(VBOX_PATH_SI_SCRATCH_PKG)/usr/bin/ \
+ $(VBOX_PATH_SI_SCRATCH_PKG)/usr/share/ \
+ $(VBOX_PATH_SI_SCRATCH_PKG)/usr/share/applications/ \
+ $(VBOX_PATH_SI_SCRATCH_PKG)/usr/share/application-registry/ \
+ $(VBOX_PATH_SI_SCRATCH_PKG)/usr/share/icons/ \
+ $(VBOX_PATH_SI_SCRATCH_PKG)/usr/share/icons/hicolor/ \
+ $(foreach size, $(VBOX_SI_ICON_SIZES) \
+ ,$(VBOX_PATH_SI_SCRATCH_PKG)/usr/share/icons/hicolor/$(size)x$(size)/ \
+ $(VBOX_PATH_SI_SCRATCH_PKG)/usr/share/icons/hicolor/$(size)x$(size)/mimetypes/) \
+ $(VBOX_PATH_SI_SCRATCH_PKG)/usr/share/mime/ \
+ $(VBOX_PATH_SI_SCRATCH_PKG)/usr/share/mime/packages/ \
+ $(VBOX_PATH_SI_SCRATCH_PKG)/var/ \
+ $(VBOX_PATH_SI_SCRATCH_PKG)/var/svc/ \
+ $(VBOX_PATH_SI_SCRATCH_PKG)/var/svc/manifest/ \
+ $(VBOX_PATH_SI_SCRATCH_PKG)/var/svc/manifest/application/ \
+ $(foreach var,$(SOLARIS_FILE_LIST_VARS), $($(var).DST)/) \
+ $(foreach var,$(SOLARIS_FILE_LIST_VARS),$(if-expr "$($(var).SUBDIRS)" == "yes",$(sort $(dir $(addprefix $($(var).DST)/,$($(var))))),)) \
+ )
+
+# Generic copy file lists.
+ $(foreach var, $(SOLARIS_FILE_LIST_VARS), $(foreach file, $($(var)) \
+ ,$(if-expr "$($(var).STRIP)" == "objcopy" && defined(VBOX_DO_STRIP)\
+ ,$(NLTAB)$(VBOX_SI_OBJCOPY_STRIP) "$($(var).SRC)/$(file)" "$($(var).DST)/$(file)" \
+ $(NLTAB)$(CHMOD) "$($(var).MODE)" "$($(var).DST)/$(file)" \
+ ,$(NLTAB)$(INSTALL) -m "$($(var).MODE)" $(if-expr "$($(var).STRIP)" == "yes" && defined(VBOX_DO_STRIP),-s,) \
+ "$($(var).SRC)/$(file)" "$($(var).DST)/$(file)")))
+
+# VirtualBox: Common files.
+ $(if-expr defined(VBOX_WITH_ADDITIONS_PACKING) \
+ ,$(INSTALL) -m 0644 $(PATH_STAGE_BIN)/additions/VBoxGuestAdditions.iso $(VBOX_PATH_SI_SCRATCH_PKG)/opt/VirtualBox/,)
+ $(LN_SYMLINK) -f ./pkginstall.sh $(VBOX_PATH_SI_SCRATCH_PKG)/opt/VirtualBox/ipsinstall.sh
+ $(SED) -e "s/_HARDENED_/$(if $(VBOX_WITH_HARDENED),hardened,)/" \
+ --output $(VBOX_PATH_SI_SCRATCH_PKG)/opt/VirtualBox/vboxconfig.sh \
+ $(VBOX_PATH_SOL_INST_SRC)/vboxconfig.sh
+ $(CHMOD) 0755 $(VBOX_PATH_SOL_INST_SRC)/vboxconfig.sh
+ $(INSTALL) -m 0644 $(VBOX_PATH_SOL_INST_SRC)/vbox.pkgresponse $(VBOX_PATH_SI_SCRATCH_PKG)/opt/VirtualBox/autoresponse
+ $(if-expr defined(VBOX_WITH_PYTHON) \
+ ,$(SED) -e "s@^#!.*@#!/usr/bin/python3@" \
+ --output $(VBOX_PATH_SI_SCRATCH_PKG)/opt/VirtualBox/vboxshell.py \
+ $(PATH_STAGE_BIN)/vboxshell.py \
+ $(NLTAB)$(CHMOD) 0755 $(VBOX_PATH_SI_SCRATCH_PKG)/opt/VirtualBox/vboxshell.py,)
+
+# VirtualBox: Arch specific files.
+ $(if-expr defined(VBOX_WITH_ADDITIONS_PACKING) \
+ ,$(NLTAB)$(LN_SYMLINK) ../VBoxGuestAdditions.iso $(VBOX_PATH_SI_SCRATCH_PKG)/opt/VirtualBox/$(VBOX_SI_ARCH)/,)
+
+ $(if-expr !defined(VBOX_OSE) && defined(VBOX_WITH_VBOXSDL) \
+ ,$(INSTALL) -s -m 0644 $(KBUILD_DEVTOOLS_TRG)/libsdl/v1.2.13/lib/libSDL-1.2.so.0.11.2 \
+ $(VBOX_PATH_SI_SCRATCH_PKG)/opt/VirtualBox/$(VBOX_SI_ARCH)/libSDL-1.2.so.0,)
+
+ $(if-expr defined(VBOX_WITH_EFIFW_PACKING) \
+ ,$(LN_SYMLINK) ../VBoxEFI32.fd ../VBoxEFI64.fd $(VBOX_PATH_SI_SCRATCH_PKG)/opt/VirtualBox/$(VBOX_SI_ARCH)/,)
+
+# Links to /usr/bin.
+ $(foreach link,$(SOLARIS_USRBIN_LINKS) \
+ ,$(NLTAB)$(LN_SYMLINK) ../../opt/VirtualBox/VBox.sh $(VBOX_PATH_SI_SCRATCH_PKG)/usr/bin/$(link))
+
+# Desktop stuff in /usr/share/applications/.
+ $(SED) -e "s+@VBOX_PRODUCT@+$(VBOX_PRODUCT)+" \
+ --output $(VBOX_PATH_SI_SCRATCH_PKG)/usr/share/applications/virtualbox.desktop \
+ $(VBOX_PATH_INST_COMMON_SRC)/virtualbox.desktop.in
+ $(CHMOD) 0644 $(VBOX_PATH_SI_SCRATCH_PKG)/usr/share/applications/virtualbox.desktop
+
+ $(SED) -e "s+@VBOX_PRODUCT@+$(VBOX_PRODUCT)+" \
+ --output $(VBOX_PATH_SI_SCRATCH_PKG)/usr/share/applications/virtualboxvm.desktop \
+ $(VBOX_PATH_INST_COMMON_SRC)/virtualboxvm.desktop.in
+ $(CHMOD) 0644 $(VBOX_PATH_SI_SCRATCH_PKG)/usr/share/applications/virtualboxvm.desktop
+
+# Desktop stuff in /usr/share/mime/packages/ (S10 cannot deal with icon information in virtualbox.xml).
+ $(SED) -e '/<icon/d' \
+ --output $(VBOX_PATH_SI_SCRATCH_PKG)/usr/share/mime/packages/virtualbox.xml \
+ $(VBOX_PATH_INST_COMMON_SRC)/virtualbox.xml
+ $(CHMOD) 0644 $(VBOX_PATH_SI_SCRATCH_PKG)/usr/share/mime/packages/virtualbox.xml
+
+# Desktop stuff in /usr/share/application-registry.
+ $(SED) -e "s+@VBOX_PRODUCT@+$(VBOX_PRODUCT)+" \
+ --output $(VBOX_PATH_SI_SCRATCH_PKG)/usr/share/application-registry/virtualbox.applications \
+ $(VBOX_PATH_SOL_INST_SRC)/virtualbox.applications.in
+ $(CHMOD) 0644 $(VBOX_PATH_SI_SCRATCH_PKG)/usr/share/application-registry/virtualbox.applications
+
+# Icons stuff under /usr/share/icons/hicolor/<size>x<size>/mimetypes/.
+ $(foreach size, $(VBOX_SI_ICON_SIZES), $(foreach type, $(VBOX_SI_ICON_TYPES) \
+ ,$(NLTAB)$(INSTALL) -m 0644 \
+ $(PATH_ROOT)/src/VBox/Artwork/other/virtualbox-$(type)-$(size)px.png \
+ $(VBOX_PATH_SI_SCRATCH_PKG)/usr/share/icons/hicolor/$(size)x$(size)/mimetypes/virtualbox-$(type).png))
+
+# Files related to package creation.
+ $(SED) -e "s+@VBOX_PRODUCT@+$(VBOX_PRODUCT)+g" \
+ -e "s+@VBOX_VENDOR@+$(VBOX_VENDOR)+g" \
+ -e "s+@VBOX_VERSION_STRING@+$(VBOX_VERSION_STRING)+g" \
+ -e "s+@VBOX_VERSION_REVSTAMP@+$(PKGINFO_REVSTAMP)+g" \
+ -e "s+@UNAME_P@+$(PKGINFO_ARCH)+g" \
+ -e "s+@VBOX_PSTAMP@+$(PKGINFO_PSTAMP)+g" \
+ --output $(VBOX_PATH_SI_SCRATCH_PKG)/vbox.pkginfo \
+ $(VBOX_PATH_SOL_INST_SRC)/vbox.pkginfo
+ $(SED) -e "s+@VBOX_PRODUCT@+$(VBOX_PRODUCT)+g" \
+ -e "s+@VBOX_VENDOR@+$(VBOX_VENDOR)+g" \
+ -e "s+@VBOX_VERSION_STRING@+$(VBOX_VERSION_SMF_STYLE)+g" \
+ -e "s+@VBOX_SVN_REV@+$(VBOX_SVN_REV)+g" \
+ -e "s+@UNAME_P@+$(PKGINFO_ARCH)+g" \
+ --output $(VBOX_PATH_SI_SCRATCH_PKG)/vbox-ips.mog \
+ $(VBOX_PATH_SOL_INST_SRC)/vbox-ips.mog
+ $(APPEND) -t $@ "done"
+
+#
+# Creates the System V style installer package.
+#
+solaris-package:: $(VBOX_PATH_SI_SCRATCH)/$(PKG_FILENAME).pkg
+$(VBOX_PATH_SI_SCRATCH)/$(PKG_FILENAME).pkg: \
+ $(VBOX_PATH_SI_SCRATCH)/dist-copy.ts \
+ $(VBOX_SI_DEP_ON_MAKEFILE) \
+ | $$(dir $$@)
+ $(call MSG_L1,Creating install package: $(PKG_FILENAME).pkg)
+ $(VBOX_PATH_SI_SCRATCH_PKG)/makepackage.sh \
+ $(if-expr defined(VBOX_WITH_HARDENING),--hardened,) \
+ $(VBOX_PATH_SI_SCRATCH_PKG) \
+ $(PKG_FILENAME) \
+ $(KBUILD_TARGET_ARCH) \
+ $(VBOX_SVN_REV)
+ $(MV) -- "$(VBOX_PATH_SI_SCRATCH_PKG)/$(PKG_FILENAME).pkg" "$@"
+
+#
+# Creates the tar file containing license, readme and autoresponse file in addition to the System V package.
+#
+solaris-package-tar-gz:: $(PATH_STAGE_BIN)/$(PKG_FILENAME).tar.gz
+$(PATH_STAGE_BIN)/$(PKG_FILENAME).tar.gz: \
+ $(VBOX_PATH_SI_SCRATCH)/$(PKG_FILENAME).pkg \
+ $(PATH_STAGE_BIN)/LICENSE \
+ $(VBOX_PATH_SOL_INST_SRC)/vbox.pkgresponse \
+ $(PATH_ROOT)/doc/ReadMe-Solaris.txt \
+ $(VBOX_SI_DEP_ON_MAKEFILE) \
+ | $(VBOX_PATH_SI_SCRATCH)/
+ $(call MSG_L1,Creating final tar.gz package: $(PKG_FILENAME).tar.gz)
+ $(QUIET)$(RM) -f -- $(VBOX_PATH_SI_SCRATCH)/ReadMe.txt "$@"
+ $(QUIET)$(SED) \
+ -e "s+@VBOX_PRODUCT@+$(VBOX_PRODUCT)+g" \
+ -e "s+@VBOX_VENDOR@+$(VBOX_VENDOR)+g" \
+ -e "s+@VBOX_VERSION_STRING@+$(VBOX_VERSION_STRING)+g" \
+ -e "s+@KBUILD_TARGET_ARCH@+$(KBUILD_TARGET_ARCH)+g" \
+ -e "s+@VBOX_SVN_REV@+$(VBOX_SVN_REV)+g" \
+ --output $(VBOX_PATH_SI_SCRATCH)/ReadMe.txt \
+ $(PATH_ROOT)/doc/ReadMe-Solaris.txt
+ $(QUIET)$(VBOX_SI_GTAR) -C $(VBOX_PATH_SI_SCRATCH) -czvf "$@" --show-transformed-name \
+ --xform 's,^.*/,,g' --xform 's,vbox.pkgresponse,autoresponse,' \
+ $(VBOX_PATH_SI_SCRATCH)/ReadMe.txt \
+ $(PATH_STAGE_BIN)/LICENSE \
+ $(VBOX_PATH_SOL_INST_SRC)/vbox.pkgresponse \
+ $(VBOX_PATH_SI_SCRATCH)/$(PKG_FILENAME).pkg
+ $(QUIET)$(RM) -f -- $(VBOX_PATH_SI_SCRATCH)/ReadMe.txt
+ $(call MSG_L1,Packaging $@ is completed.)
+
+#
+# Creates the IPS style installer package.
+#
+solaris-package-ips:: $(PATH_STAGE_BIN)/$(PKG_FILENAME_SMF_STYLE).p5p
+$(PATH_STAGE_BIN)/$(PKG_FILENAME_SMF_STYLE).p5p: \
+ $(VBOX_PATH_SI_SCRATCH)/dist-copy.ts \
+ $(VBOX_SI_DEP_ON_MAKEFILE) \
+ | $$(dir $$@)
+ $(call MSG_L1,Creating install package: $(PKG_FILENAME_SMF_STYLE).p5p)
+ $(VBOX_PATH_SI_SCRATCH_PKG)/makepackage.sh \
+ --ips \
+ $(if-expr defined(VBOX_WITH_HARDENING),--hardened,) \
+ $(VBOX_PATH_SI_SCRATCH_PKG) \
+ $(PKG_FILENAME_SMF_STYLE) \
+ $(KBUILD_TARGET_ARCH) \
+ $(VBOX_SVN_REV)
+ $(MV) -- "$(VBOX_PATH_SI_SCRATCH_PKG)/$(PKG_FILENAME_SMF_STYLE).p5p" "$@"
+
+
+## List of file list variable names relevant for debug info.
+SOLARIS_FILE_LIST_DBGINFO_VARS := $(foreach var, $(SOLARIS_FILE_LIST_VARS), $(if-expr "$($(var).STRIP)" != "no",$(var),))
+## Adds a .DBGDST property to each of the debug info file lists. Simplifies our job below
+$(foreach var,$(SOLARIS_FILE_LIST_DBGINFO_VARS) \
+ ,$(eval $(var).DBGDST := $(subst $(VBOX_PATH_SI_SCRATCH_PKG)/,$(VBOX_PATH_SI_SCRATCH_DBG)/,$(subst /opt/VirtualBox,,$($(var).DST)))))
+
+#
+# Creates a tar file containing the debug info.
+#
+$(PATH_STAGE_BIN)/VirtualBoxDebug.tar.bz2: \
+ $(VBOX_VERSION_STAMP) \
+ $(VBOX_SI_DEP_ON_MAKEFILE) \
+ $(foreach var, $(SOLARIS_FILE_LIST_DBGINFO_VARS), $(foreach file, $($(var)), $($(var).SRC)/$(file)))
+ $(call MSG_L1,Preparing $@)
+ $(RM) -Rf -- "$(VBOX_PATH_SI_SCRATCH_DBG)/"
+ $(RM) -f -- "$@"
+ $(MKDIR) -p -m 0755 \
+ $(VBOX_PATH_SI_SCRATCH_DBG)/ \
+ $(sort $(foreach var, $(SOLARIS_FILE_LIST_DBGINFO_VARS), $($(var).DBGDST)/ $(if-expr "$($(var).SUBDIRS)" == "yes" \
+ ,$(sort $(dir $(foreach file, $($(var)), $($(var).DBGDST)/$(file)))),)))
+ $(foreach var, $(SOLARIS_FILE_LIST_DBGINFO_VARS),$(foreach file, $($(var)) \
+ ,$(NLTAB)$(VBOX_SI_OBJCOPY_DBGINFO) "$($(var).SRC)/$(file)" "$($(var).DBGDST)/$(file)"))
+ $(call MSG_L1,Packing $@)
+ $(QUIET)$(VBOX_SI_GTAR) --dereference --owner 0 --group 0 \
+ -cvjRhf "$@" -C "$(VBOX_PATH_SI_SCRATCH_DBG)/.." "./$(notdir $(VBOX_PATH_SI_SCRATCH_DBG))/"
+ $(QUIET)$(CHMOD) 0644 $@
+ $(call MSG_L1,Packaging $@ is completed.)
+ $(RM) -Rf "$(VBOX_PATH_SI_SCRATCH_DBG)/"
+
diff --git a/src/VBox/Installer/solaris/VBox.sh b/src/VBox/Installer/solaris/VBox.sh
new file mode 100755
index 00000000..e93df553
--- /dev/null
+++ b/src/VBox/Installer/solaris/VBox.sh
@@ -0,0 +1,82 @@
+#!/bin/sh
+## @file
+# Oracle VM VirtualBox startup script, Solaris hosts.
+#
+
+#
+# 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
+#
+
+CURRENT_ISA=`isainfo -k`
+if test "$CURRENT_ISA" = "amd64"; then
+ INSTALL_DIR="/opt/VirtualBox/amd64"
+else
+ INSTALL_DIR="/opt/VirtualBox/i386"
+fi
+
+APP=`basename $0`
+case "$APP" in
+ VirtualBox|virtualbox)
+ exec "$INSTALL_DIR/VirtualBox" "$@"
+ ;;
+ VirtualBoxVM|virtualboxvm)
+ exec "$INSTALL_DIR/VirtualBoxVM" "$@"
+ ;;
+ VBoxManage|vboxmanage)
+ exec "$INSTALL_DIR/VBoxManage" "$@"
+ ;;
+ VBoxSDL|vboxsdl)
+ exec "$INSTALL_DIR/VBoxSDL" "$@"
+ ;;
+ VBoxVRDP|VBoxHeadless|vboxheadless)
+ exec "$INSTALL_DIR/VBoxHeadless" "$@"
+ ;;
+ VBoxBugReport|vboxbugreport)
+ exec "$INSTALL_DIR/VBoxBugReport" "$@"
+ ;;
+ VBoxBalloonCtrl|vboxballoonctrl)
+ exec "$INSTALL_DIR/VBoxBalloonCtrl" "$@"
+ ;;
+ VBoxAutostart|vboxautostart)
+ exec "$INSTALL_DIR/VBoxAutostart" "$@"
+ ;;
+ VBoxDTrace|vboxdtrace)
+ exec "$INSTALL_DIR/VBoxDTrace" "$@"
+ ;;
+ VBoxAudioTest|vboxaudiotest|vkat)
+ exec "$INSTALL_DIR/VBoxAudioTest" "$@"
+ ;;
+ vboxwebsrv)
+ exec "$INSTALL_DIR/vboxwebsrv" "$@"
+ ;;
+ VBoxQtconfig)
+ exec "$INSTALL_DIR/VBoxQtconfig" "$@"
+ ;;
+ vbox-img)
+ exec "$INSTALL_DIR/vbox-img" "$0"
+ ;;
+ *)
+ echo "Unknown application - $APP"
+ exit 1
+ ;;
+esac
+exit 0
+
diff --git a/src/VBox/Installer/solaris/VBoxISAExec.c b/src/VBox/Installer/solaris/VBoxISAExec.c
new file mode 100644
index 00000000..8bd5d14c
--- /dev/null
+++ b/src/VBox/Installer/solaris/VBoxISAExec.c
@@ -0,0 +1,53 @@
+/* $Id: VBoxISAExec.c $ */
+/** @file
+ * VBoxISAExec, ISA exec wrapper, Solaris hosts.
+ */
+
+/*
+ * 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
+ */
+
+
+/*********************************************************************************************************************************
+* Header Files *
+*********************************************************************************************************************************/
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+int main(int argc, char *argv[], char *envv[])
+{
+ int rc = 0;
+ const char *pszExec = getexecname();
+
+ if (!pszExec)
+ {
+ fprintf(stderr, "Failed to get executable name.\n");
+ return -1;
+ }
+
+ rc = isaexec(pszExec, argv, envv);
+ if (rc == -1)
+ fprintf(stderr, "Failed to find/execute ISA specific executable for %s\n", pszExec);
+
+ return rc;
+}
+
diff --git a/src/VBox/Installer/solaris/VBoxZoneAccess.c b/src/VBox/Installer/solaris/VBoxZoneAccess.c
new file mode 100644
index 00000000..e8d6a119
--- /dev/null
+++ b/src/VBox/Installer/solaris/VBoxZoneAccess.c
@@ -0,0 +1,100 @@
+/* $Id: VBoxZoneAccess.c $ */
+/** @file
+ * VBoxZoneAccess - Hack that keeps vboxdrv referenced for granting zone access, Solaris hosts.
+ */
+
+/*
+ * 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
+ */
+
+
+/*********************************************************************************************************************************
+* Header Files *
+*********************************************************************************************************************************/
+#include <stdio.h>
+#include <signal.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+
+#include <iprt/process.h>
+
+
+/*********************************************************************************************************************************
+* Defined Constants And Macros *
+*********************************************************************************************************************************/
+#define DEVICE_NAME "/devices/pseudo/vboxdrv@0:vboxdrv"
+#define DEVICE_NAME_USR "/devices/pseudo/vboxdrv@0:vboxdrvu"
+
+int main(int argc, char *argv[])
+{
+ int hDevice = -1;
+ int hDeviceUsr = -1;
+
+ /* Check root permissions. */
+ if (geteuid() != 0)
+ {
+ fprintf(stderr, "This program needs administrator privileges.\n");
+ return -1;
+ }
+
+ /* Daemonize... */
+ RTProcDaemonizeUsingFork(false /* fNoChDir */,
+ false /* fNoClose */,
+ NULL /* pszPidfile */);
+
+ /* Open the device */
+ hDevice = open(DEVICE_NAME, O_RDWR, 0);
+ if (hDevice < 0)
+ {
+ fprintf(stderr, "Failed to open '%s'. errno=%d\n", DEVICE_NAME, errno);
+ return errno;
+ }
+
+ /* Open the user device. */
+ hDeviceUsr = open(DEVICE_NAME_USR, O_RDWR, 0);
+ if (hDeviceUsr < 0)
+ {
+ fprintf(stderr, "Failed to open '%s'. errno=%d\n", DEVICE_NAME_USR, errno);
+ close(hDevice);
+ return errno;
+ }
+
+ /* Mark the file handle close on exec. */
+ if ( fcntl(hDevice, F_SETFD, FD_CLOEXEC) != 0
+ || fcntl(hDeviceUsr, F_SETFD, FD_CLOEXEC) != 0)
+ {
+ fprintf(stderr, "Failed to set close on exec. errno=%d\n", errno);
+ close(hDevice);
+ close(hDeviceUsr);
+ return errno;
+ }
+
+ /* Go to interruptible sleep for ~15 years... */
+ /* avoid > 2^31 for Year 2038 32-bit overflow (Solaris 10) */
+ sleep(500000000U);
+
+ close(hDevice);
+ close(hDeviceUsr);
+
+ return 0;
+}
+
diff --git a/src/VBox/Installer/solaris/checkinstall.sh b/src/VBox/Installer/solaris/checkinstall.sh
new file mode 100755
index 00000000..d29c219e
--- /dev/null
+++ b/src/VBox/Installer/solaris/checkinstall.sh
@@ -0,0 +1,345 @@
+#!/bin/sh
+# $Id: checkinstall.sh $
+## @file
+#
+# VirtualBox checkinstall script for Solaris.
+#
+
+#
+# Copyright (C) 2009-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
+#
+
+infoprint()
+{
+ echo 1>&2 "$1"
+}
+
+errorprint()
+{
+ echo 1>&2 "## $1"
+}
+
+abort_error()
+{
+ errorprint "Please close all VirtualBox processes and re-run this installer."
+ exit 1
+}
+
+checkdep_ips()
+{
+ if test -z "$1"; then
+ errorprint "Missing argument to checkdep_ips"
+ return 1
+ fi
+ # using "list" without "-a" only lists installed pkgs which is what we need
+ $BIN_PKG $BASEDIR_OPT list "$1" >/dev/null 2>&1
+ if test "$?" -eq 0; then
+ return 0
+ fi
+ PKG_MISSING_IPS="$PKG_MISSING_IPS $1"
+ return 1
+}
+
+checkdep_ips_python()
+{
+ if test -z "$1"; then
+ errorprint "Missing argument to checkdep_ips_python"
+ return 1
+ fi
+
+ # Check installed packages for any python runtime from the argument list passed
+ # to this function. We can't use 'pkg list -q' here since it didn't exist until
+ # S11.2 FCS (CR 16663535).
+ for pkg in "${@}"; do
+ $BIN_PKG $BASEDIR_OPT list "${pkg}" >/dev/null 2>&1
+ if test "$?" -eq 0; then
+ return 0
+ fi
+ done
+
+ # 'pkg info' Branch fields:
+ # For S11-11.3: TrunkID|Update|SRU|Reserved|BuildID|NightlyID
+ # For S11.4: TrunkID|Update|SRU|Reserved|Reserved|BuildID|NightlyID
+ # N.B. For S11-11.3: TrunkID=0.175 For S11.4: TrunkID=11
+ # Example Solaris 11 FMRIs:
+ # Solaris 11 pre-FCS = 5.12.0.0.0.128.1
+ # Solaris 11 FCS = 0.175.0.0.0.2.0
+ # Solaris 11.1 SRU21 = 0.175.1.21.0.4.1
+ # Solaris 11.2 SRU15 = 0.175.2.14.0.2.2
+ # Solaris 11.3 SRU36 = 0.175.3.36.0.8.0
+ # Solaris 11.4 SRU55 = 11.4.55.0.1.138.3
+ eval `$BIN_PKG $BASEDIR_OPT info system/kernel | \
+ awk '/Branch:/ { split($2, array, "."); if ($2 == 175) {print "export UPDATE="array[3] " SRU="array[4];} \
+ else {print "export UPDATE="array[2] " SRU="array[3]} }'`
+
+ # If the parsing of the pkg FMRI failed for any reason then default to the first
+ # Solaris 11.4 CBE which was released relatively recently (March 2022) and is
+ # freely available.
+ if test -z "$UPDATE"; then
+ export UPDATE=4 SRU=42
+ fi
+
+ # Map of introduction and removal of python releases in Solaris 11 releases/SRUs:
+ # python 2.6: S11 FCS -> S11.3 SRU19 [removed in S11.3 SRU20]
+ # python 2.7: S11 FCS -> S11.4 SRU56 [removed in S11.4 SRU57]
+ # python 3.4: S11.3 FCS -> S11.4 SRU26 [removed in S11.4 SRU27]
+ # python 3.5: S11.4 FCS -> S11.4 SRU29 [removed in S11.4 SRU30]
+ # python 3.7: S11.4 SRU4 -> TBD
+ # python 3.9: S11.4 SRU30 -> TBD
+ # python 3.11: S11.4 SRU54 -> TBD
+ if test "$UPDATE" -lt 3 || test "$UPDATE" -gt 4; then # S11 FCS - S11.2 SRU15 or anything before S11 FCS
+ PKG_MISSING_IPS="$PKG_MISSING_IPS runtime/python-26 or runtime/python-27"
+ elif test "$UPDATE" -eq 3 && test "$SRU" -le 19; then # S11.3 FCS - S11.3 SRU19
+ PKG_MISSING_IPS="$PKG_MISSING_IPS runtime/python-26 or runtime/python-27 or runtime/python-34"
+ elif test "$UPDATE" -eq 3 && test "$SRU" -gt 19; then # S11.3 SRU20 - S11.3 SRU<latest>
+ PKG_MISSING_IPS="$PKG_MISSING_IPS runtime/python-27 or runtime/python-34"
+ elif test "$UPDATE" -eq 4 && test "$SRU" -le 3; then # S11.4 FCS - S11.4 SRU3
+ PKG_MISSING_IPS="$PKG_MISSING_IPS runtime/python-27 or runtime/python-34 or runtime/python-35"
+ elif test "$UPDATE" -eq 4 && test "$SRU" -le 26; then # S11.4 SRU4 - S11.4 SRU26
+ PKG_MISSING_IPS="$PKG_MISSING_IPS runtime/python-27 or runtime/python-34 or runtime/python-35 or runtime/python-37"
+ elif test "$UPDATE" -eq 4 && test "$SRU" -le 29; then # S11.4 SRU27 - S11.4 SRU29
+ PKG_MISSING_IPS="$PKG_MISSING_IPS runtime/python-27 or runtime/python-35 or runtime/python-37"
+ elif test "$UPDATE" -eq 4 && test "$SRU" -le 53; then # S11.4 SRU30 - S11.4 SRU53
+ PKG_MISSING_IPS="$PKG_MISSING_IPS runtime/python-27 or runtime/python-37 or runtime/python-39"
+ elif test "$UPDATE" -eq 4 && test "$SRU" -le 56; then # S11.4 SRU54 - S11.4 SRU56
+ PKG_MISSING_IPS="$PKG_MISSING_IPS runtime/python-27 or runtime/python-37 or runtime/python-39 or runtime/python-311"
+ elif test "$UPDATE" -eq 4 && test "$SRU" -gt 56; then # S11.4 SRU57 - S11.4 SRU<latest>
+ PKG_MISSING_IPS="$PKG_MISSING_IPS runtime/python-37 or runtime/python-39 or runtime/python-311"
+ else # Fall through just in case.
+ PKG_MISSING_IPS="$PKG_MISSING_IPS runtime/python-37 or runtime/python-39 or runtime/python-311"
+ fi
+
+ return 1
+}
+
+checkdep_ips_either()
+{
+ if test -z "$1" || test -z "$2"; then
+ errorprint "Missing argument to checkdep_ips_either"
+ return 1
+ fi
+ # using "list" without "-a" only lists installed pkgs which is what we need
+ $BIN_PKG $BASEDIR_OPT list "$1" >/dev/null 2>&1
+ if test "$?" -eq 0; then
+ return 0
+ fi
+ $BIN_PKG $BASEDIR_OPT list "$2" >/dev/null 2>&1
+ if test "$?" -eq 0; then
+ return 0
+ fi
+ PKG_MISSING_IPS="$PKG_MISSING_IPS $1 or $2"
+ return 1
+}
+
+disable_service()
+{
+ if test -z "$1" || test -z "$2"; then
+ errorprint "Missing argument to disable_service"
+ return 1
+ fi
+ servicefound=`$BIN_SVCS -H "$1" 2> /dev/null | grep '^online'`
+ if test ! -z "$servicefound"; then
+ infoprint "$2 ($1) is still enabled. Disabling..."
+ $BIN_SVCADM disable -s "$1"
+ # Don't delete the service, handled by manifest class action
+ # /usr/sbin/svccfg delete $1
+ fi
+}
+
+# find_bin_path()
+# !! failure is always fatal
+find_bin_path()
+{
+ if test -z "$1"; then
+ errorprint "missing argument to find_bin_path()"
+ exit 1
+ fi
+
+ binfilename=`basename $1`
+ binfilepath=`which $binfilename 2> /dev/null`
+ if test -x "$binfilepath"; then
+ echo "$binfilepath"
+ return 0
+ else
+ errorprint "$1 missing or is not an executable"
+ exit 1
+ fi
+}
+
+# find_bins()
+# !! failure is always fatal
+find_mandatory_bins()
+{
+ # Search only for binaries that might be in different locations
+ if test ! -x "$BIN_SVCS"; then
+ BIN_SVCS=`find_bin_path "$BIN_SVCS"`
+ fi
+
+ if test ! -x "$BIN_SVCADM"; then
+ BIN_SVCADM=`find_bin_path "$BIN_SVCADM"`
+ fi
+}
+
+
+#
+# Begin execution
+#
+
+# Nothing to check for remote install
+REMOTE_INST=0
+if test "x${PKG_INSTALL_ROOT:=/}" != "x/"; then
+ BASEDIR_OPT="-R $PKG_INSTALL_ROOT"
+ REMOTE_INST=1
+fi
+
+# Nothing to check for non-global zones
+currentzone=`zonename`
+if test "x$currentzone" != "xglobal"; then
+ exit 0
+fi
+
+PKG_MISSING_IPS=""
+BIN_PKG=/usr/bin/pkg
+BIN_SVCS=/usr/bin/svcs
+BIN_SVCADM=/usr/sbin/svcadm
+
+# Check non-optional binaries
+find_mandatory_bins
+
+infoprint "Checking package dependencies..."
+
+if test -x "$BIN_PKG"; then
+ checkdep_ips "system/library/iconv/iconv-core"
+ checkdep_ips "x11/library/libice"
+ checkdep_ips "x11/library/libsm"
+ checkdep_ips "x11/library/libx11"
+ checkdep_ips "x11/library/libxcb"
+ checkdep_ips "x11/library/libxext"
+ checkdep_ips "x11/library/libxfixes"
+ checkdep_ips "x11/library/libxkbcommon"
+ checkdep_ips "x11/library/libxrender"
+ checkdep_ips "x11/library/mesa"
+ checkdep_ips "x11/library/toolkit/libxt"
+ checkdep_ips "x11/library/xcb-util"
+ checkdep_ips_python "runtime/python-26" "runtime/python-27" "runtime/python-34" "runtime/python-35" "runtime/python-37" "runtime/python-39" "runtime/python-311"
+ checkdep_ips_either "system/library/gcc/gcc-c++-runtime" "system/library/gcc/gcc-c++-runtime-9"
+ checkdep_ips_either "system/library/gcc/gcc-c-runtime" "system/library/gcc/gcc-c-runtime-9"
+else
+ PKG_MISSING_IPS="runtime/python-37 system/library/iconv/iconv-core system/library/gcc/gcc-c++-runtime-9 system/library/gcc/gcc-c-runtime-9"
+fi
+
+if test "x$PKG_MISSING_IPS" != "x"; then
+ if test ! -x "$BIN_PKG"; then
+ errorprint "Missing or non-executable binary: pkg ($BIN_PKG)."
+ errorprint "Cannot check for dependencies."
+ errorprint ""
+ errorprint "Please install one of the required packaging system."
+ exit 1
+ fi
+ errorprint "Missing packages: $PKG_MISSING_IPS"
+ errorprint ""
+ errorprint "Please install these packages before installing VirtualBox."
+ exit 1
+else
+ infoprint "Done."
+fi
+
+# Nothing more to do for remote installs
+if test "$REMOTE_INST" -eq 1; then
+ exit 0
+fi
+
+# Check & disable running services
+disable_service "svc:/application/virtualbox/zoneaccess" "VirtualBox zone access service"
+disable_service "svc:/application/virtualbox/webservice" "VirtualBox web service"
+disable_service "svc:/application/virtualbox/autostart" "VirtualBox auto-start service"
+disable_service "svc:/application/virtualbox/balloonctrl" "VirtualBox balloon-control service"
+
+# Check if VBoxSVC is currently running
+VBOXSVC_PID=`ps -eo pid,fname | grep VBoxSVC | grep -v grep | awk '{ print $1 }'`
+if test ! -z "$VBOXSVC_PID" && test "$VBOXSVC_PID" -ge 0; then
+ errorprint "VirtualBox's VBoxSVC (pid $VBOXSVC_PID) still appears to be running."
+ abort_error
+fi
+
+# Check if VBoxNetDHCP is currently running
+VBOXNETDHCP_PID=`ps -eo pid,fname | grep VBoxNetDHCP | grep -v grep | awk '{ print $1 }'`
+if test ! -z "$VBOXNETDHCP_PID" && test "$VBOXNETDHCP_PID" -ge 0; then
+ errorprint "VirtualBox's VBoxNetDHCP (pid $VBOXNETDHCP_PID) still appears to be running."
+ abort_error
+fi
+
+# Check if VBoxNetNAT is currently running
+VBOXNETNAT_PID=`ps -eo pid,fname | grep VBoxNetNAT | grep -v grep | awk '{ print $1 }'`
+if test ! -z "$VBOXNETNAT_PID" && test "$VBOXNETNAT_PID" -ge 0; then
+ errorprint "VirtualBox's VBoxNetNAT (pid $VBOXNETNAT_PID) still appears to be running."
+ abort_error
+fi
+
+# Check if vboxnet is still plumbed, if so try unplumb it
+BIN_IFCONFIG=`which ifconfig 2> /dev/null`
+if test -x "$BIN_IFCONFIG"; then
+ vboxnetup=`$BIN_IFCONFIG vboxnet0 >/dev/null 2>&1`
+ if test "$?" -eq 0; then
+ infoprint "VirtualBox NetAdapter is still plumbed"
+ infoprint "Trying to remove old NetAdapter..."
+ $BIN_IFCONFIG vboxnet0 unplumb
+ if test "$?" -ne 0; then
+ errorprint "VirtualBox NetAdapter 'vboxnet0' couldn't be unplumbed (probably in use)."
+ abort_error
+ fi
+ fi
+ vboxnetup=`$BIN_IFCONFIG vboxnet0 inet6 >/dev/null 2>&1`
+ if test "$?" -eq 0; then
+ infoprint "VirtualBox NetAdapter (Ipv6) is still plumbed"
+ infoprint "Trying to remove old NetAdapter..."
+ $BIN_IFCONFIG vboxnet0 inet6 unplumb
+ if test "$?" -ne 0; then
+ errorprint "VirtualBox NetAdapter 'vboxnet0' IPv6 couldn't be unplumbed (probably in use)."
+ abort_error
+ fi
+ fi
+fi
+
+# Make sure that SMF has finished removing any services left over from a
+# previous installation which may interfere with installing new ones.
+# This is only relevant on Solaris 11 for SysV packages.
+#
+# See BugDB 14838646 for the original problem and @bugref{7866} for
+# follow up fixes.
+for i in 1 2 3 4 5 6 7 8 9 10; do
+ $BIN_SVCS -H "svc:/application/virtualbox/autostart" >/dev/null 2>&1 ||
+ $BIN_SVCS -H "svc:/application/virtualbox/webservice" >/dev/null 2>&1 ||
+ $BIN_SVCS -H "svc:/application/virtualbox/zoneaccess" >/dev/null 2>&1 ||
+ $BIN_SVCS -H "svc:/application/virtualbox/balloonctrl" >/dev/null 2>&1 || break
+ if test "${i}" = "1"; then
+ printf "Waiting for services from previous installation to be removed."
+ elif test "${i}" = "10"; then
+ printf "\nWarning!!! Some service(s) still appears to be present"
+ else
+ printf "."
+ fi
+ sleep 1
+done
+test "${i}" = "1" || printf "\n"
+
+exit 0
+
diff --git a/src/VBox/Installer/solaris/makepackage.sh b/src/VBox/Installer/solaris/makepackage.sh
new file mode 100755
index 00000000..5f4913d3
--- /dev/null
+++ b/src/VBox/Installer/solaris/makepackage.sh
@@ -0,0 +1,307 @@
+#!/bin/sh
+# $Id: makepackage.sh $
+## @file
+# VirtualBox package creation script, Solaris hosts.
+#
+
+#
+# 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
+#
+
+#
+# Usage:
+# makepackage.sh [--hardened] [--ips] $(PATH_TARGET)/install packagename {$(KBUILD_TARGET_ARCH)|neutral} $(VBOX_SVN_REV)
+
+
+# Parse options.
+HARDENED=""
+IPS_PACKAGE=""
+PACKAGE_SPEC="prototype"
+while [ $# -ge 1 ];
+do
+ case "$1" in
+ --hardened)
+ HARDENED=1
+ ;;
+ --ips)
+ IPS_PACKAGE=1
+ PACKAGE_SPEC="virtualbox.p5m"
+ ;;
+ *)
+ break
+ ;;
+ esac
+ shift
+done
+
+if [ -z "$4" ]; then
+ echo "Usage: $0 installdir packagename x86|amd64 svnrev"
+ echo "-- packagename must not have any extension (e.g. VirtualBox-SunOS-amd64-r28899)"
+ exit 1
+fi
+
+PKG_BASE_DIR="$1"
+PACKAGE_SPEC="$PKG_BASE_DIR/$PACKAGE_SPEC"
+VBOX_INSTALLED_DIR=/opt/VirtualBox
+if [ -n "$IPS_PACKAGE" ]; then
+ VBOX_PKGFILE="$2".p5p
+else
+ VBOX_PKGFILE="$2".pkg
+fi
+# VBOX_PKG_ARCH is currently unused.
+VBOX_PKG_ARCH="$3"
+VBOX_SVN_REV="$4"
+
+if [ -n "$IPS_PACKAGE" ] ; then
+ VBOX_PKGNAME=system/virtualbox
+else
+ VBOX_PKGNAME=SUNWvbox
+fi
+# any egrep should do the job, the one from /usr/xpg4/bin isn't required
+VBOX_EGREP=/usr/bin/egrep
+# need dynamic regex support which isn't available in S11 /usr/bin/awk
+VBOX_AWK=/usr/xpg4/bin/awk
+
+# bail out on non-zero exit status
+set -e
+
+if [ -n "$IPS_PACKAGE" ]; then
+
+package_spec_create()
+{
+ > "$PACKAGE_SPEC"
+}
+
+package_spec_append_info()
+{
+ : # provided by vbox-ips.mog
+}
+
+package_spec_append_content()
+{
+ rm -rf "$1/vbox-repo"
+ pkgsend generate "$1" | pkgfmt >> "$PACKAGE_SPEC"
+}
+
+package_spec_append_hardlink()
+{
+ if [ -f "$3$4/amd64/$2" -o -f "$3$4/i386/$2" ]; then
+ echo "hardlink path=$4/$2 target=$1" >> "$PACKAGE_SPEC"
+ fi
+}
+
+package_spec_fixup_content()
+{
+ :
+}
+
+package_create()
+{
+ VBOX_DEF_HARDENED=
+ [ -z "$HARDENED" ] && VBOX_DEF_HARDENED='#'
+
+ pkgmogrify -DVBOX_PKGNAME="$VBOX_PKGNAME" -DHARDENED_ONLY="$VBOX_DEF_HARDENED" "$PACKAGE_SPEC" "$1/vbox-ips.mog" | pkgfmt > "$PACKAGE_SPEC.1"
+
+ pkgdepend generate -m -d "$1" "$PACKAGE_SPEC.1" | pkgfmt > "$PACKAGE_SPEC.2"
+
+ pkgdepend resolve -m "$PACKAGE_SPEC.2"
+
+ # Too expensive, and in this form not useful since it does not have
+ # the package manifests without using options -r (for repo access) and
+ # -c (for caching the data). Not viable since the cache would be lost
+ # for every build.
+ #pkglint "$PACKAGE_SPEC.2.res"
+
+ pkgrepo create "$1/vbox-repo"
+ pkgrepo -s "$1/vbox-repo" set publisher/prefix=virtualbox
+
+ # Create package in local file repository
+ pkgsend -s "$1/vbox-repo" publish -d "$1" "$PACKAGE_SPEC.2.res"
+
+ pkgrepo -s "$1/vbox-repo" info
+ pkgrepo -s "$1/vbox-repo" list
+
+ # Convert into package archive
+ rm -f "$1/$2"
+ pkgrecv -a -s "$1/vbox-repo" -d "$1/$2" -m latest "$3"
+ rm -rf "$1/vbox-repo"
+}
+
+else
+
+package_spec_create()
+{
+ > "$PACKAGE_SPEC"
+}
+
+package_spec_append_info()
+{
+ echo 'i pkginfo=vbox.pkginfo' >> "$PACKAGE_SPEC"
+ echo 'i checkinstall=checkinstall.sh' >> "$PACKAGE_SPEC"
+ echo 'i postinstall=postinstall.sh' >> "$PACKAGE_SPEC"
+ echo 'i preremove=preremove.sh' >> "$PACKAGE_SPEC"
+ echo 'i space=vbox.space' >> "$PACKAGE_SPEC"
+}
+
+# Our package is a non-relocatable package.
+#
+# pkgadd will take care of "relocating" them when they are used for remote installations using
+# $PKG_INSTALL_ROOT and not $BASEDIR. Seems this little subtlety led to it's own page:
+# https://docs.oracle.com/cd/E19253-01/820-4042/package-2/index.html
+
+package_spec_append_content()
+{
+ cd "$1"
+ # Exclude directories to not cause install-time conflicts with existing system directories
+ find . ! -type d | "$VBOX_EGREP" -v '^\./(LICENSE|prototype|makepackage\.sh|vbox\.pkginfo|postinstall\.sh|checkinstall\.sh|preremove\.sh|vbox\.space|vbox-ips.mog|virtualbox\.p5m.*)$' | LC_COLLATE=C sort | pkgproto >> "$PACKAGE_SPEC"
+ cd -
+ "$VBOX_AWK" 'NF == 3 && $1 == "s" && $2 == "none" { $3="/"$3 } { print }' "$PACKAGE_SPEC" > "$PACKAGE_SPEC.tmp"
+ mv -f "$PACKAGE_SPEC.tmp" "$PACKAGE_SPEC"
+ "$VBOX_AWK" 'NF == 6 && ($1 == "f" || $1 == "l") && ($2 == "none" || $2 == "manifest") { $3="/"$3 } { print }' "$PACKAGE_SPEC" > "$PACKAGE_SPEC.tmp"
+ mv -f "$PACKAGE_SPEC.tmp" "$PACKAGE_SPEC"
+
+ cd "$1"
+ # Include opt/VirtualBox and subdirectories as we want uninstall to clean up directory structure.
+ # Include var/svc for manifest class action script does not create them.
+ find . -type d | "$VBOX_EGREP" 'opt/VirtualBox|var/svc/manifest/application/virtualbox' | LC_COLLATE=C sort | pkgproto >> "$PACKAGE_SPEC"
+ cd -
+ "$VBOX_AWK" 'NF == 6 && $1 == "d" && $2 == "none" { $3="/"$3 } { print }' "$PACKAGE_SPEC" > "$PACKAGE_SPEC.tmp"
+ mv -f "$PACKAGE_SPEC.tmp" "$PACKAGE_SPEC"
+}
+
+package_spec_append_hardlink()
+{
+ if [ -f "$3$4/amd64/$2" -o -f "$3$4/i386/$2" ]; then
+ echo "l none $4/$2=$1" >> "$PACKAGE_SPEC"
+ fi
+}
+
+# Fixup filelist using awk, the parameters must be in awk syntax
+# params: filename condition action
+package_spec_fixup_filelist()
+{
+ "$VBOX_AWK" 'NF == 6 && '"$1"' { '"$2"' } { print }' "$PACKAGE_SPEC" > "$PACKAGE_SPEC.tmp"
+ mv -f "$PACKAGE_SPEC.tmp" "$PACKAGE_SPEC"
+}
+
+package_spec_fixup_dirlist()
+{
+ "$VBOX_AWK" 'NF == 6 && $1 == "d" && '"$1"' { '"$2"' } { print }' "$PACKAGE_SPEC" > "$PACKAGE_SPEC.tmp"
+ mv -f "$PACKAGE_SPEC.tmp" "$PACKAGE_SPEC"
+}
+
+package_spec_fixup_content()
+{
+ # fix up file permissions (owner/group)
+ # don't grok for class-specific files (like sed, if any)
+ package_spec_fixup_filelist '$2 == "none"' '$5 = "root"; $6 = "bin"'
+
+ # HostDriver vboxdrv
+ package_spec_fixup_filelist '$3 == "/platform/i86pc/kernel/drv/vboxdrv.conf"' '$6 = "sys"'
+ package_spec_fixup_filelist '$3 == "/platform/i86pc/kernel/drv/amd64/vboxdrv"' '$6 = "sys"'
+
+ # NetFilter vboxflt
+ package_spec_fixup_filelist '$3 == "/platform/i86pc/kernel/drv/vboxflt.conf"' '$6 = "sys"'
+ package_spec_fixup_filelist '$3 == "/platform/i86pc/kernel/drv/amd64/vboxflt"' '$6 = "sys"'
+
+ # NetFilter vboxbow
+ package_spec_fixup_filelist '$3 == "/platform/i86pc/kernel/drv/vboxbow.conf"' '$6 = "sys"'
+ package_spec_fixup_filelist '$3 == "/platform/i86pc/kernel/drv/amd64/vboxbow"' '$6 = "sys"'
+
+ # NetAdapter vboxnet
+ package_spec_fixup_filelist '$3 == "/platform/i86pc/kernel/drv/vboxnet.conf"' '$6 = "sys"'
+ package_spec_fixup_filelist '$3 == "/platform/i86pc/kernel/drv/amd64/vboxnet"' '$6 = "sys"'
+
+ # USBMonitor vboxusbmon
+ package_spec_fixup_filelist '$3 == "/platform/i86pc/kernel/drv/vboxusbmon.conf"' '$6 = "sys"'
+ package_spec_fixup_filelist '$3 == "/platform/i86pc/kernel/drv/amd64/vboxusbmon"' '$6 = "sys"'
+
+ # USB Client vboxusb
+ package_spec_fixup_filelist '$3 == "/platform/i86pc/kernel/drv/vboxusb.conf"' '$6 = "sys"'
+ package_spec_fixup_filelist '$3 == "/platform/i86pc/kernel/drv/amd64/vboxusb"' '$6 = "sys"'
+
+ # Manifest class action scripts
+ package_spec_fixup_filelist '$3 == "/var/svc/manifest/application/virtualbox/virtualbox-webservice.xml"' '$2 = "manifest";$6 = "sys"'
+ package_spec_fixup_filelist '$3 == "/var/svc/manifest/application/virtualbox/virtualbox-balloonctrl.xml"' '$2 = "manifest";$6 = "sys"'
+ package_spec_fixup_filelist '$3 == "/var/svc/manifest/application/virtualbox/virtualbox-zoneaccess.xml"' '$2 = "manifest";$6 = "sys"'
+
+ # Use 'root' as group so as to match attributes with the previous installation and prevent a conflict. Otherwise pkgadd bails out thinking
+ # we're violating directory attributes of another (non existing) package
+ package_spec_fixup_dirlist '$3 == "/var/svc/manifest/application/virtualbox"' '$6 = "root"'
+
+ # Hardening requires some executables to be marked setuid.
+ if [ -n "$HARDENED" ]; then
+ package_spec_fixup_filelist '( $3 == "/opt/VirtualBox/amd64/VirtualBoxVM" \
+ || $3 == "/opt/VirtualBox/amd64/VBoxHeadless" \
+ || $3 == "/opt/VirtualBox/amd64/VBoxSDL" \
+ || $3 == "/opt/VirtualBox/i386/VirtualBox" \
+ || $3 == "/opt/VirtualBox/i386/VBoxHeadless" \
+ || $3 == "/opt/VirtualBox/i386/VBoxSDL" )' '$4 = "4755"'
+ fi
+
+ # Other executables that need setuid root (hardened or otherwise)
+ package_spec_fixup_filelist '( $3 == "/opt/VirtualBox/amd64/VBoxNetAdpCtl" \
+ || $3 == "/opt/VirtualBox/i386/VBoxNetAdpCtl" \
+ || $3 == "/opt/VirtualBox/amd64/VBoxNetDHCP" \
+ || $3 == "/opt/VirtualBox/i386/VBoxNetDHCP" \
+ || $3 == "/opt/VirtualBox/amd64/VBoxNetNAT" \
+ || $3 == "/opt/VirtualBox/i386/VBoxNetNAT" )' '$4 = "4755"'
+
+ echo " --- start of $PACKAGE_SPEC ---"
+ cat "$PACKAGE_SPEC"
+ echo " --- end of $PACKAGE_SPEC ---"
+}
+
+package_create()
+{
+ # Create the package instance
+ pkgmk -o -f "$PACKAGE_SPEC" -r "$1"
+
+ # Translate into package datastream
+ pkgtrans -s -o /var/spool/pkg "$1/$2" "$3"
+
+ rm -rf "/var/spool/pkg/$2"
+}
+
+fi
+
+
+# Prepare package spec
+package_spec_create
+
+# Metadata
+package_spec_append_info "$PKG_BASE_DIR"
+
+# File and direcory list
+package_spec_append_content "$PKG_BASE_DIR"
+
+# Add hardlinks for executables to launch the 32-bit or 64-bit executable
+for f in VBoxManage VBoxSDL VBoxAutostart vboxwebsrv VBoxZoneAccess VBoxSVC VBoxBugReport VBoxBalloonCtrl VBoxTestOGL VirtualBox VirtualBoxVM vbox-img VBoxHeadless; do
+ package_spec_append_hardlink VBoxISAExec $f "$PKG_BASE_DIR" "$VBOX_INSTALLED_DIR"
+done
+
+package_spec_fixup_content
+
+package_create "$PKG_BASE_DIR" "$VBOX_PKGFILE" "$VBOX_PKGNAME" "$VBOX_SVN_REV"
+
+echo "## Package file created successfully!"
+
+exit $?
diff --git a/src/VBox/Installer/solaris/pkginstall.sh b/src/VBox/Installer/solaris/pkginstall.sh
new file mode 100755
index 00000000..843834fb
--- /dev/null
+++ b/src/VBox/Installer/solaris/pkginstall.sh
@@ -0,0 +1,70 @@
+#!/bin/sh
+# $Id: pkginstall.sh $
+## @file
+#
+# VirtualBox postinstall script for Solaris.
+#
+# If you just installed VirtualBox using IPS/pkg(5), you should run this
+# script once to avoid rebooting the system before using VirtualBox.
+#
+
+#
+# Copyright (C) 2009-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 test "$1" != "--srv4"; then
+ # IPS package
+ echo "Checking for older & partially installed bits..."
+ ISIPS="--ips"
+else
+ # SRv4 package
+ echo "Checking for older bits..."
+ ISIPS=""
+fi
+
+# pkgadd -v
+if test "$1" = "--sh-trace" || test "$2" = "--sh-trace" || test "$3" = "--sh-trace"; then
+ set -x
+fi
+DEBUGOPT=`set -o 2>/dev/null | sed -ne 's/^xtrace *on$/--sh-trace/p'` # propagate pkgadd -v
+
+# If PKG_INSTALL_ROOT is undefined or NULL, redefine to '/' and carry on.
+${PKG_INSTALL_ROOT:=/}/opt/VirtualBox/vboxconfig.sh --preremove --fatal ${ISIPS} ${DEBUGOPT}
+
+if test "$?" -eq 0; then
+ echo "Installing new ones..."
+ $PKG_INSTALL_ROOT/opt/VirtualBox/vboxconfig.sh --postinstall ${DEBUGOPT}
+ rc=$?
+ if test "$rc" -ne 0; then
+ echo 1>&2 "## Completed but with errors."
+ rc=1
+ else
+ if test "$1" != "--srv4"; then
+ echo "Post installation completed successfully!"
+ fi
+ fi
+else
+ echo 1>&2 "## ERROR!! Failed to remove older/partially installed bits."
+ rc=1
+fi
+
+exit "$rc"
+
diff --git a/src/VBox/Installer/solaris/postinstall.sh b/src/VBox/Installer/solaris/postinstall.sh
new file mode 100755
index 00000000..c9e48f8e
--- /dev/null
+++ b/src/VBox/Installer/solaris/postinstall.sh
@@ -0,0 +1,42 @@
+#!/bin/sh
+# $Id: postinstall.sh $
+## @file
+# VirtualBox postinstall script for Solaris.
+#
+
+#
+# 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
+#
+
+rc=0
+currentzone=`zonename`
+if test "$currentzone" = "global"; then
+ DEBUGOPT=`set -o 2>/dev/null | sed -ne 's/^xtrace *on$/--sh-trace/p'` # propagate pkgadd -v
+ ${PKG_INSTALL_ROOT:=/}/opt/VirtualBox/pkginstall.sh --srv4 ${DEBUGOPT}
+ rc=$?
+fi
+
+# installf inherits ${PKG_INSTALL_ROOT} from pkgadd, no need to explicitly specify
+/usr/sbin/installf -f $PKGINST
+
+# return 20 = requires reboot, 2 = partial failure, 0 = success
+exit "$rc"
+
diff --git a/src/VBox/Installer/solaris/preremove.sh b/src/VBox/Installer/solaris/preremove.sh
new file mode 100755
index 00000000..4fb3dc95
--- /dev/null
+++ b/src/VBox/Installer/solaris/preremove.sh
@@ -0,0 +1,42 @@
+#!/bin/sh
+# $Id: preremove.sh $
+## @file
+# VirtualBox preremove script for Solaris.
+#
+
+#
+# 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
+#
+
+currentzone=`zonename`
+if test "x$currentzone" = "xglobal"; then
+ echo "Removing VirtualBox services and drivers..."
+ ${PKG_INSTALL_ROOT:=/}/opt/VirtualBox/vboxconfig.sh --preremove
+ if test "$?" -eq 0; then
+ echo "Done."
+ exit 0
+ fi
+ echo 1>&2 "## Failed."
+ exit 1
+fi
+
+exit 0
+
diff --git a/src/VBox/Installer/solaris/smf-vboxautostart.sh b/src/VBox/Installer/solaris/smf-vboxautostart.sh
new file mode 100755
index 00000000..0d72b2b1
--- /dev/null
+++ b/src/VBox/Installer/solaris/smf-vboxautostart.sh
@@ -0,0 +1,128 @@
+#!/sbin/sh
+# $Id: smf-vboxautostart.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
+#
+
+#
+# smf-vboxautostart method
+#
+# Argument is the method name (start, stop, ...)
+
+. /lib/svc/share/smf_include.sh
+
+VW_OPT="$1"
+VW_EXIT=0
+
+case $VW_OPT in
+ start)
+ if [ ! -f /opt/VirtualBox/VBoxAutostart ]; then
+ echo "ERROR: /opt/VirtualBox/VBoxAutostart does not exist."
+ return $SMF_EXIT_ERR_CONFIG
+ fi
+
+ if [ ! -x /opt/VirtualBox/VBoxAutostart ]; then
+ echo "ERROR: /opt/VirtualBox/VBoxAutostart is not exectuable."
+ return $SMF_EXIT_ERR_CONFIG
+ fi
+
+ # Get svc configuration
+ VW_CONFIG=`/usr/bin/svcprop -p config/config $SMF_FMRI 2>/dev/null`
+ [ $? != 0 ] && VW_CONFIG=
+ VW_ROTATE=`/usr/bin/svcprop -p config/logrotate $SMF_FMRI 2>/dev/null`
+ [ $? != 0 ] && VW_ROTATE=
+ VW_LOGSIZE=`/usr/bin/svcprop -p config/logsize $SMF_FMRI 2>/dev/null`
+ [ $? != 0 ] && VW_LOGSIZE=
+ VW_LOGINTERVAL=`/usr/bin/svcprop -p config/loginterval $SMF_FMRI 2>/dev/null`
+ [ $? != 0 ] && VW_LOGINTERVAL=
+ VW_VBOXGROUP=`/usr/bin/svcprop -p config/vboxgroup $SMF_FMRI 2>/dev/null`
+ [ $? != 0 ] && VW_VBOXGROUP=
+
+ # Provide sensible defaults
+ [ -z "$VW_CONFIG" ] && VW_CONFIG=/etc/vbox/autostart.cfg
+ [ -z "$VW_ROTATE" ] && VW_ROTATE=10
+ [ -z "$VW_LOGSIZE" ] && VW_LOGSIZE=104857600
+ [ -z "$VW_LOGINTERVAL" ] && VW_LOGINTERVAL=86400
+ [ -z "$VW_VBOXGROUP" ] && VW_VBOXGROUP=staff
+
+ # Get all users
+ for VW_USER in `logins -g $VW_VBOXGROUP | cut -d' ' -f1`
+ do
+ su - "$VW_USER" -c "/opt/VirtualBox/VBoxAutostart --background --start --config \"$VW_CONFIG\" --logrotate \"$VW_ROTATE\" --logsize \"$VW_LOGSIZE\" --loginterval \"$VW_LOGINTERVAL\""
+
+ VW_EXIT=$?
+ if [ $VW_EXIT != 0 ]; then
+ echo "VBoxAutostart failed with $VW_EXIT."
+ VW_EXIT=1
+ break
+ fi
+ done
+ ;;
+ stop)
+ if [ ! -f /opt/VirtualBox/VBoxAutostart ]; then
+ echo "ERROR: /opt/VirtualBox/VBoxAutostart does not exist."
+ return $SMF_EXIT_ERR_CONFIG
+ fi
+
+ if [ ! -x /opt/VirtualBox/VBoxAutostart ]; then
+ echo "ERROR: /opt/VirtualBox/VBoxAutostart is not executable."
+ return $SMF_EXIT_ERR_CONFIG
+ fi
+
+ # Get svc configuration
+ VW_CONFIG=`/usr/bin/svcprop -p config/config $SMF_FMRI 2>/dev/null`
+ [ $? != 0 ] && VW_CONFIG=
+ VW_ROTATE=`/usr/bin/svcprop -p config/logrotate $SMF_FMRI 2>/dev/null`
+ [ $? != 0 ] && VW_ROTATE=
+ VW_LOGSIZE=`/usr/bin/svcprop -p config/logsize $SMF_FMRI 2>/dev/null`
+ [ $? != 0 ] && VW_LOGSIZE=
+ VW_LOGINTERVAL=`/usr/bin/svcprop -p config/loginterval $SMF_FMRI 2>/dev/null`
+ [ $? != 0 ] && VW_LOGINTERVAL=
+ VW_VBOXGROUP=`/usr/bin/svcprop -p config/vboxgroup $SMF_FMRI 2>/dev/null`
+ [ $? != 0 ] && VW_VBOXGROUP=
+
+ # Provide sensible defaults
+ [ -z "$VW_CONFIG" ] && VW_CONFIG=/etc/vbox/autostart.cfg
+ [ -z "$VW_ROTATE" ] && VW_ROTATE=10
+ [ -z "$VW_LOGSIZE" ] && VW_LOGSIZE=104857600
+ [ -z "$VW_LOGINTERVAL" ] && VW_LOGINTERVAL=86400
+ [ -z "$VW_VBOXGROUP" ] && VW_VBOXGROUP=staff
+
+ # Get all users
+ for VW_USER in `logins -g $VW_VBOXGROUP | cut -d' ' -f1`
+ do
+ su - "$VW_USER" -c "/opt/VirtualBox/VBoxAutostart --stop --config \"$VW_CONFIG\" --logrotate \"$VW_ROTATE\" --logsize \"$VW_LOGSIZE\" --loginterval \"$VW_LOGINTERVAL\""
+
+ VW_EXIT=$?
+ if [ $VW_EXIT != 0 ]; then
+ echo "VBoxAutostart failed with $VW_EXIT."
+ VW_EXIT=1
+ break
+ fi
+ done
+ ;;
+ *)
+ VW_EXIT=$SMF_EXIT_ERR_CONFIG
+ ;;
+esac
+
+exit $VW_EXIT
diff --git a/src/VBox/Installer/solaris/smf-vboxballoonctrl.sh b/src/VBox/Installer/solaris/smf-vboxballoonctrl.sh
new file mode 100755
index 00000000..ff12b1a3
--- /dev/null
+++ b/src/VBox/Installer/solaris/smf-vboxballoonctrl.sh
@@ -0,0 +1,121 @@
+#!/sbin/sh
+# $Id: smf-vboxballoonctrl.sh $
+
+#
+# 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
+#
+
+#
+# smf-vboxballoonctrl method
+#
+# Argument is the method name (start, stop, ...)
+
+. /lib/svc/share/smf_include.sh
+
+VW_OPT="$1"
+VW_EXIT=0
+
+case $VW_OPT in
+ start)
+ if [ ! -f /opt/VirtualBox/VBoxBalloonCtrl ]; then
+ echo "ERROR: /opt/VirtualBox/VBoxBalloonCtrl does not exist."
+ return $SMF_EXIT_ERR_CONFIG
+ fi
+
+ if [ ! -x /opt/VirtualBox/VBoxBalloonCtrl ]; then
+ echo "ERROR: /opt/VirtualBox/VBoxBalloonCtrl is not executable."
+ return $SMF_EXIT_ERR_CONFIG
+ fi
+
+ # Get svc configuration
+ VBOXWATCHDOG_USER=`/usr/bin/svcprop -p config/user $SMF_FMRI 2>/dev/null`
+ [ $? != 0 ] && VBOXWATCHDOG_USER=
+ VBOXWATCHDOG_BALLOON_INTERVAL=`/usr/bin/svcprop -p config/balloon_interval $SMF_FMRI 2>/dev/null`
+ [ $? != 0 ] && VBOXWATCHDOG_BALLOON_INTERVAL=
+ VBOXWATCHDOG_BALLOON_INCREMENT=`/usr/bin/svcprop -p config/balloon_increment $SMF_FMRI 2>/dev/null`
+ [ $? != 0 ] && VBOXWATCHDOG_BALLOON_INCREMENT=
+ VBOXWATCHDOG_BALLOON_DECREMENT=`/usr/bin/svcprop -p config/balloon_decrement $SMF_FMRI 2>/dev/null`
+ [ $? != 0 ] && VBOXWATCHDOG_BALLOON_DECREMENT=
+ VBOXWATCHDOG_BALLOON_LOWERLIMIT=`/usr/bin/svcprop -p config/balloon_lowerlimit $SMF_FMRI 2>/dev/null`
+ [ $? != 0 ] && VBOXWATCHDOG_BALLOON_LOWERLIMIT=
+ VBOXWATCHDOG_BALLOON_SAFETYMARGIN=`/usr/bin/svcprop -p config/balloon_safetymargin $SMF_FMRI 2>/dev/null`
+ [ $? != 0 ] && VBOXWATCHDOG_BALLOON_SAFETYMARGIN=
+ VBOXWATCHDOG_ROTATE=`/usr/bin/svcprop -p config/logrotate $SMF_FMRI 2>/dev/null`
+ [ $? != 0 ] && VBOXWATCHDOG_ROTATE=
+ VBOXWATCHDOG_LOGSIZE=`/usr/bin/svcprop -p config/logsize $SMF_FMRI 2>/dev/null`
+ [ $? != 0 ] && VBOXWATCHDOG_LOGSIZE=
+ VBOXWATCHDOG_LOGINTERVAL=`/usr/bin/svcprop -p config/loginterval $SMF_FMRI 2>/dev/null`
+ [ $? != 0 ] && VBOXWATCHDOG_LOGINTERVAL=
+
+ # Handle legacy parameters, do not add any further ones unless absolutely necessary.
+ if [ -z "$VBOXWATCHDOG_BALLOON_INTERVAL" ]; then
+ VBOXWATCHDOG_BALLOON_INTERVAL=`/usr/bin/svcprop -p config/interval $SMF_FMRI 2>/dev/null`
+ [ $? != 0 ] && VBOXWATCHDOG_BALLOON_INTERVAL=
+ fi
+ if [ -z "$VBOXWATCHDOG_BALLOON_INCREMENT" ]; then
+ VBOXWATCHDOG_BALLOON_INCREMENT=`/usr/bin/svcprop -p config/increment $SMF_FMRI 2>/dev/null`
+ [ $? != 0 ] && VBOXWATCHDOG_BALLOON_INCREMENT=
+ fi
+ if [ -z "$VBOXWATCHDOG_BALLOON_DECREMENT" ]; then
+ VBOXWATCHDOG_BALLOON_DECREMENT=`/usr/bin/svcprop -p config/decrement $SMF_FMRI 2>/dev/null`
+ [ $? != 0 ] && VBOXWATCHDOG_BALLOON_DECREMENT=
+ fi
+ if [ -z "$VBOXWATCHDOG_BALLOON_LOWERLIMIT" ]; then
+ VBOXWATCHDOG_BALLOON_LOWERLIMIT=`/usr/bin/svcprop -p config/lowerlimit $SMF_FMRI 2>/dev/null`
+ [ $? != 0 ] && VBOXWATCHDOG_BALLOON_LOWERLIMIT=
+ fi
+ if [ -z "$VBOXWATCHDOG_BALLOON_SAFETYMARGIN" ]; then
+ VBOXWATCHDOG_BALLOON_SAFETYMARGIN=`/usr/bin/svcprop -p config/safetymargin $SMF_FMRI 2>/dev/null`
+ [ $? != 0 ] && VBOXWATCHDOG_BALLOON_SAFETYMARGIN=
+ fi
+
+ # Provide sensible defaults
+ [ -z "$VBOXWATCHDOG_USER" ] && VBOXWATCHDOG_USER=root
+
+ # Assemble the parameter list
+ PARAMS="--background"
+ [ -n "$VBOXWATCHDOG_BALLOON_INTERVAL" ] && PARAMS="$PARAMS --balloon-interval \"$VBOXWATCHDOG_BALLOON_INTERVAL\""
+ [ -n "$VBOXWATCHDOG_BALLOON_INCREMENT" ] && PARAMS="$PARAMS --balloon-inc \"$VBOXWATCHDOG_BALLOON_INCREMENT\""
+ [ -n "$VBOXWATCHDOG_BALLOON_DECREMENT" ] && PARAMS="$PARAMS --balloon-dec \"$VBOXWATCHDOG_BALLOON_DECREMENT\""
+ [ -n "$VBOXWATCHDOG_BALLOON_LOWERLIMIT" ] && PARAMS="$PARAMS --balloon-lower-limit \"$VBOXWATCHDOG_BALLOON_LOWERLIMIT\""
+ [ -n "$VBOXWATCHDOG_BALLOON_SAFETYMARGIN" ] && PARAMS="$PARAMS --balloon-safety-margin \"$VBOXWATCHDOG_BALLOON_SAFETYMARGIN\""
+ [ -n "$VBOXWATCHDOG_ROTATE" ] && PARAMS="$PARAMS -R \"$VBOXWATCHDOG_ROTATE\""
+ [ -n "$VBOXWATCHDOG_LOGSIZE" ] && PARAMS="$PARAMS -S \"$VBOXWATCHDOG_LOGSIZE\""
+ [ -n "$VBOXWATCHDOG_LOGINTERVAL" ] && PARAMS="$PARAMS -I \"$VBOXWATCHDOG_LOGINTERVAL\""
+
+ exec su - "$VBOXWATCHDOG_USER" -c "/opt/VirtualBox/VBoxBalloonCtrl $PARAMS"
+
+ VW_EXIT=$?
+ if [ $VW_EXIT != 0 ]; then
+ echo "VBoxBalloonCtrl failed with $VW_EXIT."
+ VW_EXIT=1
+ fi
+ ;;
+ stop)
+ # Kill service contract
+ smf_kill_contract $2 TERM 1
+ ;;
+ *)
+ VW_EXIT=$SMF_EXIT_ERR_CONFIG
+ ;;
+esac
+
+exit $VW_EXIT
diff --git a/src/VBox/Installer/solaris/smf-vboxwebsrv.sh b/src/VBox/Installer/solaris/smf-vboxwebsrv.sh
new file mode 100755
index 00000000..17620bdb
--- /dev/null
+++ b/src/VBox/Installer/solaris/smf-vboxwebsrv.sh
@@ -0,0 +1,146 @@
+#!/sbin/sh
+# $Id: smf-vboxwebsrv.sh $
+
+#
+# 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
+#
+
+#
+# smf-vboxwebsrv method
+#
+# Argument is the method name (start, stop, ...)
+
+. /lib/svc/share/smf_include.sh
+
+VW_OPT="$1"
+VW_EXIT=0
+
+case $VW_OPT in
+ start)
+ if [ ! -f /opt/VirtualBox/vboxwebsrv ]; then
+ echo "ERROR: /opt/VirtualBox/vboxwebsrv does not exist."
+ return $SMF_EXIT_ERR_CONFIG
+ fi
+
+ if [ ! -x /opt/VirtualBox/vboxwebsrv ]; then
+ echo "ERROR: /opt/VirtualBox/vboxwebsrv is not executable."
+ return $SMF_EXIT_ERR_CONFIG
+ fi
+
+ # Get svc configuration
+ VW_USER=`/usr/bin/svcprop -p config/user $SMF_FMRI 2>/dev/null`
+ [ $? != 0 ] && VW_USER=
+ VW_HOST=`/usr/bin/svcprop -p config/host $SMF_FMRI 2>/dev/null`
+ [ $? != 0 ] && VW_HOST=
+ VW_PORT=`/usr/bin/svcprop -p config/port $SMF_FMRI 2>/dev/null`
+ [ $? != 0 ] && VW_PORT=
+ VW_SSL_KEYFILE=`/usr/bin/svcprop -p config/ssl_keyfile $SMF_FMRI 2>/dev/null`
+ [ $? != 0 ] && VW_SSL_KEYFILE=
+ VW_SSL_PASSWORDFILE=`/usr/bin/svcprop -p config/ssl_passwordfile $SMF_FMRI 2>/dev/null`
+ [ $? != 0 ] && VW_SSL_PASSWORDFILE=
+ VW_SSL_CACERT=`/usr/bin/svcprop -p config/ssl_cacert $SMF_FMRI 2>/dev/null`
+ [ $? != 0 ] && VW_SSL_CACERT=
+ VW_SSL_CAPATH=`/usr/bin/svcprop -p config/ssl_capath $SMF_FMRI 2>/dev/null`
+ [ $? != 0 ] && VW_SSL_CAPATH=
+ VW_SSL_DHFILE=`/usr/bin/svcprop -p config/ssl_dhfile $SMF_FMRI 2>/dev/null`
+ [ $? != 0 ] && VW_SSL_DHFILE=
+ VW_SSL_RANDFILE=`/usr/bin/svcprop -p config/ssl_randfile $SMF_FMRI 2>/dev/null`
+ [ $? != 0 ] && VW_SSL_RANDFILE=
+ VW_AUTH_LIBRARY=`/usr/bin/svcprop -p config/auth_library $SMF_FMRI 2>/dev/null`
+ [ $? != 0 ] && VW_AUTH_LIBRARY=
+ VW_AUTH_PWHASH=`/usr/bin/svcprop -p config/auth_pwhash $SMF_FMRI 2>/dev/null`
+ [ $? != 0 ] && VW_AUTH_PWHASH=
+ VW_TIMEOUT=`/usr/bin/svcprop -p config/timeout $SMF_FMRI 2>/dev/null`
+ [ $? != 0 ] && VW_TIMEOUT=
+ VW_CHECK_INTERVAL=`/usr/bin/svcprop -p config/checkinterval $SMF_FMRI 2>/dev/null`
+ [ $? != 0 ] && VW_CHECK_INTERVAL=
+ VW_THREADS=`/usr/bin/svcprop -p config/threads $SMF_FMRI 2>/dev/null`
+ [ $? != 0 ] && VW_THREADS=
+ VW_KEEPALIVE=`/usr/bin/svcprop -p config/keepalive $SMF_FMRI 2>/dev/null`
+ [ $? != 0 ] && VW_KEEPALIVE=
+ VW_AUTHENTICATION=`/usr/bin/svcprop -p config/authentication $SMF_FMRI 2>/dev/null`
+ [ $? != 0 ] && VW_AUTHENTICATION=
+ VW_LOGFILE=`/usr/bin/svcprop -p config/logfile $SMF_FMRI 2>/dev/null`
+ [ $? != 0 ] && VW_LOGFILE=
+ VW_ROTATE=`/usr/bin/svcprop -p config/logrotate $SMF_FMRI 2>/dev/null`
+ [ $? != 0 ] && VW_ROTATE=
+ VW_LOGSIZE=`/usr/bin/svcprop -p config/logsize $SMF_FMRI 2>/dev/null`
+ [ $? != 0 ] && VW_LOGSIZE=
+ VW_LOGINTERVAL=`/usr/bin/svcprop -p config/loginterval $SMF_FMRI 2>/dev/null`
+ [ $? != 0 ] && VW_LOGINTERVAL=
+
+ # Provide sensible defaults
+ [ -z "$VW_USER" ] && VW_USER=root
+ [ -z "$VW_HOST" ] && VW_HOST=localhost
+ [ -z "$VW_PORT" -o "$VW_PORT" -eq 0 ] && VW_PORT=18083
+ [ -z "$VW_TIMEOUT" ] && VW_TIMEOUT=20
+ [ -z "$VW_CHECK_INTERVAL" ] && VW_CHECK_INTERVAL=5
+ [ -z "$VW_THREADS" ] && VW_THREADS=100
+ [ -z "$VW_KEEPALIVE" ] && VW_KEEPALIVE=100
+ [ -z "$VW_ROTATE" ] && VW_ROTATE=10
+ [ -z "$VW_LOGSIZE" ] && VW_LOGSIZE=104857600
+ [ -z "$VW_LOGINTERVAL" ] && VW_LOGINTERVAL=86400
+
+ # Derived and optional settings
+ VW_SSL=
+ [ -n "$VW_SSL_KEYFILE" ] && VW_SSL=--ssl
+ [ -n "$VW_SSL_KEYFILE" ] && VW_SSL_KEYFILE="--keyfile $VW_SSL_KEYFILE"
+ [ -n "$VW_SSL_PASSWORDFILE" ] && VW_SSL_PASSWORDFILE="--passwordfile $VW_SSL_PASSWORDFILE"
+ [ -n "$VW_SSL_CACERT" ] && VW_SSL_CACERT="--cacert $VW_SSL_CACERT"
+ [ -n "$VW_SSL_CAPATH" ] && VW_SSL_CAPATH="--capath $VW_SSL_CAPATH"
+ [ -n "$VW_SSL_DHFILE" ] && VW_SSL_DHFILE="--dhfile $VW_SSL_DHFILE"
+ [ -n "$VW_SSL_RANDFILE" ] && VW_SSL_RANDFILE="--randfile $VW_SSL_RANDFILE"
+ [ -n "$VW_LOGFILE" ] && VW_LOGFILE="--logfile $VW_LOGFILE"
+
+ # Set authentication method + password hash
+ if [ -n "$VW_AUTH_LIBRARY" ]; then
+ su - "$VW_USER" -c "/opt/VirtualBox/VBoxManage setproperty websrvauthlibrary \"$VW_AUTH_LIBRARY\""
+ if [ $? != 0 ]; then
+ echo "Error $? setting webservice authentication library to $VW_AUTH_LIBRARY"
+ fi
+ fi
+ if [ -n "$VW_AUTH_PWHASH" ]; then
+ su - "$VW_USER" -c "/opt/VirtualBox/VBoxManage setextradata global \"VBoxAuthSimple/users/$VW_USER\" \"$VW_AUTH_PWHASH\""
+ if [ $? != 0 ]; then
+ echo "Error $? setting webservice password hash"
+ fi
+ fi
+
+ exec su - "$VW_USER" -c "/opt/VirtualBox/vboxwebsrv --background --host \"$VW_HOST\" --port \"$VW_PORT\" $VW_SSL $VW_SSL_KEYFILE $VW_SSL_PASSWORDFILE $VW_SSL_CACERT $VW_SSL_CAPATH $VW_SSL_DHFILE $VW_SSL_RANDFILE --timeout \"$VW_TIMEOUT\" --check-interval \"$VW_CHECK_INTERVAL\" --threads \"$VW_THREADS\" --keepalive \"$VW_KEEPALIVE\" --authentication \"$VW_AUTHENTICATION\" $VW_LOGFILE --logrotate \"$VW_ROTATE\" --logsize \"$VW_LOGSIZE\" --loginterval \"$VW_LOGINTERVAL\""
+
+ VW_EXIT=$?
+ if [ $VW_EXIT != 0 ]; then
+ echo "vboxwebsrv failed with $VW_EXIT."
+ VW_EXIT=1
+ fi
+ ;;
+ stop)
+ # Kill service contract
+ smf_kill_contract $2 TERM 1
+ # Be careful: wait 1 second, making sure that everything is cleaned up.
+ smf_kill_contract $2 TERM 1
+ ;;
+ *)
+ VW_EXIT=$SMF_EXIT_ERR_CONFIG
+ ;;
+esac
+
+exit $VW_EXIT
diff --git a/src/VBox/Installer/solaris/vbox-ips.mog b/src/VBox/Installer/solaris/vbox-ips.mog
new file mode 100644
index 00000000..b5bacd49
--- /dev/null
+++ b/src/VBox/Installer/solaris/vbox-ips.mog
@@ -0,0 +1,71 @@
+# Transmogrification from prepared package directory layout to IPS
+set name=pkg.fmri value=$(VBOX_PKGNAME)@@VBOX_VERSION_STRING@,5.11-0.0.0.@VBOX_SVN_REV@.0.0.0
+set name=pkg.human-version value="@VBOX_VERSION_STRING@r@VBOX_SVN_REV@"
+set name=pkg.summary value="@VBOX_PRODUCT@"
+set name=pkg.description value="A powerful PC virtualization solution"
+set name=variant.arch value=@UNAME_P@
+set name=variant.opensolaris.zone value=global value=nonglobal
+set name=info.classification value=org.opensolaris.category.2008:System/Virtualization
+license LICENSE license="GPLv2 (virtualbox)"
+group groupname=vboxusers gid=86
+# The data-xkb was renamed to xkeyboard-config in S11.4, so adjust this when
+# we have moved our builds away from S11.3.
+depend fmri=pkg:/x11/keyboard/data-xkb type=require
+depend fmri=pkg:/system/font/xorg/xorg-core type=require
+depend fmri=pkg:/system/font/truetype/dejavu type=require
+
+# Drop system directories to not have conflicting permissions
+<transform dir path=etc$ -> drop>
+<transform dir path=opt$ -> drop>
+<transform dir path=platform.*$ -> drop>
+<transform dir path=usr.*$ -> drop>
+<transform dir path=var$ -> drop>
+<transform dir path=var/svc$ -> drop>
+<transform dir path=var/svc/manifest$ -> drop>
+<transform dir path=var/svc/manifest/application$ -> drop>
+
+# Drop all files in root, they are for packaging purposes
+<transform file path=[^/]*$ -> drop>
+<transform dir file path=vbox-repo.*$ -> drop>
+
+# Drop STREAMS based NetFilter driver, obsolete for Solaris 11
+<transform file path=platform/i86pc/kernel/drv/amd64/vboxflt$ -> drop>
+<transform file path=platform/i86pc/kernel/drv/vboxflt\.conf$ -> drop>
+
+# Drop all API helper libraries for python 2.x other than 2.7
+<transform file path=opt/VirtualBox/VBoxPython\.so.*$ -> drop>
+<transform file path=opt/VirtualBox/VBoxPython2\.so.*$ -> drop>
+<transform file path=opt/VirtualBox/VBoxPython2_[^7].*\.so.*$ -> drop>
+
+# Ignore dependencies of vboxshell.py
+<transform file path=opt/VirtualBox/vboxshell.py$ -> set pkg.depend.bypass-generate .*>
+
+# Ignore dependencies on libpython2.7.so* since it's getting phased out
+<transform file path=opt/VirtualBox/VBoxPython2_7.*\.so.*$ -> set pkg.depend.bypass-generate .*/libpython2\\.7\\.so.*>
+
+# Tweak: do not try to get the dependencies for libGL.so which is needed by Qt
+<transform file path=opt/VirtualBox/amd64/libQt5GuiVBox\.so\.5$ -> set pkg.depend.runpath /usr/lib/mesa/amd64:$PKGDEPEND_RUNPATH>
+<transform file path=opt/VirtualBox/amd64/libQt5PrintSupportVBox\.so\.5$ -> set pkg.depend.runpath /usr/lib/mesa/amd64:$PKGDEPEND_RUNPATH>
+<transform file path=opt/VirtualBox/amd64/libQt5WidgetsVBox\.so\.5$ -> set pkg.depend.runpath /usr/lib/mesa/amd64:$PKGDEPEND_RUNPATH>
+<transform file path=opt/VirtualBox/amd64/libQt5X11ExtrasVBox\.so\.5$ -> set pkg.depend.runpath /usr/lib/mesa/amd64:$PKGDEPEND_RUNPATH>
+<transform file path=opt/VirtualBox/amd64/libQt5XcbQpaVBox\.so\.5$ -> set pkg.depend.runpath /usr/lib/mesa/amd64:$PKGDEPEND_RUNPATH>
+<transform file path=opt/VirtualBox/amd64/plugins/platforms/libqxcb\.so$ -> set pkg.depend.runpath /usr/lib/mesa/amd64:$PKGDEPEND_RUNPATH>
+<transform file path=opt/VirtualBox/amd64/plugins/xcbglintegrations/libqxcb-glx-integration\.so$ -> set pkg.depend.runpath /usr/lib/mesa/amd64:$PKGDEPEND_RUNPATH>
+
+# Some binaries must be SUID.
+<transform file path=opt/VirtualBox/amd64/(VBoxNetAdpCtl|VBoxNetDHCP|VBoxNetNAT)$ -> set mode 4755>
+$(HARDENED_ONLY)<transform file path=opt/VirtualBox/amd64/(VirtualBoxVM|VBoxHeadless|VBoxSDL)$ -> set mode 4755>
+
+# Set the appropriate pkg variant for drivers (global zone only)
+<transform file path=platform/i86pc/kernel/drv/amd64/[^/]*$ -> add variant.opensolaris.zone global>
+<transform file path=platform/i86pc/kernel/drv/amd64/[^/]*$ -> set reboot-needed true>
+<transform file path=platform/i86pc/kernel/drv/amd64/vboxdrv$ -> emit driver name=vboxdrv perms="* 0600 root sys" perms="vboxdrvu 0666 root sys" devlink=type=ddi_pseudo;name=vboxdrv;minor=vboxdrv\t\D devlink=type=ddi_pseudo;name=vboxdrv;minor=vboxdrvu\t\M0>
+<transform file path=platform/i86pc/kernel/drv/amd64/vboxnet$ -> emit driver name=vboxnet>
+<transform file path=platform/i86pc/kernel/drv/amd64/vboxbow$ -> emit driver name=vboxbow>
+<transform file path=platform/i86pc/kernel/drv/amd64/vboxusbmon$ -> emit driver name=vboxusbmon perms="* 0660 root vboxusers" devlink=type=ddi_pseudo;name=vboxusbmon\t\D>
+<transform file path=platform/i86pc/kernel/drv/amd64/vboxusb$ -> emit driver name=vboxusb>
+<transform file path=platform/i86pc/kernel/drv/.*$ -> set group sys>
+
+# Handle SMF manifests
+<transform dir file path=var/svc/manifest/.*$ -> set group sys>
+<transform file path=var/svc/manifest/.*\.xml$ -> default restart_fmri svc:/system/manifest-import:default>
diff --git a/src/VBox/Installer/solaris/vbox.pkginfo b/src/VBox/Installer/solaris/vbox.pkginfo
new file mode 100644
index 00000000..cd4b66af
--- /dev/null
+++ b/src/VBox/Installer/solaris/vbox.pkginfo
@@ -0,0 +1,16 @@
+PKG="SUNWvbox"
+NAME="@VBOX_PRODUCT@"
+SUNW_PRODNAME="@VBOX_PRODUCT@"
+ARCH="@UNAME_P@"
+VERSION="@VBOX_VERSION_STRING@,REV=@VBOX_VERSION_REVSTAMP@"
+SUNW_PRODVERS="@VBOX_VERSION_STRING@"
+SUNW_PKGVERS=1.0
+CATEGORY="application"
+VENDOR="@VBOX_VENDOR@"
+HOTLINE="Please contact your local service provider"
+BASEDIR="/"
+MAXINST=1
+EMAIL="info@virtualbox.org"
+CLASSES=none manifest
+DESC="A powerful PC virtualization solution"
+PSTAMP="@VBOX_PSTAMP@"
diff --git a/src/VBox/Installer/solaris/vbox.pkgresponse b/src/VBox/Installer/solaris/vbox.pkgresponse
new file mode 100644
index 00000000..84aa86f6
--- /dev/null
+++ b/src/VBox/Installer/solaris/vbox.pkgresponse
@@ -0,0 +1,12 @@
+basedir=default
+runlevel=nocheck
+conflict=quit
+setuid=nocheck
+action=nocheck
+partial=quit
+instance=unique
+idepend=quit
+rdepend=quit
+space=quit
+mail=
+
diff --git a/src/VBox/Installer/solaris/vbox.space b/src/VBox/Installer/solaris/vbox.space
new file mode 100644
index 00000000..caf8752d
--- /dev/null
+++ b/src/VBox/Installer/solaris/vbox.space
@@ -0,0 +1,5 @@
+# Space file for VirtualBox installer
+# We only create a few links so we don't need much space
+# pathname blocks inodes
+/ 1000 8
+
diff --git a/src/VBox/Installer/solaris/vboxconfig.sh b/src/VBox/Installer/solaris/vboxconfig.sh
new file mode 100755
index 00000000..13377d99
--- /dev/null
+++ b/src/VBox/Installer/solaris/vboxconfig.sh
@@ -0,0 +1,1480 @@
+#!/bin/sh
+# $Id: vboxconfig.sh $
+## @file
+# VirtualBox Configuration Script, Solaris host.
+#
+
+#
+# Copyright (C) 2009-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
+#
+
+# Never use exit 2 or exit 20 etc., the return codes are used in
+# SRv4 postinstall procedures which carry special meaning. Just use exit 1 for failure.
+
+# LC_ALL should take precedence over LC_* and LANG but whatever...
+LC_ALL=C
+export LC_ALL
+
+LANG=C
+export LANG
+
+VBOX_INSTALL_PATH="$PKG_INSTALL_ROOT/opt/VirtualBox"
+CONFIG_DIR=/etc/vbox
+CONFIG_FILES=filelist
+DIR_CONF="$PKG_INSTALL_ROOT/platform/i86pc/kernel/drv"
+DIR_MOD_32="$PKG_INSTALL_ROOT/platform/i86pc/kernel/drv"
+DIR_MOD_64="$DIR_MOD_32/amd64"
+
+# Default paths, these will be overridden by 'which' if they don't exist
+BIN_ADDDRV=/usr/sbin/add_drv
+BIN_REMDRV=/usr/sbin/rem_drv
+BIN_MODLOAD=/usr/sbin/modload
+BIN_MODUNLOAD=/usr/sbin/modunload
+BIN_MODINFO=/usr/sbin/modinfo
+BIN_DEVFSADM=/usr/sbin/devfsadm
+BIN_BOOTADM=/sbin/bootadm
+BIN_SVCADM=/usr/sbin/svcadm
+BIN_SVCCFG=/usr/sbin/svccfg
+BIN_SVCS=/usr/bin/svcs
+BIN_IFCONFIG=/sbin/ifconfig
+BIN_SVCS=/usr/bin/svcs
+BIN_ID=/usr/bin/id
+BIN_PKILL=/usr/bin/pkill
+BIN_PGREP=/usr/bin/pgrep
+BIN_IPADM=/usr/sbin/ipadm
+
+# "vboxdrv" is also used in sed lines here (change those as well if it ever changes)
+MOD_VBOXDRV=vboxdrv
+DESC_VBOXDRV="Host"
+
+MOD_VBOXNET=vboxnet
+DESC_VBOXNET="NetAdapter"
+MOD_VBOXNET_INST=8
+
+MOD_VBOXFLT=vboxflt
+DESC_VBOXFLT="NetFilter (STREAMS)"
+
+MOD_VBOXBOW=vboxbow
+DESC_VBOXBOW="NetFilter (Crossbow)"
+
+MOD_VBOXUSBMON=vboxusbmon
+DESC_VBOXUSBMON="USBMonitor"
+
+MOD_VBOXUSB=vboxusb
+DESC_VBOXUSB="USB"
+
+UPDATEBOOTARCHIVE=0
+REMOTEINST=0
+FATALOP=fatal
+NULLOP=nulloutput
+SILENTOP=silent
+IPSOP=ips
+ISSILENT=
+ISIPS=
+
+infoprint()
+{
+ if test "x$ISSILENT" != "x$SILENTOP"; then
+ echo 1>&2 "$1"
+ fi
+}
+
+subprint()
+{
+ if test "x$ISSILENT" != "x$SILENTOP"; then
+ echo 1>&2 " - $1"
+ fi
+}
+
+warnprint()
+{
+ if test "x$ISSILENT" != "x$SILENTOP"; then
+ echo 1>&2 " * Warning!! $1"
+ fi
+}
+
+errorprint()
+{
+ echo 1>&2 "## $1"
+}
+
+helpprint()
+{
+ echo 1>&2 "$1"
+}
+
+printusage()
+{
+ helpprint "VirtualBox Configuration Script"
+ helpprint "usage: $0 <operation> [options]"
+ helpprint
+ helpprint "<operation> must be one of the following:"
+ helpprint " --postinstall Perform full post installation procedure"
+ helpprint " --preremove Perform full pre remove procedure"
+ helpprint " --installdrivers Only install the drivers"
+ helpprint " --removedrivers Only remove the drivers"
+ helpprint " --setupdrivers Setup drivers, reloads existing drivers"
+ helpprint
+ helpprint "[options] are one or more of the following:"
+ helpprint " --silent Silent mode"
+ helpprint " --fatal Don't continue on failure (required for postinstall)"
+ helpprint " --ips This is an IPS package postinstall/preremove"
+ helpprint " --altkerndir Use /usr/kernel/drv as the driver directory"
+ helpprint
+}
+
+# find_bin_path()
+# !! failure is always fatal
+find_bin_path()
+{
+ if test -z "$1"; then
+ errorprint "missing argument to find_bin_path()"
+ exit 1
+ fi
+
+ binfilename=`basename $1`
+ binfilepath=`which $binfilename 2> /dev/null`
+ if test -x "$binfilepath"; then
+ echo "$binfilepath"
+ return 0
+ else
+ errorprint "$1 missing or is not an executable"
+ exit 1
+ fi
+}
+
+# find_bins()
+# !! failure is always fatal
+find_bins()
+{
+ # Search only for binaries that might be in different locations
+ if test ! -x "$BIN_ID"; then
+ BIN_ID=`find_bin_path "$BIN_ID"`
+ fi
+
+ if test ! -x "$BIN_ADDDRV"; then
+ BIN_ADDDRV=`find_bin_path "$BIN_ADDDRV"`
+ fi
+
+ if test ! -x "$BIN_REMDRV"; then
+ BIN_REMDRV=`find_bin_path "$BIN_REMDRV"`
+ fi
+
+ if test ! -x "$BIN_MODLOAD"; then
+ BIN_MODLOAD=`check_bin_path "$BIN_MODLOAD"`
+ fi
+
+ if test ! -x "$BIN_MODUNLOAD"; then
+ BIN_MODUNLOAD=`find_bin_path "$BIN_MODUNLOAD"`
+ fi
+
+ if test ! -x "$BIN_MODINFO"; then
+ BIN_MODINFO=`find_bin_path "$BIN_MODINFO"`
+ fi
+
+ if test ! -x "$BIN_DEVFSADM"; then
+ BIN_DEVFSADM=`find_bin_path "$BIN_DEVFSADM"`
+ fi
+
+ if test ! -x "$BIN_BOOTADM"; then
+ BIN_BOOTADM=`find_bin_path "$BIN_BOOTADM"`
+ fi
+
+ if test ! -x "$BIN_SVCADM"; then
+ BIN_SVCADM=`find_bin_path "$BIN_SVCADM"`
+ fi
+
+ if test ! -x "$BIN_SVCCFG"; then
+ BIN_SVCCFG=`find_bin_path "$BIN_SVCCFG"`
+ fi
+
+ if test ! -x "$BIN_SVCS"; then
+ BIN_SVCS=`find_bin_path "$BIN_SVCS"`
+ fi
+
+ if test ! -x "$BIN_IFCONFIG"; then
+ BIN_IFCONFIG=`find_bin_path "$BIN_IFCONFIG"`
+ fi
+
+ if test ! -x "$BIN_PKILL"; then
+ BIN_PKILL=`find_bin_path "$BIN_PKILL"`
+ fi
+
+ if test ! -x "$BIN_PGREP"; then
+ BIN_PGREP=`find_bin_path "$BIN_PGREP"`
+ fi
+
+ if test ! -x "$BIN_IPADM"; then
+ BIN_IPADM=`find_bin_path "$BIN_IPADM"`
+ fi
+}
+
+# check_root()
+# !! failure is always fatal
+check_root()
+{
+ # Don't use "-u" option as some id binaries don't support it, instead
+ # rely on "uid=101(username) gid=10(groupname) groups=10(staff)" output
+ curuid=`$BIN_ID | cut -f 2 -d '=' | cut -f 1 -d '('`
+ if test "$curuid" -ne 0; then
+ errorprint "This script must be run with administrator privileges."
+ exit 1
+ fi
+}
+
+# get_unofficial_sysinfo()
+# cannot fail
+get_unofficial_sysinfo()
+{
+ HOST_OS_MAJORVERSION="11"
+ HOST_OS_MINORVERSION="151"
+}
+
+# get_s11_4_sysinfo()
+# cannot fail
+get_s11_4_sysinfo()
+{
+ # See check in plumb_net for why this is > 174. The alternative is we declare 11.4+ as S12 with
+ # a more accurate minor (build) version number. For now this is sufficient to workaround the ever
+ # changing version numbering policy.
+ HOST_OS_MAJORVERSION="11"
+ HOST_OS_MINORVERSION="175"
+}
+
+# get_s11_5_or_newer_sysinfo()
+# cannot fail
+get_s11_5_or_newer_sysinfo()
+{
+ # See check in plumb_net for why this is 176.
+ HOST_OS_MAJORVERSION="11"
+ HOST_OS_MINORVERSION="176"
+}
+
+# get_sysinfo()
+# cannot fail
+get_sysinfo()
+{
+ STR_OSVER=`uname -v`
+ case "$STR_OSVER" in
+ # First check 'uname -v' and weed out the recognized, unofficial distros of Solaris
+ omnios*|oi_*|illumos*)
+ get_unofficial_sysinfo
+ return 0
+ ;;
+ # Quick escape workaround for Solaris 11.4, changes the pkg FMRI (yet again). See BugDB #26494983.
+ 11.4.*)
+ get_s11_4_sysinfo
+ return 0
+ ;;
+ # Quick escape workaround for Solaris 11.5. See BugDB #26494983.
+ 11.5.*)
+ get_s11_5_or_newer_sysinfo
+ return 0
+ esac
+
+ BIN_PKG=`which pkg 2> /dev/null`
+ if test -x "$BIN_PKG"; then
+ PKGFMRI=`$BIN_PKG $BASEDIR_PKGOPT contents -H -t set -a name=pkg.fmri -o pkg.fmri pkg:/system/kernel 2> /dev/null`
+ if test -z "$PKGFMRI"; then
+ # Perhaps this is old pkg without '-a' option and/or system/kernel is missing and it's part of 'entire'
+ # Try fallback.
+ PKGFMRI=`$BIN_PKG $BASEDIR_PKGOPT contents -H -t set -o pkg.fmri entire | head -1 2> /dev/null`
+ if test -z "$PKGFMRI"; then
+ # Perhaps entire is conflicting. Try using opensolaris/entire.
+ # Last fallback try.
+ PKGFMRI=`$BIN_PKG $BASEDIR_PKGOPT contents -H -t set -o pkg.fmri opensolaris.org/entire | head -1 2> /dev/null`
+ fi
+ fi
+ if test ! -z "$PKGFMRI"; then
+ # The format is "pkg://solaris/system/kernel@0.5.11,5.11-0.161:20110315T070332Z"
+ # or "pkg://solaris/system/kernel@5.12,5.11-5.12.0.0.0.4.1:20120908T030246Z"
+ # or "pkg://solaris/system/kernel@0.5.11,5.11-0.175.0.0.0.1.0:20111012T032837Z"
+ # or "pkg://solaris/system/kernel@5.12-5.12.0.0.0.9.1.3.0:20121012T032837Z" [1]
+ # [1]: The sed below doesn't handle this. It's instead parsed below in the PSARC/2012/240 case.
+ STR_KERN_MAJOR=`echo "$PKGFMRI" | sed 's/^.*\@//;s/\,.*//'`
+ if test ! -z "$STR_KERN_MAJOR"; then
+ # The format is "0.5.11" or "5.12"
+ # Let us just hardcode these for now, instead of trying to do things more generically. It's not
+ # worth trying to bring more order to chaos as it's clear that the version numbering is subject to breakage
+ # as it has been seen in the past.
+ if test "x$STR_KERN_MAJOR" = "x5.12"; then
+ HOST_OS_MAJORVERSION="12"
+ elif test "x$STR_KERN_MAJOR" = "x0.5.11" || test "x$STR_KERN_MAJOR" = "x5.11"; then
+ HOST_OS_MAJORVERSION="11"
+ else
+ # This could be the PSARC/2012/240 naming scheme for S12.
+ # The format is "pkg://solaris/system/kernel@5.12-5.12.0.0.0.9.1.3.0:20121012T032837Z"
+ # The "5.12" following the "@" is the nominal version which we ignore for now as it is
+ # not set by most pkg(5) tools...
+ # STR_KERN_MAJOR is now of the format "5.12-5.12.0.0.0.9.1.3.0:20121012T032837Z" with '9' representing
+ # the build number.
+ BRANCH_VERSION=$STR_KERN_MAJOR
+ HOST_OS_MAJORVERSION=`echo "$BRANCH_VERSION" | cut -f2 -d'-' | cut -f1,2 -d'.'`
+ if test "x$HOST_OS_MAJORVERSION" = "x5.12"; then
+ HOST_OS_MAJORVERSION="12"
+ HOST_OS_MINORVERSION=`echo "$BRANCH_VERSION" | cut -f2 -d'-' | cut -f6 -d'.'`
+ return 0
+ else
+ errorprint "Failed to parse the Solaris kernel major version."
+ exit 1
+ fi
+ fi
+
+ # This applies only to S11 and S12 where the transitional "@5.12," component version is
+ # still part of the pkg(5) package FMRI. The regular S12 will follow the PSARC/2012/240 naming scheme above.
+ STR_KERN_MINOR=`echo "$PKGFMRI" | sed 's/^.*\@//;s/\:.*//;s/.*,//'`
+ if test ! -z "$STR_KERN_MINOR"; then
+ # The HOST_OS_MINORVERSION is represented as follows:
+ # For S12 it represents the build numbers. e.g. for 4 : "5.11-5.12.0.0.0.4.1"
+ # For S11 as the "nevada" version numbers. e.g. for 175: "5.11-0.161" or "5.11-0.175.0.0.0.1.0"
+ if test "$HOST_OS_MAJORVERSION" -eq 12; then
+ HOST_OS_MINORVERSION=`echo "$STR_KERN_MINOR" | cut -f2 -d'-' | cut -f6 -d'.'`
+ elif test "$HOST_OS_MAJORVERSION" -eq 11; then
+ HOST_OS_MINORVERSION=`echo "$STR_KERN_MINOR" | cut -f2 -d'-' | cut -f2 -d'.'`
+ else
+ errorprint "Solaris kernel major version $HOST_OS_MAJORVERSION not supported."
+ exit 1
+ fi
+ else
+ errorprint "Failed to parse the Solaris kernel minor version."
+ exit 1
+ fi
+ else
+ errorprint "Failed to parse the Solaris kernel package version."
+ exit 1
+ fi
+ else
+ errorprint "Failed to detect the Solaris kernel package FMRI."
+ exit 1
+ fi
+ else
+ HOST_OS_MAJORVERSION=`uname -r`
+ if test -z "$HOST_OS_MAJORVERSION" || test "x$HOST_OS_MAJORVERSION" != "x5.10"; then
+ # S11 without 'pkg'?? Something's wrong... bail.
+ errorprint "Solaris $HOST_OS_MAJORVERSION detected without executable $BIN_PKG !? I are confused."
+ exit 1
+ fi
+ HOST_OS_MAJORVERSION="10"
+ if test "$REMOTEINST" -eq 0; then
+ # Use uname to verify it's S10.
+ # Major version is S10, Minor version is no longer relevant (or used), use uname -v so it gets something
+ # like "Generic_blah" for purely cosmetic purposes
+ HOST_OS_MINORVERSION=`uname -v`
+ else
+ # Remote installs from S10 local.
+ BIN_PKGCHK=`which pkgchk 2> /dev/null`
+ if test ! -x "$BIN_PKGCHK"; then
+ errorprint "Failed to find an executable pkgchk binary $BIN_PKGCHK."
+ errorprint "Cannot determine Solaris version on remote target $PKG_INSTALL_ROOT"
+ exit 1
+ fi
+
+ REMOTE_S10=`$BIN_PKGCHK -l -p /kernel/amd64/genunix $BASEDIR_PKGOPT 2> /dev/null | grep SUNWckr | tr -d ' \t'`
+ if test ! -z "$REMOTE_S10" && test "x$REMOTE_S10" = "xSUNWckr"; then
+ HOST_OS_MAJORVERSION="10"
+ HOST_OS_MINORVERSION=""
+ else
+ errorprint "Remote target $PKG_INSTALL_ROOT is not Solaris 10."
+ errorprint "Will not attempt to install to an unidentified remote target."
+ exit 1
+ fi
+ fi
+ fi
+}
+
+# check_zone()
+# !! failure is always fatal
+check_zone()
+{
+ currentzone=`zonename`
+ if test "x$currentzone" != "xglobal"; then
+ errorprint "This script must be run from the global zone."
+ exit 1
+ fi
+}
+
+# check_isa()
+# !! failure is always fatal
+check_isa()
+{
+ currentisa=`uname -i`
+ if test "x$currentisa" = "xi86xpv"; then
+ errorprint "VirtualBox cannot run under xVM Dom0! Fatal Error, Aborting installation!"
+ exit 1
+ fi
+}
+
+# check_module_arch()
+# !! failure is always fatal
+check_module_arch()
+{
+ cputype=`isainfo -k`
+ if test "x$cputype" != "xamd64" && test "x$cputype" != "xi386"; then
+ errorprint "VirtualBox works only on i386/amd64 hosts, not $cputype"
+ exit 1
+ fi
+}
+
+# update_boot_archive()
+# cannot fail
+update_boot_archive()
+{
+ infoprint "Updating the boot archive..."
+ if test "$REMOTEINST" -eq 0; then
+ $BIN_BOOTADM update-archive > /dev/null
+ else
+ $BIN_BOOTADM update-archive -R "$PKG_INSTALL_ROOT" > /dev/null
+ fi
+ UPDATEBOOTARCHIVE=0
+}
+
+
+# module_added(modname)
+# returns 1 if added, 0 otherwise
+module_added()
+{
+ if test -z "$1"; then
+ errorprint "missing argument to module_added()"
+ exit 1
+ fi
+
+ # Add a space at end of module name to make sure we have a perfect match to avoid
+ # any substring matches: e.g "vboxusb" & "vboxusbmon"
+ loadentry=`cat "$PKG_INSTALL_ROOT/etc/name_to_major" | grep "$1 "`
+ if test -z "$loadentry"; then
+ return 1
+ fi
+ return 0
+}
+
+# module_loaded(modname)
+# returns 1 if loaded, 0 otherwise
+module_loaded()
+{
+ if test -z "$1"; then
+ errorprint "missing argument to module_loaded()"
+ exit 1
+ fi
+
+ modname=$1
+ # modinfo should now work properly since we prevent module autounloading.
+ loadentry=`$BIN_MODINFO | grep "$modname "`
+ if test -z "$loadentry"; then
+ return 1
+ fi
+ return 0
+}
+
+# add_driver(modname, moddesc, fatal, nulloutput, [driverperm])
+# failure: depends on "fatal"
+add_driver()
+{
+ if test -z "$1" || test -z "$2"; then
+ errorprint "missing argument to add_driver()"
+ exit 1
+ fi
+
+ modname="$1"
+ moddesc="$2"
+ fatal="$3"
+ nullop="$4"
+ modperm="$5"
+
+ if test -n "$modperm"; then
+ if test "x$nullop" = "x$NULLOP"; then
+ $BIN_ADDDRV $BASEDIR_OPT -m"$modperm" $modname >/dev/null 2>&1
+ else
+ $BIN_ADDDRV $BASEDIR_OPT -m"$modperm" $modname
+ fi
+ else
+ if test "x$nullop" = "x$NULLOP"; then
+ $BIN_ADDDRV $BASEDIR_OPT $modname >/dev/null 2>&1
+ else
+ $BIN_ADDDRV $BASEDIR_OPT $modname
+ fi
+ fi
+
+ if test "$?" -ne 0; then
+ subprint "Adding: $moddesc module ...FAILED!"
+ if test "x$fatal" = "x$FATALOP"; then
+ exit 1
+ fi
+ return 1
+ fi
+ subprint "Added: $moddesc driver"
+ return 0
+}
+
+# rem_driver(modname, moddesc, [fatal])
+# failure: depends on [fatal]
+rem_driver()
+{
+ if test -z "$1" || test -z "$2"; then
+ errorprint "missing argument to rem_driver()"
+ exit 1
+ fi
+
+ modname=$1
+ moddesc=$2
+ fatal=$3
+
+ module_added $modname
+ if test "$?" -eq 0; then
+ UPDATEBOOTARCHIVE=1
+ if test "x$ISIPS" != "x$IPSOP"; then
+ $BIN_REMDRV $BASEDIR_OPT $modname
+ else
+ $BIN_REMDRV $BASEDIR_OPT $modname >/dev/null 2>&1
+ fi
+ # for remote installs, don't bother with return values of rem_drv
+ if test "$?" -eq 0 || test "$REMOTEINST" -eq 1; then
+ subprint "Removed: $moddesc driver"
+ return 0
+ else
+ subprint "Removing: $moddesc ...FAILED!"
+ if test "x$fatal" = "x$FATALOP"; then
+ exit 1
+ fi
+ return 1
+ fi
+ fi
+}
+
+# unload_module(modname, moddesc, retry, [fatal])
+# failure: fatal
+unload_module()
+{
+ if test -z "$1" || test -z "$2"; then
+ errorprint "missing argument to unload_module()"
+ exit 1
+ fi
+
+ # No-OP for non-root installs
+ if test "$REMOTEINST" -eq 1; then
+ return 0
+ fi
+
+ modname=$1
+ moddesc=$2
+ retry=$3
+ fatal=$4
+ modid=`$BIN_MODINFO | grep "$modname " | cut -f 1 -d ' ' `
+ if test -n "$modid"; then
+ $BIN_MODUNLOAD -i $modid
+ if test "$?" -eq 0; then
+ subprint "Unloaded: $moddesc module"
+ else
+ #
+ # Hack for vboxdrv. Delayed removing when VMM thread-context hooks are used.
+ # Our automated tests are probably too quick... Fix properly later.
+ #
+ result="$?"
+ if test "$retry" -eq 1; then
+ cmax=15
+ cslept=0
+ while test "$result" -ne 0;
+ do
+ subprint "Unloading: $moddesc module ...FAILED! Busy? Retrying in 3 seconds..."
+ sleep 3
+ cslept=`expr $cslept + 3`
+ if test "$cslept" -ge "$cmax"; then
+ break
+ fi
+ $BIN_MODUNLOAD -i $modid
+ result="$?"
+ done
+ fi
+
+ if test "$result" -ne 0; then
+ subprint "Unloading: $moddesc module ...FAILED!"
+ if test "x$fatal" = "x$FATALOP"; then
+ exit 1
+ fi
+ else
+ subprint "Unloaded: $moddesc module"
+ fi
+ return 1
+ fi
+ fi
+ return 0
+}
+
+# load_module(modname, moddesc, [fatal])
+# pass "drv/modname" or "misc/vbi" etc.
+# failure: fatal
+load_module()
+{
+ if test -z "$1" || test -z "$2"; then
+ errorprint "missing argument to load_module()"
+ exit 1
+ fi
+
+ # No-OP for non-root installs
+ if test "$REMOTEINST" -eq 1; then
+ return 0
+ fi
+
+ modname=$1
+ moddesc=$2
+ fatal=$3
+ $BIN_MODLOAD -p $modname
+ if test "$?" -eq 0; then
+ return 0
+ else
+ subprint "Loading: $moddesc module ...FAILED!"
+ if test "x$fatal" = "x$FATALOP"; then
+ exit 1
+ fi
+ return 1
+ fi
+}
+
+load_vboxflt()
+{
+ if test -f "$DIR_CONF/vboxflt.conf"; then
+ add_driver "$MOD_VBOXFLT" "$DESC_VBOXFLT" "$FATALOP"
+ load_module "drv/$MOD_VBOXFLT" "$DESC_VBOXFLT" "$FATALOP"
+ else
+ # For custom pkgs that optionally ship this module, let's not fail but just warn
+ warnprint "$DESC_VBOXFLT installation requested but not shipped in this package."
+ fi
+}
+
+load_vboxbow()
+{
+ if test -f "$DIR_CONF/vboxbow.conf"; then
+ add_driver "$MOD_VBOXBOW" "$DESC_VBOXBOW" "$FATALOP"
+ load_module "drv/$MOD_VBOXBOW" "$DESC_VBOXBOW" "$FATALOP"
+ else
+ # For custom pkgs that optionally ship this module, let's not fail but just warn
+ warnprint "$DESC_VBOXBOW installation requested but not shipped in this package."
+ fi
+}
+
+# install_drivers()
+# !! failure is always fatal
+install_drivers()
+{
+ if test -f "$DIR_CONF/vboxdrv.conf"; then
+ if test -n "_HARDENED_"; then
+ add_driver "$MOD_VBOXDRV" "$DESC_VBOXDRV" "$FATALOP" "not-$NULLOP" "'* 0600 root sys','vboxdrvu 0666 root sys'"
+ else
+ add_driver "$MOD_VBOXDRV" "$DESC_VBOXDRV" "$FATALOP" "not-$NULLOP" "'* 0666 root sys','vboxdrvu 0666 root sys'"
+ fi
+ load_module "drv/$MOD_VBOXDRV" "$DESC_VBOXDRV" "$FATALOP"
+ else
+ errorprint "Extreme error! Missing $DIR_CONF/vboxdrv.conf, aborting."
+ return 1
+ fi
+
+ # Figure out group to use for /etc/devlink.tab (before Solaris 11 SRU6
+ # it was always using group sys)
+ group=sys
+ if [ -f "$PKG_INSTALL_ROOT/etc/dev/reserved_devnames" ]; then
+ # Solaris 11 SRU6 and later use group root (check a file which isn't
+ # tainted by VirtualBox install scripts and allow no other group)
+ refgroup=`LC_ALL=C /usr/bin/ls -lL "$PKG_INSTALL_ROOT/etc/dev/reserved_devnames" | awk '{ print $4 }' 2>/dev/null`
+ if [ $? -eq 0 -a "x$refgroup" = "xroot" ]; then
+ group=root
+ fi
+ unset refgroup
+ fi
+
+ ## Add vboxdrv to devlink.tab (KEEP TABS!)
+ if test -f "$PKG_INSTALL_ROOT/etc/devlink.tab"; then
+ sed -e '/name=vboxdrv/d' -e '/name=vboxdrvu/d' "$PKG_INSTALL_ROOT/etc/devlink.tab" > "$PKG_INSTALL_ROOT/etc/devlink.vbox"
+ echo "type=ddi_pseudo;name=vboxdrv;minor=vboxdrv \D" >> "$PKG_INSTALL_ROOT/etc/devlink.vbox"
+ echo "type=ddi_pseudo;name=vboxdrv;minor=vboxdrvu \M0" >> "$PKG_INSTALL_ROOT/etc/devlink.vbox"
+ chmod 0644 "$PKG_INSTALL_ROOT/etc/devlink.vbox"
+ chown root:$group "$PKG_INSTALL_ROOT/etc/devlink.vbox"
+ mv -f "$PKG_INSTALL_ROOT/etc/devlink.vbox" "$PKG_INSTALL_ROOT/etc/devlink.tab"
+ else
+ errorprint "Missing $PKG_INSTALL_ROOT/etc/devlink.tab, aborting install"
+ return 1
+ fi
+
+ # Create the device link for non-remote installs (not really relevant any more)
+ if test "$REMOTEINST" -eq 0; then
+ /usr/sbin/devfsadm -i "$MOD_VBOXDRV"
+ if test "$?" -ne 0 || test ! -h "/dev/vboxdrv" || test ! -h "/dev/vboxdrvu" ; then
+ errorprint "Failed to create device link for $MOD_VBOXDRV."
+ exit 1
+ fi
+ fi
+
+ # Load VBoxNetAdp
+ if test -f "$DIR_CONF/vboxnet.conf"; then
+ add_driver "$MOD_VBOXNET" "$DESC_VBOXNET" "$FATALOP"
+ load_module "drv/$MOD_VBOXNET" "$DESC_VBOXNET" "$FATALOP"
+ fi
+
+ # If both vboxinst_vboxbow and vboxinst_vboxflt exist, bail.
+ if test -f "$PKG_INSTALL_ROOT/etc/vboxinst_vboxflt" && test -f "$PKG_INSTALL_ROOT/etc/vboxinst_vboxbow"; then
+ errorprint "Force-install files '$PKG_INSTALL_ROOT/etc/vboxinst_vboxflt' and '$PKG_INSTALL_ROOT/etc/vboxinst_vboxbow' both exist."
+ errorprint "Cannot load $DESC_VBOXFLT and $DESC_VBOXBOW drivers at the same time."
+ return 1
+ fi
+
+ # If the force-install files exists, install blindly
+ if test -f "$PKG_INSTALL_ROOT/etc/vboxinst_vboxflt"; then
+ subprint "Detected: Force-load file $PKG_INSTALL_ROOT/etc/vboxinst_vboxflt."
+ load_vboxflt
+ elif test -f "$PKG_INSTALL_ROOT/etc/vboxinst_vboxbow"; then
+ subprint "Detected: Force-load file $PKG_INSTALL_ROOT/etc/vboxinst_vboxbow."
+ load_vboxbow
+ else
+ # If host is S10 or S11 (< snv_159) or vboxbow isn't shipped, then load vboxflt
+ if test "$HOST_OS_MAJORVERSION" -eq 10 \
+ || (test "$HOST_OS_MAJORVERSION" -eq 11 && test "$HOST_OS_MINORVERSION" -lt 159) \
+ || test ! -f "$DIR_CONF/vboxbow.conf"; then
+ load_vboxflt
+ else
+ # For S11 snv_159+ load vboxbow
+ load_vboxbow
+ fi
+ fi
+
+ # Load VBoxUSBMon, VBoxUSB
+ try_vboxusb="no"
+ if test -f "$DIR_CONF/vboxusbmon.conf"; then
+ if test -f "$PKG_INSTALL_ROOT/etc/vboxinst_vboxusb"; then
+ subprint "Detected: Force-load file $PKG_INSTALL_ROOT/etc/vboxinst_vboxusb."
+ try_vboxusb="yes"
+ else
+ # For VirtualBox 3.1 the new USB code requires Nevada > 123 i.e. S12+ or S11 b124+
+ if test "$HOST_OS_MAJORVERSION" -gt 11 \
+ || (test "$HOST_OS_MAJORVERSION" -eq 11 && test "$HOST_OS_MINORVERSION" -gt 123); then
+ try_vboxusb="yes"
+ else
+ warnprint "Solaris 11 build 124 or higher required for USB support. Skipped installing USB support."
+ fi
+ fi
+ fi
+ if test "x$try_vboxusb" = "xyes"; then
+ # Add a group "vboxuser" (8-character limit) for USB access.
+ # All users which need host USB-passthrough support will have to be added to this group.
+ groupadd vboxuser >/dev/null 2>&1
+
+ add_driver "$MOD_VBOXUSBMON" "$DESC_VBOXUSBMON" "$FATALOP" "not-$NULLOP" "'* 0666 root sys'"
+ load_module "drv/$MOD_VBOXUSBMON" "$DESC_VBOXUSBMON" "$FATALOP"
+
+ chown root:vboxuser "/devices/pseudo/vboxusbmon@0:vboxusbmon"
+
+ # Add vboxusbmon to devlink.tab
+ sed -e '/name=vboxusbmon/d' "$PKG_INSTALL_ROOT/etc/devlink.tab" > "$PKG_INSTALL_ROOT/etc/devlink.vbox"
+ echo "type=ddi_pseudo;name=vboxusbmon \D" >> "$PKG_INSTALL_ROOT/etc/devlink.vbox"
+ chmod 0644 "$PKG_INSTALL_ROOT/etc/devlink.vbox"
+ chown root:$group "$PKG_INSTALL_ROOT/etc/devlink.vbox"
+ mv -f "$PKG_INSTALL_ROOT/etc/devlink.vbox" "$PKG_INSTALL_ROOT/etc/devlink.tab"
+
+ # Create the device link for non-remote installs
+ if test "$REMOTEINST" -eq 0; then
+ /usr/sbin/devfsadm -i "$MOD_VBOXUSBMON"
+ if test "$?" -ne 0; then
+ errorprint "Failed to create device link for $MOD_VBOXUSBMON."
+ exit 1
+ fi
+ fi
+
+ # Add vboxusb if present
+ # This driver is special, we need it in the boot-archive but since there is no
+ # USB device to attach to now (it's done at runtime) it will fail to attach so
+ # redirect attaching failure output to /dev/null
+ if test -f "$DIR_CONF/vboxusb.conf"; then
+ add_driver "$MOD_VBOXUSB" "$DESC_VBOXUSB" "$FATALOP" "$NULLOP"
+ load_module "drv/$MOD_VBOXUSB" "$DESC_VBOXUSB" "$FATALOP"
+ fi
+ fi
+
+ return $?
+}
+
+# remove_drivers([fatal])
+# failure: depends on [fatal]
+remove_drivers()
+{
+ fatal=$1
+
+ # Figure out group to use for /etc/devlink.tab (before Solaris 11 SRU6
+ # it was always using group sys)
+ group=sys
+ if [ -f "$PKG_INSTALL_ROOT/etc/dev/reserved_devnames" ]; then
+ # Solaris 11 SRU6 and later use group root (check a file which isn't
+ # tainted by VirtualBox install scripts and allow no other group)
+ refgroup=`LC_ALL=C /usr/bin/ls -lL "$PKG_INSTALL_ROOT/etc/dev/reserved_devnames" | awk '{ print $4 }' 2>/dev/null`
+ if [ $? -eq 0 -a "x$refgroup" = "xroot" ]; then
+ group=root
+ fi
+ unset refgroup
+ fi
+
+ # Remove vboxdrv[u] from devlink.tab
+ if test -f "$PKG_INSTALL_ROOT/etc/devlink.tab"; then
+ devlinkfound=`cat "$PKG_INSTALL_ROOT/etc/devlink.tab" | grep vboxdrv`
+ if test -n "$devlinkfound"; then
+ sed -e '/name=vboxdrv/d' -e '/name=vboxdrvu/d' "$PKG_INSTALL_ROOT/etc/devlink.tab" > "$PKG_INSTALL_ROOT/etc/devlink.vbox"
+ chmod 0644 "$PKG_INSTALL_ROOT/etc/devlink.vbox"
+ chown root:$group "$PKG_INSTALL_ROOT/etc/devlink.vbox"
+ mv -f "$PKG_INSTALL_ROOT/etc/devlink.vbox" "$PKG_INSTALL_ROOT/etc/devlink.tab"
+ fi
+
+ # Remove vboxusbmon from devlink.tab
+ devlinkfound=`cat "$PKG_INSTALL_ROOT/etc/devlink.tab" | grep vboxusbmon`
+ if test -n "$devlinkfound"; then
+ sed -e '/name=vboxusbmon/d' "$PKG_INSTALL_ROOT/etc/devlink.tab" > "$PKG_INSTALL_ROOT/etc/devlink.vbox"
+ chmod 0644 "$PKG_INSTALL_ROOT/etc/devlink.vbox"
+ chown root:$group "$PKG_INSTALL_ROOT/etc/devlink.vbox"
+ mv -f "$PKG_INSTALL_ROOT/etc/devlink.vbox" "$PKG_INSTALL_ROOT/etc/devlink.tab"
+ fi
+ fi
+
+ unload_module "$MOD_VBOXUSB" "$DESC_VBOXUSB" 0 "$fatal"
+ rem_driver "$MOD_VBOXUSB" "$DESC_VBOXUSB" "$fatal"
+
+ unload_module "$MOD_VBOXUSBMON" "$DESC_VBOXUSBMON" 0 "$fatal"
+ rem_driver "$MOD_VBOXUSBMON" "$DESC_VBOXUSBMON" "$fatal"
+
+ unload_module "$MOD_VBOXFLT" "$DESC_VBOXFLT" 0 "$fatal"
+ rem_driver "$MOD_VBOXFLT" "$DESC_VBOXFLT" "$fatal"
+
+ unload_module "$MOD_VBOXBOW" "$DESC_VBOXBOW" 0 "$fatal"
+ rem_driver "$MOD_VBOXBOW" "$DESC_VBOXBOW" "$fatal"
+
+ unload_module "$MOD_VBOXNET" "$DESC_VBOXNET" 0 "$fatal"
+ rem_driver "$MOD_VBOXNET" "$DESC_VBOXNET" "$fatal"
+
+ unload_module "$MOD_VBOXDRV" "$DESC_VBOXDRV" 1 "$fatal"
+ rem_driver "$MOD_VBOXDRV" "$DESC_VBOXDRV" "$fatal"
+
+ # remove devlinks
+ if test -h "$PKG_INSTALL_ROOT/dev/vboxdrv" || test -f "$PKG_INSTALL_ROOT/dev/vboxdrv"; then
+ rm -f "$PKG_INSTALL_ROOT/dev/vboxdrv"
+ fi
+ if test -h "$PKG_INSTALL_ROOT/dev/vboxdrvu" || test -f "$PKG_INSTALL_ROOT/dev/vboxdrvu"; then
+ rm -f "$PKG_INSTALL_ROOT/dev/vboxdrvu"
+ fi
+ if test -h "$PKG_INSTALL_ROOT/dev/vboxusbmon" || test -f "$PKG_INSTALL_ROOT/dev/vboxusbmon"; then
+ rm -f "$PKG_INSTALL_ROOT/dev/vboxusbmon"
+ fi
+
+ # unpatch nwam/dhcpagent fix
+ nwamfile="$PKG_INSTALL_ROOT/etc/nwam/llp"
+ nwambackupfile=$nwamfile.vbox
+ if test -f "$nwamfile"; then
+ sed -e '/vboxnet/d' $nwamfile > $nwambackupfile
+ mv -f $nwambackupfile $nwamfile
+ fi
+
+ # remove netmask configuration
+ if test -h "$PKG_INSTALL_ROOT/etc/netmasks"; then
+ nmaskfile="$PKG_INSTALL_ROOT/etc/inet/netmasks"
+ else
+ nmaskfile="$PKG_INSTALL_ROOT/etc/netmasks"
+ fi
+ nmaskbackupfile=$nmaskfile.vbox
+ if test -f "$nmaskfile"; then
+ sed -e '/#VirtualBox_SectionStart/,/#VirtualBox_SectionEnd/d' $nmaskfile > $nmaskbackupfile
+ mv -f $nmaskbackupfile $nmaskfile
+ fi
+
+ if test $UPDATEBOOTARCHIVE -eq 1; then
+ update_boot_archive
+ fi
+
+ return 0
+}
+
+# install_python_bindings(pythonbin pythondesc)
+# failure: non fatal
+install_python_bindings()
+{
+ pythonbin="$1"
+ pythondesc="$2"
+
+ # The python binary might not be there, so just exit silently
+ if test -z "$pythonbin"; then
+ return 0
+ fi
+
+ if test -z "$pythondesc"; then
+ errorprint "missing argument to install_python_bindings"
+ return 1
+ fi
+
+ infoprint "Python found: $pythonbin, installing bindings..."
+
+ # check if python has working distutils
+ "$pythonbin" -c "from distutils.core import setup" > /dev/null 2>&1
+ if test "$?" -ne 0; then
+ subprint "Skipped: $pythondesc install is unusable, missing package 'distutils'"
+ return 0
+ fi
+
+ # Pass install path via environment
+ export VBOX_INSTALL_PATH
+ mkdir -p "$CONFIG_DIR"
+ rm -f "$CONFIG_DIR/python-$CONFIG_FILES"
+ $SHELL -c "cd \"$VBOX_INSTALL_PATH\"/sdk/installer && \"$pythonbin\" ./vboxapisetup.py install \
+ --record \"$CONFIG_DIR/python-$CONFIG_FILES\"" > /dev/null 2>&1
+ if test "$?" -eq 0; then
+ cat "$CONFIG_DIR/python-$CONFIG_FILES" >> "$CONFIG_DIR/$CONFIG_FILES"
+ else
+ errorprint "Failed to install bindings for $pythondesc"
+ fi
+ rm "$CONFIG_DIR/python-$CONFIG_FILES"
+
+ # Remove files created by Python API setup.
+ rm -rf $VBOX_INSTALL_PATH/sdk/installer/build
+ return 0
+}
+
+# is_process_running(processname)
+# returns 1 if the process is running, 0 otherwise
+is_process_running()
+{
+ if test -z "$1"; then
+ errorprint "missing argument to is_process_running()"
+ exit 1
+ fi
+
+ procname="$1"
+ $BIN_PGREP "$procname" > /dev/null 2>&1
+ if test "$?" -eq 0; then
+ return 1
+ fi
+ return 0
+}
+
+
+# stop_process(processname)
+# failure: depends on [fatal]
+stop_process()
+{
+ if test -z "$1"; then
+ errorprint "missing argument to stop_process()"
+ exit 1
+ fi
+
+ procname="$1"
+ is_process_running "$procname"
+ if test "$?" -eq 1; then
+ $BIN_PKILL "$procname"
+ sleep 2
+ is_process_running "$procname"
+ if test "$?" -eq 1; then
+ subprint "Terminating: $procname ...FAILED!"
+ if test "x$fatal" = "x$FATALOP"; then
+ exit 1
+ fi
+ else
+ subprint "Terminated: $procname"
+ fi
+ fi
+}
+
+# start_service(servicename, shortFMRI pretty printing, full FMRI, log-file path)
+# failure: non-fatal
+start_service()
+{
+ if test -z "$1" || test -z "$2" || test -z "$3" || test -z "$4"; then
+ errorprint "missing argument to enable_service()"
+ exit 1
+ fi
+
+ # Since S11 the way to import a manifest is via restarting manifest-import which is asynchronous and can
+ # take a while to complete, using disable/enable -s doesn't work either. So we restart it, and poll in
+ # 1 second intervals to see if our service has been successfully imported and timeout after 'cmax' seconds.
+ cmax=32
+ cslept=0
+ success=0
+
+ $BIN_SVCS "$3" >/dev/null 2>&1
+ while test "$?" -ne 0;
+ do
+ sleep 1
+ cslept=`expr $cslept + 1`
+ if test "$cslept" -eq "$cmax"; then
+ success=1
+ break
+ fi
+ $BIN_SVCS "$3" >/dev/null 2>&1
+ done
+ if test "$success" -eq 0; then
+ $BIN_SVCADM enable -s "$3"
+ if test "$?" -eq 0; then
+ subprint "Enabled: $1"
+ return 0
+ else
+ warnprint "Enabling $1 ...FAILED."
+ warnprint "Refer $4 for details."
+ fi
+ else
+ warnprint "Importing $1 ...FAILED."
+ warnprint "Refer /var/svc/log/system-manifest-import:default.log for details."
+ fi
+ return 1
+}
+
+
+# stop_service(servicename, shortFMRI-suitable for grep, full FMRI)
+# failure: non fatal
+stop_service()
+{
+ if test -z "$1" || test -z "$2" || test -z "$3"; then
+ errorprint "missing argument to stop_service()"
+ exit 1
+ fi
+ servicefound=`$BIN_SVCS -H "$2" 2>/dev/null | grep '^online'`
+ if test ! -z "$servicefound"; then
+ $BIN_SVCADM disable -s "$3"
+ # Don't delete the manifest, this is handled by the manifest class action
+ # $BIN_SVCCFG delete "$3"
+ if test "$?" -eq 0; then
+ subprint "Disabled: $1"
+ else
+ subprint "Disabling: $1 ...ERROR(S)."
+ fi
+ fi
+}
+
+
+# plumb vboxnet0 instance
+# failure: non fatal
+plumb_net()
+{
+ # S11 175a renames vboxnet0 as 'netX', undo this and rename it back (Solaris 12, Solaris 11.4 or newer)
+ if test "$HOST_OS_MAJORVERSION" -ge 12 || (test "$HOST_OS_MAJORVERSION" -eq 11 && test "$HOST_OS_MINORVERSION" -ge 175); then
+ vanityname=`dladm show-phys -po link,device | grep vboxnet0 | cut -f1 -d':'`
+ if test "$?" -eq 0 && test ! -z "$vanityname" && test "x$vanityname" != "xvboxnet0"; then
+ dladm rename-link "$vanityname" vboxnet0
+ if test "$?" -ne 0; then
+ errorprint "Failed to rename vanity interface ($vanityname) to vboxnet0"
+ fi
+ fi
+ fi
+
+ # use ipadm for Solaris 12, Solaris 11.5 or newer
+ if test "$HOST_OS_MAJORVERSION" -ge 12 || (test "$HOST_OS_MAJORVERSION" -eq 11 && test "$HOST_OS_MINORVERSION" -ge 176); then
+ $BIN_IPADM create-ip vboxnet0
+ if test "$?" -eq 0; then
+ $BIN_IPADM create-addr -T static -a local="192.168.56.1/24" "vboxnet0/v4addr"
+ if test "$?" -eq 0; then
+ subprint "Configured: NetAdapter 'vboxnet0'"
+ else
+ warnprint "Failed to create local address for vboxnet0!"
+ fi
+ else
+ warnprint "Failed to create IP instance for vboxnet0!"
+ fi
+ else
+ $BIN_IFCONFIG vboxnet0 plumb
+ $BIN_IFCONFIG vboxnet0 up
+ if test "$?" -eq 0; then
+ $BIN_IFCONFIG vboxnet0 192.168.56.1 netmask 255.255.255.0 up
+
+ # /etc/netmasks is a symlink, older installers replaced this with
+ # a copy of the actual file, repair that behaviour here.
+ recreatelink=0
+ if test -h "$PKG_INSTALL_ROOT/etc/netmasks"; then
+ nmaskfile="$PKG_INSTALL_ROOT/etc/inet/netmasks"
+ else
+ nmaskfile="$PKG_INSTALL_ROOT/etc/netmasks"
+ recreatelink=1
+ fi
+
+ # add the netmask to stay persistent across host reboots
+ nmaskbackupfile=$nmaskfile.vbox
+ if test -f $nmaskfile; then
+ sed -e '/#VirtualBox_SectionStart/,/#VirtualBox_SectionEnd/d' $nmaskfile > $nmaskbackupfile
+
+ if test "$recreatelink" -eq 1; then
+ # Check after removing our settings if /etc/netmasks is identifcal to /etc/inet/netmasks
+ anydiff=`diff $nmaskbackupfile "$PKG_INSTALL_ROOT/etc/inet/netmasks"`
+ if test ! -z "$anydiff"; then
+ # User may have some custom settings in /etc/netmasks, don't overwrite /etc/netmasks!
+ recreatelink=2
+ fi
+ fi
+
+ echo "#VirtualBox_SectionStart" >> $nmaskbackupfile
+ inst=0
+ networkn=56
+ while test "$inst" -ne 1; do
+ echo "192.168.$networkn.0 255.255.255.0" >> $nmaskbackupfile
+ inst=`expr $inst + 1`
+ networkn=`expr $networkn + 1`
+ done
+ echo "#VirtualBox_SectionEnd" >> $nmaskbackupfile
+ mv -f $nmaskbackupfile $nmaskfile
+
+ # Recreate /etc/netmasks as a link if necessary
+ if test "$recreatelink" -eq 1; then
+ cp -f "$PKG_INSTALL_ROOT/etc/netmasks" "$PKG_INSTALL_ROOT/etc/inet/netmasks"
+ ln -sf ./inet/netmasks "$PKG_INSTALL_ROOT/etc/netmasks"
+ elif test "$recreatelink" -eq 2; then
+ warnprint "/etc/netmasks is a symlink (to /etc/inet/netmasks) that older"
+ warnprint "VirtualBox installers incorrectly overwrote. Now the contents"
+ warnprint "of /etc/netmasks and /etc/inet/netmasks differ, therefore "
+ warnprint "VirtualBox will not attempt to overwrite /etc/netmasks as a"
+ warnprint "symlink to /etc/inet/netmasks. Please resolve this manually"
+ warnprint "by updating /etc/inet/netmasks and creating /etc/netmasks as a"
+ warnprint "symlink to /etc/inet/netmasks"
+ fi
+ fi
+ else
+ # Should this be fatal?
+ warnprint "Failed to bring up vboxnet0!"
+ fi
+ fi
+}
+
+
+# unplumb all vboxnet instances
+# failure: fatal
+unplumb_net()
+{
+ inst=0
+ # use ipadm for Solaris 12, Solaris 11.5 or newer
+ if test "$HOST_OS_MAJORVERSION" -ge 12 || (test "$HOST_OS_MAJORVERSION" -eq 11 && test "$HOST_OS_MINORVERSION" -ge 176); then
+ while test "$inst" -ne $MOD_VBOXNET_INST; do
+ vboxnetup=`$BIN_IPADM show-addr -p -o addrobj vboxnet$inst >/dev/null 2>&1`
+ if test "$?" -eq 0; then
+ $BIN_IPADM delete-addr vboxnet$inst/v4addr
+ $BIN_IPADM delete-ip vboxnet$inst
+ if test "$?" -ne 0; then
+ errorprint "VirtualBox NetAdapter 'vboxnet$inst' couldn't be removed (probably in use)."
+ if test "x$fatal" = "x$FATALOP"; then
+ exit 1
+ fi
+ fi
+ fi
+
+ inst=`expr $inst + 1`
+ done
+ else
+ inst=0
+ while test "$inst" -ne $MOD_VBOXNET_INST; do
+ vboxnetup=`$BIN_IFCONFIG vboxnet$inst >/dev/null 2>&1`
+ if test "$?" -eq 0; then
+ $BIN_IFCONFIG vboxnet$inst unplumb
+ if test "$?" -ne 0; then
+ errorprint "VirtualBox NetAdapter 'vboxnet$inst' couldn't be unplumbed (probably in use)."
+ if test "x$fatal" = "x$FATALOP"; then
+ exit 1
+ fi
+ fi
+ fi
+
+ # unplumb vboxnet0 ipv6
+ vboxnetup=`$BIN_IFCONFIG vboxnet$inst inet6 >/dev/null 2>&1`
+ if test "$?" -eq 0; then
+ $BIN_IFCONFIG vboxnet$inst inet6 unplumb
+ if test "$?" -ne 0; then
+ errorprint "VirtualBox NetAdapter 'vboxnet$inst' IPv6 couldn't be unplumbed (probably in use)."
+ if test "x$fatal" = "x$FATALOP"; then
+ exit 1
+ fi
+ fi
+ fi
+
+ inst=`expr $inst + 1`
+ done
+ fi
+}
+
+
+# cleanup_install([fatal])
+# failure: depends on [fatal]
+cleanup_install()
+{
+ fatal=$1
+
+ # No-Op for remote installs
+ if test "$REMOTEINST" -eq 1; then
+ return 0
+ fi
+
+ # stop the services
+ stop_service "Web service" "virtualbox/webservice" "svc:/application/virtualbox/webservice:default"
+ stop_service "Balloon control service" "virtualbox/balloonctrl" "svc:/application/virtualbox/balloonctrl:default"
+ stop_service "Autostart service" "virtualbox/autostart" "svc:/application/virtualbox/autostart:default"
+ stop_service "Zone access service" "virtualbox/zoneaccess" "svc:/application/virtualbox/zoneaccess:default"
+
+ # DEBUG x4600b: verify that the ZoneAccess process is really gone
+ is_process_running "VBoxZoneAccess"
+ if test "$?" -eq 1; then
+ warnprint "VBoxZoneAccess is alive despite its service being dead. Killing..."
+ stop_process "VBoxZoneAccess"
+ fi
+
+ # unplumb all vboxnet instances for non-remote installs
+ unplumb_net
+
+ # Stop our other daemons, non-fatal
+ stop_process "VBoxNetDHCP"
+ stop_process "VBoxNetNAT"
+
+ # Stop VBoxSVC quickly using SIGUSR1
+ procname="VBoxSVC"
+ procpid=`ps -eo pid,fname | grep $procname | grep -v grep | awk '{ print $1 }'`
+ if test ! -z "$procpid" && test "$procpid" -ge 0; then
+ kill -USR1 $procpid
+
+ # Sleep a while and check if VBoxSVC is still running, if so fail uninstallation.
+ sleep 2
+ is_process_running "VBoxSVC"
+ if test "$?" -eq 1; then
+ errorprint "Cannot uninstall VirtualBox while VBoxSVC (pid $procpid) is still running."
+ errorprint "Please shutdown all VMs and VirtualBox frontends before uninstalling VirtualBox."
+ exit 1
+ fi
+
+ # Some VMs might still be alive after VBoxSVC as they poll less frequently before killing themselves
+ # Just check for VBoxHeadless & VirtualBox frontends for now.
+ is_process_running "VBoxHeadless"
+ if test "$?" -eq 1; then
+ errorprint "Cannot uninstall VirtualBox while VBoxHeadless is still running."
+ errorprint "Please shutdown all VMs and VirtualBox frontends before uninstalling VirtualBox."
+ exit 1
+ fi
+
+ is_process_running "VirtualBox"
+ if test "$?" -eq 1; then
+ errorprint "Cannot uninstall VirtualBox while any VM is still running."
+ errorprint "Please shutdown all VMs and VirtualBox frontends before uninstalling VirtualBox."
+ exit 1
+ fi
+ fi
+
+ # Remove stuff installed for the Python bindings.
+ if [ -r "$CONFIG_DIR/$CONFIG_FILES" ]; then
+ rm -f `cat "$CONFIG_DIR/$CONFIG_FILES"` 2> /dev/null
+ rm -f "$CONFIG_DIR/$CONFIG_FILES" 2> /dev/null
+ rmdir "$CONFIG_DIR" 2> /dev/null
+ fi
+}
+
+
+# postinstall()
+# !! failure is always fatal
+postinstall()
+{
+ infoprint "Detected Solaris $HOST_OS_MAJORVERSION Version $HOST_OS_MINORVERSION"
+
+ infoprint "Loading VirtualBox kernel modules..."
+ install_drivers
+
+ if test "$?" -eq 0; then
+ if test -f "$DIR_CONF/vboxnet.conf"; then
+ # nwam/dhcpagent fix
+ nwamfile="$PKG_INSTALL_ROOT/etc/nwam/llp"
+ nwambackupfile=$nwamfile.vbox
+ if test -f "$nwamfile"; then
+ sed -e '/vboxnet/d' $nwamfile > $nwambackupfile
+
+ # add all vboxnet instances as static to nwam
+ inst=0
+ networkn=56
+ while test "$inst" -ne 1; do
+ echo "vboxnet$inst static 192.168.$networkn.1" >> $nwambackupfile
+ inst=`expr $inst + 1`
+ networkn=`expr $networkn + 1`
+ done
+ mv -f $nwambackupfile $nwamfile
+ fi
+
+ # plumb and configure vboxnet0 for non-remote installs
+ if test "$REMOTEINST" -eq 0; then
+ plumb_net
+ fi
+ fi
+
+ if test -f "$PKG_INSTALL_ROOT/var/svc/manifest/application/virtualbox/virtualbox-webservice.xml" \
+ || test -f "$PKG_INSTALL_ROOT/var/svc/manifest/application/virtualbox/virtualbox-zoneaccess.xml" \
+ || test -f "$PKG_INSTALL_ROOT/var/svc/manifest/application/virtualbox/virtualbox-balloonctrl.xml"\
+ || test -f "$PKG_INSTALL_ROOT/var/svc/manifest/application/virtualbox/virtualbox-autostart.xml"; then
+ infoprint "Configuring services..."
+ if test "$REMOTEINST" -eq 1; then
+ subprint "Skipped for targeted installs."
+ else
+ # Since S11 the way to import a manifest is via restarting manifest-import which is asynchronous and can
+ # take a while to complete, using disable/enable -s doesn't work either. So we restart it, and poll in
+ # 1 second intervals to see if our service has been successfully imported and timeout after 'cmax' seconds.
+ $BIN_SVCADM restart svc:system/manifest-import:default
+
+ # Start ZoneAccess service, other services are disabled by default.
+ start_service "Zone access service" "virtualbox/zoneaccess" "svc:/application/virtualbox/zoneaccess:default" \
+ "/var/svc/log/application-virtualbox-zoneaccess:default.log"
+ fi
+ fi
+
+ # Update mime and desktop databases to get the right menu entries
+ # and icons. There is still some delay until the GUI picks it up,
+ # but that cannot be helped.
+ if test -d "$PKG_INSTALL_ROOT/usr/share/icons"; then
+ infoprint "Installing MIME types and icons..."
+ if test "$REMOTEINST" -eq 0; then
+ /usr/bin/update-mime-database /usr/share/mime >/dev/null 2>&1
+ /usr/bin/update-desktop-database -q 2>/dev/null
+ else
+ subprint "Skipped for targeted installs."
+ fi
+ fi
+
+ if test -f "$VBOX_INSTALL_PATH/sdk/installer/vboxapisetup.py" || test -h "$VBOX_INSTALL_PATH/sdk/installer/vboxapisetup.py"; then
+ # Install python bindings for non-remote installs
+ if test "$REMOTEINST" -eq 0; then
+ infoprint "Installing Python bindings..."
+
+ # Loop over all usual suspect Python executable names and try
+ # installing the VirtualBox API bindings. Needs to prevent
+ # double installs which waste quite a bit of time.
+ PYTHONS=""
+ for p in python2.4 python2.5 python2.6 python2.7 python2 python3.3 python3.4 python3.5 python3.6 python3.7 python3.8 python3.9 python3.10 python3 python; do
+ if [ "`$p -c 'import sys
+if sys.version_info >= (2, 4) and (sys.version_info < (3, 0) or sys.version_info >= (3, 3)):
+ print(\"test\")' 2> /dev/null`" != "test" ]; then
+ continue
+ fi
+ # Get python major/minor version, and skip if it was
+ # already covered. Uses grep -F to avoid trouble with '.'
+ # matching any char.
+ pyvers="`$p -c 'import sys
+print("%s.%s" % (sys.version_info[0], sys.version_info[1]))' 2> /dev/null`"
+ if echo "$PYTHONS" | /usr/xpg4/bin/grep -Fq ":$pyvers:"; then
+ continue
+ fi
+ # Record which version will be installed. If it fails there
+ # is no point trying with different executable/symlink
+ # reporting the same version.
+ PYTHONS="$PYTHONS:$pyvers:"
+ install_python_bindings "$p" "Python $pyvers"
+ done
+ if [ -z "$PYTHONS" ]; then
+ warnprint "Python (2.4 to 2.7 or 3.3 and later) unavailable, skipping bindings installation."
+ fi
+ else
+ warnprint "Skipped installing Python bindings. Run, as root, 'vboxapisetup.py install' manually from the booted system."
+ fi
+ fi
+
+ update_boot_archive
+
+ return 0
+ else
+ errorprint "Failed to install drivers"
+ exit 666
+ fi
+ return 1
+}
+
+# preremove([fatal])
+# failure: depends on [fatal]
+preremove()
+{
+ fatal=$1
+
+ cleanup_install "$fatal"
+
+ remove_drivers "$fatal"
+ if test "$?" -eq 0; then
+ return 0;
+ fi
+ return 1
+}
+
+
+# And it begins...
+if test "x${PKG_INSTALL_ROOT:=/}" != "x/"; then
+ BASEDIR_OPT="-b $PKG_INSTALL_ROOT"
+ BASEDIR_PKGOPT="-R $PKG_INSTALL_ROOT"
+ REMOTEINST=1
+fi
+find_bins
+check_root
+check_isa
+check_zone
+get_sysinfo
+
+
+# Get command line options
+while test $# -gt 0;
+do
+ case "$1" in
+ --postinstall | --preremove | --installdrivers | --removedrivers | --setupdrivers)
+ drvop="$1"
+ ;;
+ --fatal)
+ fatal="$FATALOP"
+ ;;
+ --silent)
+ ISSILENT="$SILENTOP"
+ ;;
+ --ips)
+ ISIPS="$IPSOP"
+ ;;
+ --altkerndir)
+ # Use alternate kernel driver config folder (dev only)
+ DIR_CONF="/usr/kernel/drv"
+ ;;
+ --sh-trace) # forwarded pkgadd -v
+ set -x
+ ;;
+ --help)
+ printusage
+ exit 1
+ ;;
+ *)
+ # Take a hard line on invalid options.
+ errorprint "Invalid command line option: \"$1\""
+ exit 1;
+ ;;
+ esac
+ shift
+done
+
+case "$drvop" in
+--postinstall)
+ check_module_arch
+ postinstall
+ ;;
+--preremove)
+ preremove "$fatal"
+ ;;
+--installdrivers)
+ check_module_arch
+ install_drivers
+ ;;
+--removedrivers)
+ remove_drivers "$fatal"
+ ;;
+--setupdrivers)
+ remove_drivers "$fatal"
+ infoprint "Installing VirtualBox drivers:"
+ install_drivers
+ ;;
+*)
+ printusage
+ exit 1
+esac
+
+exit "$?"
+
diff --git a/src/VBox/Installer/solaris/virtualbox-autostart.xml b/src/VBox/Installer/solaris/virtualbox-autostart.xml
new file mode 100644
index 00000000..8287ad46
--- /dev/null
+++ b/src/VBox/Installer/solaris/virtualbox-autostart.xml
@@ -0,0 +1,124 @@
+<?xml version="1.0"?>
+<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
+<!--
+# Solaris SMF service manifest for VirtualBox autostart service.
+# $Id: virtualbox-autostart.xml $
+-->
+<!--
+ 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
+-->
+
+<service_bundle type='manifest' name='SUNWvbox:autostart'>
+
+<service
+ name='application/virtualbox/autostart'
+ type='service'
+ version='1'>
+
+ <single_instance />
+
+ <dependency
+ name='fs-local'
+ grouping='require_all'
+ restart_on='none'
+ type='service'>
+ <service_fmri value='svc:/system/filesystem/local' />
+ </dependency>
+
+ <dependency
+ name='fs-autofs'
+ grouping='optional_all'
+ restart_on='none'
+ type='service'>
+ <service_fmri value='svc:/system/filesystem/autofs' />
+ </dependency>
+
+ <dependency
+ name='network-service'
+ grouping='require_all'
+ restart_on='none'
+ type='service'>
+ <service_fmri value='svc:/network/service' />
+ </dependency>
+
+ <dependency
+ name='name-services'
+ grouping='require_all'
+ restart_on='refresh'
+ type='service'>
+ <service_fmri value='svc:/milestone/name-services' />
+ </dependency>
+
+ <instance name='default' enabled='false'>
+
+ <dependent
+ name='virtualbox-autostart_multi-user'
+ grouping='optional_all'
+ restart_on='none'>
+ <service_fmri value='svc:/milestone/multi-user' />
+ </dependent>
+
+ <exec_method
+ type='method'
+ name='start'
+ exec='/opt/VirtualBox/smf-vboxautostart.sh %m'
+ timeout_seconds='15'>
+ <method_context>
+ <method_credential user='root' group='root' />
+ </method_context>
+ </exec_method>
+
+ <exec_method
+ type='method'
+ name='stop'
+ exec='/opt/VirtualBox/smf-vboxautostart.sh %m'
+ timeout_seconds='0'>
+ <method_context>
+ <method_credential user='root' group='root' />
+ </method_context>
+ </exec_method>
+
+ <property_group name='startd' type='framework'>
+ <!-- sub-process core dumps/signals shouldn't restart session -->
+ <propval name='ignore_error' type='astring' value='core,signal' />
+ <propval name='duration' type='astring' value='transient' />
+ </property_group>
+
+ <property_group name='config' type='application'>
+ <propval name='config' type='astring' value='/etc/vbox/autostart.cfg' />
+ <propval name='vboxgroup' type='astring' value='staff' />
+ </property_group>
+
+ <template>
+ <common_name>
+ <loctext xml:lang='C'>
+ VirtualBox Autostart
+ </loctext>
+ </common_name>
+ </template>
+
+ </instance>
+
+ <stability value='External' />
+
+</service>
+
+</service_bundle>
diff --git a/src/VBox/Installer/solaris/virtualbox-balloonctrl.xml b/src/VBox/Installer/solaris/virtualbox-balloonctrl.xml
new file mode 100644
index 00000000..ff787d60
--- /dev/null
+++ b/src/VBox/Installer/solaris/virtualbox-balloonctrl.xml
@@ -0,0 +1,124 @@
+<?xml version="1.0"?>
+<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
+<!--
+# Solaris SMF service manifest for VirtualBox balloon control service.
+# $Id: virtualbox-balloonctrl.xml $
+-->
+<!--
+ 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
+-->
+
+<service_bundle type='manifest' name='SUNWvbox:balloonctrl'>
+
+<service
+ name='application/virtualbox/balloonctrl'
+ type='service'
+ version='1'>
+
+ <single_instance />
+
+ <dependency
+ name='fs-local'
+ grouping='require_all'
+ restart_on='none'
+ type='service'>
+ <service_fmri value='svc:/system/filesystem/local' />
+ </dependency>
+
+ <dependency
+ name='fs-autofs'
+ grouping='optional_all'
+ restart_on='none'
+ type='service'>
+ <service_fmri value='svc:/system/filesystem/autofs' />
+ </dependency>
+
+ <dependency
+ name='network-service'
+ grouping='require_all'
+ restart_on='none'
+ type='service'>
+ <service_fmri value='svc:/network/service' />
+ </dependency>
+
+ <dependency
+ name='name-services'
+ grouping='require_all'
+ restart_on='refresh'
+ type='service'>
+ <service_fmri value='svc:/milestone/name-services' />
+ </dependency>
+
+ <instance name='default' enabled='false'>
+
+ <dependent
+ name='virtualbox-balloonctrl_multi-user'
+ grouping='optional_all'
+ restart_on='none'>
+ <service_fmri value='svc:/milestone/multi-user' />
+ </dependent>
+
+ <exec_method
+ type='method'
+ name='start'
+ exec='/opt/VirtualBox/smf-vboxballoonctrl.sh %m'
+ timeout_seconds='15'>
+ <method_context>
+ <method_credential user='root' group='root' />
+ </method_context>
+ </exec_method>
+
+ <exec_method
+ type='method'
+ name='stop'
+ exec=':kill'
+ timeout_seconds='15'>
+ <method_context>
+ <method_credential user='root' group='root' />
+ </method_context>
+ </exec_method>
+
+ <property_group name='startd' type='framework'>
+ <!-- sub-process core dumps/signals shouldn't restart session -->
+ <propval name='ignore_error' type='astring' value='core,signal' />
+ </property_group>
+
+ <property_group name='config' type='application'>
+ <propval name='user' type='astring' value='root' />
+ <propval name='host' type='astring' value='localhost' />
+ <propval name='port' type='integer' value='18083' />
+ </property_group>
+
+ <template>
+ <common_name>
+ <loctext xml:lang='C'>
+ VirtualBox Webservice
+ </loctext>
+ </common_name>
+ </template>
+
+ </instance>
+
+ <stability value='External' />
+
+</service>
+
+</service_bundle>
diff --git a/src/VBox/Installer/solaris/virtualbox-webservice.xml b/src/VBox/Installer/solaris/virtualbox-webservice.xml
new file mode 100644
index 00000000..4392a4a9
--- /dev/null
+++ b/src/VBox/Installer/solaris/virtualbox-webservice.xml
@@ -0,0 +1,125 @@
+<?xml version="1.0"?>
+<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
+<!--
+# Solaris SMF service manifest for VirtualBox webservice server.
+# $Id: virtualbox-webservice.xml $
+-->
+<!--
+ 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
+-->
+
+<service_bundle type='manifest' name='SUNWvbox:webservice'>
+
+<service
+ name='application/virtualbox/webservice'
+ type='service'
+ version='1'>
+
+ <single_instance />
+
+ <dependency
+ name='fs-local'
+ grouping='require_all'
+ restart_on='none'
+ type='service'>
+ <service_fmri value='svc:/system/filesystem/local' />
+ </dependency>
+
+ <dependency
+ name='fs-autofs'
+ grouping='optional_all'
+ restart_on='none'
+ type='service'>
+ <service_fmri value='svc:/system/filesystem/autofs' />
+ </dependency>
+
+ <dependency
+ name='network-service'
+ grouping='require_all'
+ restart_on='none'
+ type='service'>
+ <service_fmri value='svc:/network/service' />
+ </dependency>
+
+ <dependency
+ name='name-services'
+ grouping='require_all'
+ restart_on='refresh'
+ type='service'>
+ <service_fmri value='svc:/milestone/name-services' />
+ </dependency>
+
+ <instance name='default' enabled='false'>
+
+ <dependent
+ name='virtualbox-webservice_multi-user'
+ grouping='optional_all'
+ restart_on='none'>
+ <service_fmri value='svc:/milestone/multi-user' />
+ </dependent>
+
+ <exec_method
+ type='method'
+ name='start'
+ exec='/opt/VirtualBox/smf-vboxwebsrv.sh %m'
+ timeout_seconds='15'>
+ <method_context>
+ <method_credential user='root' group='root' />
+ </method_context>
+ </exec_method>
+
+ <exec_method
+ type='method'
+ name='stop'
+ exec=':kill'
+ timeout_seconds='15'>
+ <method_context>
+ <method_credential user='root' group='root' />
+ </method_context>
+ </exec_method>
+
+ <property_group name='startd' type='framework'>
+ <!-- sub-process core dumps/signals shouldn't restart session -->
+ <propval name='ignore_error' type='astring' value='core,signal' />
+ </property_group>
+
+ <property_group name='config' type='application'>
+ <propval name='user' type='astring' value='root' />
+ <propval name='host' type='astring' value='localhost' />
+ <propval name='port' type='integer' value='18083' />
+ <propval name='keyfile' type='astring' value='' />
+ </property_group>
+
+ <template>
+ <common_name>
+ <loctext xml:lang='C'>
+ VirtualBox Webservice
+ </loctext>
+ </common_name>
+ </template>
+
+ </instance>
+
+ <stability value='External' />
+
+</service>
+
+</service_bundle>
diff --git a/src/VBox/Installer/solaris/virtualbox-zoneaccess.xml b/src/VBox/Installer/solaris/virtualbox-zoneaccess.xml
new file mode 100644
index 00000000..5d270f29
--- /dev/null
+++ b/src/VBox/Installer/solaris/virtualbox-zoneaccess.xml
@@ -0,0 +1,86 @@
+<?xml version='1.0'?>
+<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
+<!--
+# Solaris SMF service manifest for Solaris Zone Access.
+# $Id: virtualbox-zoneaccess.xml $
+-->
+<!--
+ 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
+-->
+
+<service_bundle type='manifest' name='SUNWvbox:zoneaccess'>
+
+<service
+ name='application/virtualbox/zoneaccess'
+ type='service'
+ version='1'>
+
+ <create_default_instance enabled='false' />
+
+ <single_instance/>
+
+ <!-- Wait for devices to be initialized as we depend on vboxdrv -->
+ <dependency
+ name='milestone'
+ grouping='require_all'
+ restart_on='none'
+ type='service'>
+ <service_fmri value='svc:/milestone/devices:default' />
+ </dependency>
+
+ <!-- Wait for local filesystems to be mounted (just to be safe, don't start too early) -->
+ <dependency
+ name='filesystem-local'
+ grouping='require_all'
+ restart_on='none'
+ type='service'>
+ <service_fmri value='svc:/system/filesystem/local:default' />
+ </dependency>
+
+ <exec_method
+ type='method'
+ name='start'
+ exec='/opt/VirtualBox/VBoxZoneAccess'
+ timeout_seconds='10' >
+ <method_context>
+ <method_credential user='root' group='root' />
+ </method_context>
+ </exec_method>
+
+ <exec_method
+ type='method'
+ name='stop'
+ exec=':kill'
+ timeout_seconds='10' >
+ <method_context>
+ <method_credential user='root' group='root' />
+ </method_context>
+ </exec_method>
+
+ <template>
+ <common_name>
+ <loctext xml:lang='C'>VirtualBox Zone Access Service.</loctext>
+ </common_name>
+ </template>
+</service>
+
+</service_bundle>
+
diff --git a/src/VBox/Installer/solaris/virtualbox.applications.in b/src/VBox/Installer/solaris/virtualbox.applications.in
new file mode 100644
index 00000000..601d274c
--- /dev/null
+++ b/src/VBox/Installer/solaris/virtualbox.applications.in
@@ -0,0 +1,8 @@
+virtualbox
+ command=VirtualBox
+ requires_terminal=false
+ expects_uris=false
+ can_open_multiple_files=true
+ name=@VBOX_PRODUCT@
+ mime_types=application/x-virtualbox-vbox;application/x-virtualbox-vbox-extpack;application/x-virtualbox-ovf;application/x-virtualbox-ova;application/x-virtualbox-vdi;application/x-virtualbox-vmdk;application/x-virtualbox-vhd;application/x-virtualbox-hdd
+
diff --git a/src/VBox/Installer/solaris/virtualbox.keys b/src/VBox/Installer/solaris/virtualbox.keys
new file mode 100644
index 00000000..65ddd53e
--- /dev/null
+++ b/src/VBox/Installer/solaris/virtualbox.keys
@@ -0,0 +1,79 @@
+application/x-virtualbox-vbox
+ icon_filename=virtualbox-vbox
+ description=Virtual Machine
+ default_action_type=application
+ short_list_application_ids_for_novice_user_level=virtualbox
+ short_list_application_ids_for_intermediate_user_level=virtualbox
+ short_list_application_ids_for_advanced_user_level=virtualbox
+ category=System
+ use_category_default=no
+
+application/x-virtualbox-vbox-extpack
+ icon_filename=virtualbox-vbox-extpack
+ description=VirtualBox Extension Pack
+ default_action_type=application
+ short_list_application_ids_for_novice_user_level=virtualbox
+ short_list_application_ids_for_intermediate_user_level=virtualbox
+ short_list_application_ids_for_advanced_user_level=virtualbox
+ category=System
+ use_category_default=no
+
+application/x-virtualbox-ovf
+ icon_filename=virtualbox-ovf
+ description=Open Virtualization Format
+ default_action_type=application
+ short_list_application_ids_for_novice_user_level=virtualbox
+ short_list_application_ids_for_intermediate_user_level=virtualbox
+ short_list_application_ids_for_advanced_user_level=virtualbox
+ category=System
+ use_category_default=no
+
+application/x-virtualbox-ovf
+ icon_filename=virtualbox-ova
+ description=Open Virtualization Format Archive
+ default_action_type=application
+ short_list_application_ids_for_novice_user_level=virtualbox
+ short_list_application_ids_for_intermediate_user_level=virtualbox
+ short_list_application_ids_for_advanced_user_level=virtualbox
+ category=System
+ use_category_default=no
+
+application/x-virtualbox-vdi
+ icon_filename=virtualbox-vdi
+ description=Virtual Disk Image
+ default_action_type=none
+ short_list_application_ids_for_novice_user_level=virtualbox
+ short_list_application_ids_for_intermediate_user_level=virtualbox
+ short_list_application_ids_for_advanced_user_level=virtualbox
+ category=System
+ use_category_default=no
+
+application/x-virtualbox-vmdk
+ icon_filename=virtualbox-vmdk
+ description=Virtual Machine Disk Format
+ default_action_type=none
+ short_list_application_ids_for_novice_user_level=virtualbox
+ short_list_application_ids_for_intermediate_user_level=virtualbox
+ short_list_application_ids_for_advanced_user_level=virtualbox
+ category=System
+ use_category_default=no
+
+application/x-virtualbox-vhd
+ icon_filename=virtualbox-vhd
+ description=Virtual Hard Disk
+ default_action_type=none
+ short_list_application_ids_for_novice_user_level=virtualbox
+ short_list_application_ids_for_intermediate_user_level=virtualbox
+ short_list_application_ids_for_advanced_user_level=virtualbox
+ category=System
+ use_category_default=no
+
+application/x-virtualbox-hdd
+ icon_filename=virtualbox-hdd
+ description=Virtual Hard Disk
+ default_action_type=none
+ short_list_application_ids_for_novice_user_level=virtualbox
+ short_list_application_ids_for_intermediate_user_level=virtualbox
+ short_list_application_ids_for_advanced_user_level=virtualbox
+ category=System
+ use_category_default=no
diff --git a/src/VBox/Installer/solaris/virtualbox.mime b/src/VBox/Installer/solaris/virtualbox.mime
new file mode 100644
index 00000000..7401f4c0
--- /dev/null
+++ b/src/VBox/Installer/solaris/virtualbox.mime
@@ -0,0 +1,23 @@
+application/x-virtualbox-vbox:
+ ext: vbox
+
+application/x-virtualbox-vbox-extpack:
+ ext: vbox-extpack
+
+application/x-virtualbox-ovf:
+ ext: ovf
+
+application/x-virtualbox-ova:
+ ext: ova
+
+application/x-virtualbox-vdi:
+ ext: vdi
+
+application/x-virtualbox-vmdk:
+ ext: vmdk
+
+application/x-virtualbox-vhd:
+ ext: vhd
+
+application/x-virtualbox-hdd:
+ ext: hdd