summaryrefslogtreecommitdiffstats
path: root/src/VBox/Additions/solaris/Installer
diff options
context:
space:
mode:
Diffstat (limited to 'src/VBox/Additions/solaris/Installer')
-rwxr-xr-xsrc/VBox/Additions/solaris/Installer/VBox.sh51
-rwxr-xr-xsrc/VBox/Additions/solaris/Installer/makepackage.sh150
-rwxr-xr-xsrc/VBox/Additions/solaris/Installer/postinstall.sh399
-rwxr-xr-xsrc/VBox/Additions/solaris/Installer/preremove.sh69
-rwxr-xr-xsrc/VBox/Additions/solaris/Installer/vbox_vendor_select88
-rw-r--r--src/VBox/Additions/solaris/Installer/vboxdevlink.sed34
-rw-r--r--src/VBox/Additions/solaris/Installer/vboxguest.depend1
-rw-r--r--src/VBox/Additions/solaris/Installer/vboxguest.pkginfo15
-rwxr-xr-xsrc/VBox/Additions/solaris/Installer/vboxguest.sh252
-rw-r--r--src/VBox/Additions/solaris/Installer/vboxguest.space5
-rw-r--r--src/VBox/Additions/solaris/Installer/vboxservice.xml76
11 files changed, 1140 insertions, 0 deletions
diff --git a/src/VBox/Additions/solaris/Installer/VBox.sh b/src/VBox/Additions/solaris/Installer/VBox.sh
new file mode 100755
index 00000000..7ddebe05
--- /dev/null
+++ b/src/VBox/Additions/solaris/Installer/VBox.sh
@@ -0,0 +1,51 @@
+#!/bin/sh
+# $Id: VBox.sh $
+## @file
+# VirtualBox startup script for Solaris Guests Additions
+#
+
+#
+# Copyright (C) 2008-2020 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+
+CURRENT_ISA=`isainfo -k`
+if test "$CURRENT_ISA" = "amd64"; then
+ INSTALL_DIR="/opt/VirtualBoxAdditions/amd64"
+else
+ INSTALL_DIR="/opt/VirtualBoxAdditions"
+fi
+
+APP=`basename $0`
+case "$APP" in
+ VBoxClient)
+ exec "$INSTALL_DIR/VBoxClient" "$@"
+ ;;
+ VBoxService)
+ exec "$INSTALL_DIR/VBoxService" "$@"
+ ;;
+ VBoxControl)
+ exec "$INSTALL_DIR/VBoxControl" "$@"
+ ;;
+ *)
+ echo "Unknown application - $APP"
+ exit 1
+ ;;
+esac
+exit 0
diff --git a/src/VBox/Additions/solaris/Installer/makepackage.sh b/src/VBox/Additions/solaris/Installer/makepackage.sh
new file mode 100755
index 00000000..0092b8c3
--- /dev/null
+++ b/src/VBox/Additions/solaris/Installer/makepackage.sh
@@ -0,0 +1,150 @@
+#!/bin/sh
+# $Id: makepackage.sh $
+## @file
+# VirtualBox Solaris Guest Additions package creation script.
+#
+
+#
+# Copyright (C) 2008-2020 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+
+#
+# Usage:
+# makespackage.sh $(PATH_TARGET)/install packagename svnrev
+
+if test -z "$3"; then
+ echo "Usage: $0 installdir packagename svnrev"
+ exit 1
+fi
+ostype=`uname -s`
+if test "$ostype" != "Linux" && test "$ostype" != "SunOS" ; then
+ echo "Linux/Solaris not detected."
+ exit 1
+fi
+
+VBOX_BASEPKG_DIR=$1
+VBOX_INSTALLED_DIR="$VBOX_BASEPKG_DIR"/opt/VirtualBoxAdditions
+VBOX_PKGFILENAME=$2
+VBOX_SVN_REV=$3
+
+VBOX_PKGNAME=SUNWvboxguest
+VBOX_AWK=/usr/bin/awk
+case "$ostype" in
+"SunOS")
+ VBOX_GGREP=/usr/sfw/bin/ggrep
+ VBOX_SOL_PKG_DEV=/var/spool/pkg
+ ;;
+*)
+ VBOX_GGREP=`which grep`
+ VBOX_SOL_PKG_DEV=$4
+ ;;
+esac
+VBOX_AWK=/usr/bin/awk
+
+# check for GNU grep we use which might not ship with all Solaris
+if test ! -f "$VBOX_GGREP" && test ! -h "$VBOX_GGREP"; then
+ echo "## GNU grep not found in $VBOX_GGREP."
+ exit 1
+fi
+
+# bail out on non-zero exit status
+set -e
+
+# Fixup filelist using awk, the parameters must be in awk syntax
+# params: filename condition action
+filelist_fixup()
+{
+ "$VBOX_AWK" 'NF == 6 && '"$2"' { '"$3"' } { print }' "$1" > "tmp-$1"
+ mv -f "tmp-$1" "$1"
+}
+
+dirlist_fixup()
+{
+ "$VBOX_AWK" 'NF == 6 && $1 == "d" && '"$2"' { '"$3"' } { print }' "$1" > "tmp-$1"
+ mv -f "tmp-$1" "$1"
+}
+
+# Create relative hardlinks
+cd "$VBOX_INSTALLED_DIR"
+ln -f ./VBoxISAExec $VBOX_INSTALLED_DIR/VBoxService
+ln -f ./VBoxISAExec $VBOX_INSTALLED_DIR/VBoxClient
+ln -f ./VBoxISAExec $VBOX_INSTALLED_DIR/VBoxControl
+ln -f ./VBoxISAExec $VBOX_INSTALLED_DIR/vboxmslnk
+
+# prepare file list
+cd "$VBOX_BASEPKG_DIR"
+echo 'i pkginfo=./vboxguest.pkginfo' > prototype
+echo 'i postinstall=./postinstall.sh' >> prototype
+echo 'i preremove=./preremove.sh' >> prototype
+echo 'i space=./vboxguest.space' >> prototype
+echo 'i depend=./vboxguest.depend' >> prototype
+if test -f "./vboxguest.copyright"; then
+ echo 'i copyright=./vboxguest.copyright' >> prototype
+fi
+
+# Exclude directory entries to not cause conflicts (owner,group) with existing directories in the system
+find . ! -type d | $VBOX_GGREP -v -E 'prototype|makepackage.sh|vboxguest.pkginfo|postinstall.sh|preremove.sh|vboxguest.space|vboxguest.depend|vboxguest.copyright' | pkgproto >> prototype
+
+# Include opt/VirtualBoxAdditions and subdirectories as we want uninstall to clean up directory structure as well
+find . -type d | $VBOX_GGREP -E 'opt/VirtualBoxAdditions|var/svc/manifest/application/virtualbox' | pkgproto >> prototype
+
+# Include /etc/fs/vboxfs (as we need to create the subdirectory)
+find . -type d | $VBOX_GGREP -E 'etc/fs/vboxfs' | pkgproto >> prototype
+
+
+# don't grok for the class files
+filelist_fixup prototype '$2 == "none"' '$5 = "root"; $6 = "bin"'
+
+# VBoxService requires suid
+filelist_fixup prototype '$3 == "opt/VirtualBoxAdditions/VBoxService"' '$4 = "4755"'
+filelist_fixup prototype '$3 == "opt/VirtualBoxAdditions/amd64/VBoxService"' '$4 = "4755"'
+
+# Manifest class action scripts
+filelist_fixup prototype '$3 == "var/svc/manifest/application/virtualbox/vboxservice.xml"' '$2 = "manifest";$6 = "sys"'
+filelist_fixup prototype '$3 == "var/svc/manifest/application/virtualbox/vboxmslnk.xml"' '$2 = "manifest";$6 = "sys"'
+
+# vboxguest
+filelist_fixup prototype '$3 == "usr/kernel/drv/vboxguest"' '$6="sys"'
+filelist_fixup prototype '$3 == "usr/kernel/drv/amd64/vboxguest"' '$6="sys"'
+
+# vboxms
+filelist_fixup prototype '$3 == "usr/kernel/drv/vboxms"' '$6="sys"'
+filelist_fixup prototype '$3 == "usr/kernel/drv/amd64/vboxms"' '$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
+dirlist_fixup prototype '$3 == "var/svc/manifest/application/virtualbox"' '$6 = "root"'
+
+echo " --- start of prototype ---"
+cat prototype
+echo " --- end of prototype --- "
+
+# explicitly set timestamp to shutup warning
+VBOXPKG_TIMESTAMP=vboxguest`date '+%Y%m%d%H%M%S'`_r$VBOX_SVN_REV
+
+# create the package instance
+pkgmk -d $VBOX_SOL_PKG_DEV -p $VBOXPKG_TIMESTAMP -o -r .
+
+# translate into package datastream
+pkgtrans -s -o "$VBOX_SOL_PKG_DEV" `pwd`/$VBOX_PKGFILENAME "$VBOX_PKGNAME"
+
+rm -rf "$VBOX_SOL_PKG_DEV/$VBOX_PKGNAME"
+exit $?
+
diff --git a/src/VBox/Additions/solaris/Installer/postinstall.sh b/src/VBox/Additions/solaris/Installer/postinstall.sh
new file mode 100755
index 00000000..9e49df38
--- /dev/null
+++ b/src/VBox/Additions/solaris/Installer/postinstall.sh
@@ -0,0 +1,399 @@
+#!/bin/sh
+# $Id: postinstall.sh $
+## @file
+# VirtualBox postinstall script for Solaris Guest Additions.
+#
+
+#
+# Copyright (C) 2008-2020 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+
+# LC_ALL should take precedence over LC_* and LANG but whatever...
+LC_ALL=C
+export LC_ALL
+
+LANG=C
+export LANG
+
+# uncompress(directory, file)
+# Updates package metadata and uncompresses the file.
+uncompress_file()
+{
+ if test -z "$1" || test -z "$2"; then
+ echo "missing argument to uncompress_file()"
+ return 1
+ fi
+
+ # Remove compressed path from the pkg
+ /usr/sbin/removef $PKGINST "$1/$2.Z" 1>/dev/null
+
+ # Add uncompressed path to the pkg
+ /usr/sbin/installf -c none $PKGINST "$1/$2" f
+
+ # Uncompress the file (removes compressed file when done)
+ uncompress -f "$1/$2.Z" > /dev/null 2>&1
+}
+
+# uncompress_files(directory_with_*.Z_files)
+uncompress_files()
+{
+ for i in "${1}/"*.Z; do
+ uncompress_file "${1}" "`basename \"${i}\" .Z`"
+ done
+}
+
+solaris64dir="amd64"
+solaris32dir="i386"
+vboxadditions_path="$BASEDIR/opt/VirtualBoxAdditions"
+vboxadditions32_path=$vboxadditions_path/$solaris32dir
+vboxadditions64_path=$vboxadditions_path/$solaris64dir
+
+# get the current zone
+currentzone=`zonename`
+# get what ISA the guest is running
+cputype=`isainfo -k`
+if test "$cputype" = "amd64"; then
+ isadir=$solaris64dir
+else
+ isadir=""
+fi
+
+vboxadditionsisa_path=$vboxadditions_path/$isadir
+
+
+# uncompress if necessary
+if test -f "$vboxadditions32_path/VBoxClient.Z" || test -f "$vboxadditions64_path/VBoxClient.Z"; then
+ echo "Uncompressing files..."
+ if test -f "$vboxadditions32_path/VBoxClient.Z"; then
+ uncompress_files "$vboxadditions32_path"
+ fi
+ if test -f "$vboxadditions64_path/VBoxClient.Z"; then
+ uncompress_files "$vboxadditions64_path"
+ fi
+fi
+
+
+if test "$currentzone" = "global"; then
+ # vboxguest.sh would've been installed, we just need to call it.
+ echo "Configuring VirtualBox guest kernel module..."
+ # stop all previous modules (vboxguest, vboxfs) and start only starts vboxguest
+ $vboxadditions_path/vboxguest.sh stopall silentunload
+ $vboxadditions_path/vboxguest.sh start
+
+ sed -e '/name=vboxguest/d' /etc/devlink.tab > /etc/devlink.vbox
+ echo "type=ddi_pseudo;name=vboxguest \D" >> /etc/devlink.vbox
+ mv -f /etc/devlink.vbox /etc/devlink.tab
+
+ # create the device link
+ /usr/sbin/devfsadm -i vboxguest
+fi
+
+
+# check if X.Org exists (snv_130 and higher have /usr/X11/* as /usr/*)
+if test -f "/usr/bin/Xorg"; then
+ xorgbin="/usr/bin/Xorg"
+elif test -f "/usr/X11/bin/Xorg"; then
+ xorgbin="/usr/X11/bin/Xorg"
+else
+ xorgbin=""
+ retval=0
+fi
+
+# create links
+echo "Creating links..."
+if test "$currentzone" = "global"; then
+ /usr/sbin/installf -c none $PKGINST /dev/vboxguest=../devices/pci@0,0/pci80ee,cafe@4:vboxguest s
+ /usr/sbin/installf -c none $PKGINST /dev/vboxms=../devices/pseudo/vboxms@0:vboxms s
+fi
+
+# Install Xorg components to the required places
+if test ! -z "$xorgbin"; then
+ xorgversion_long=`$xorgbin -version 2>&1 | grep "X Window System Version"`
+ xorgversion=`/usr/bin/expr "${xorgversion_long}" : 'X Window System Version \([^ ]*\)'`
+ if test -z "$xorgversion_long"; then
+ xorgversion_long=`$xorgbin -version 2>&1 | grep "X.Org X Server"`
+ xorgversion=`/usr/bin/expr "${xorgversion_long}" : 'X.Org X Server \([^ ]*\)'`
+ fi
+
+ # "X.Y.Z" - strip off all numerics after the 2nd '.' character, e.g. "1.11.3" -> "1.11"
+ # Then the next sed, strips of all '.' characters, "1.11" -> "111".
+ fileversion=`echo $xorgversion | sed "s/\.[0-9]*//2" | sed "s/\.//"`
+ vboxvideo_src="vboxvideo_drv_$fileversion.so"
+
+ # Handle exceptions now where the X.org version does not exactly match the file-version.
+ case "$xorgversion" in
+ 1.5.99 )
+ vboxvideo_src="vboxvideo_drv_16.so"
+ ;;
+ 7.2.* )
+ vboxvideo_src="vboxvideo_drv_71.so"
+ ;;
+ 6.9.* )
+ vboxvideo_src="vboxvideo_drv_70.so"
+ ;;
+ esac
+
+ retval=0
+ if test -z "$vboxvideo_src"; then
+ echo "*** Unknown version of the X Window System installed."
+ echo "*** Failed to install the VirtualBox X Window System drivers."
+
+ # Exit as partially failed installation
+ retval=2
+ elif test ! -f "$vboxadditions32_path/$vboxvideo_src" && test ! -f "$vboxadditions64_path/$vboxvideo_src"; then
+ # Xorg 1.19 and later already contain a driver for vboxvideo.
+ echo "As of X.Org Server 1.19, the VirtualBox graphics driver (vboxvideo) is part"
+ echo "of Solaris. Please install it from the package repository if necessary."
+ else
+ echo "Installing video driver for X.Org $xorgversion..."
+
+ # Determine destination paths (snv_130 and above use "/usr/lib/xorg", older use "/usr/X11/lib"
+ vboxvideo32_dest_base="/usr/lib/xorg/modules/drivers"
+ if test ! -d $vboxvideo32_dest_base; then
+ vboxvideo32_dest_base="/usr/X11/lib/modules/drivers"
+ fi
+
+ vboxvideo64_dest_base=$vboxvideo32_dest_base/$solaris64dir
+
+ # snv_163 drops 32-bit support completely, and uses 32-bit locations for the 64-bit stuff. Ugly.
+ # We try to detect this by looking at bitness of "vesa_drv.so", and adjust our destination paths accordingly.
+ # We do not rely on using Xorg -version's ABI output because some builds (snv_162 iirc) have 64-bit ABI with
+ # 32-bit file locations.
+ if test -f "$vboxvideo32_dest_base/vesa_drv.so"; then
+ bitsize=`file "$vboxvideo32_dest_base/vesa_drv.so" | grep -i "32-bit"`
+ skip32="no"
+ else
+ echo "* Warning vesa_drv.so missing. Assuming Xorg ABI is 64-bit..."
+ fi
+
+ if test -z "$bitsize"; then
+ skip32="yes"
+ vboxvideo64_dest_base=$vboxvideo32_dest_base
+ fi
+
+ # Make sure destination path exists
+ if test ! -d $vboxvideo64_dest_base; then
+ echo "*** Missing destination paths for video module. Aborting."
+ echo "*** Failed to install the VirtualBox X Window System driver."
+
+ # Exit as partially failed installation
+ retval=2
+ else
+ # 32-bit x11 drivers
+ if test "$skip32" = "no" && test -f "$vboxadditions32_path/$vboxvideo_src"; then
+ vboxvideo_dest="$vboxvideo32_dest_base/vboxvideo_drv.so"
+ /usr/sbin/installf -c none $PKGINST "$vboxvideo_dest" f
+ cp "$vboxadditions32_path/$vboxvideo_src" "$vboxvideo_dest"
+
+ # Removing redundant names from pkg and files from disk
+ /usr/sbin/removef $PKGINST $vboxadditions32_path/vboxvideo_drv_* 1>/dev/null
+ rm -f $vboxadditions32_path/vboxvideo_drv_*
+ fi
+
+ # 64-bit x11 drivers
+ if test -f "$vboxadditions64_path/$vboxvideo_src"; then
+ vboxvideo_dest="$vboxvideo64_dest_base/vboxvideo_drv.so"
+ /usr/sbin/installf -c none $PKGINST "$vboxvideo_dest" f
+ cp "$vboxadditions64_path/$vboxvideo_src" "$vboxvideo_dest"
+
+ # Removing redundant names from pkg and files from disk
+ /usr/sbin/removef $PKGINST $vboxadditions64_path/vboxvideo_drv_* 1>/dev/null
+ rm -f $vboxadditions64_path/vboxvideo_drv_*
+ fi
+
+ # Some distros like Indiana have no xorg.conf, deal with this
+ if test ! -f '/etc/X11/xorg.conf' && test ! -f '/etc/X11/.xorg.conf'; then
+
+ # Xorg 1.3.x+ should use the modeline less Xorg confs while older should
+ # use ones with all the video modelines in place. Argh.
+ xorgconf_file="solaris_xorg_modeless.conf"
+ xorgconf_unfit="solaris_xorg.conf"
+ case "$xorgversion" in
+ 7.1.* | 7.2.* | 6.9.* | 7.0.* )
+ xorgconf_file="solaris_xorg.conf"
+ xorgconf_unfit="solaris_xorg_modeless.conf"
+ ;;
+ esac
+
+ /usr/sbin/removef $PKGINST $vboxadditions_path/$xorgconf_file 1>/dev/null
+ mv -f $vboxadditions_path/$xorgconf_file /etc/X11/.xorg.conf
+
+ /usr/sbin/removef $PKGINST $vboxadditions_path/$xorgconf_unfit 1>/dev/null
+ rm -f $vboxadditions_path/$xorgconf_unfit
+ fi
+
+ # Check for VirtualBox graphics card
+ # S10u10's prtconf doesn't support the '-d' option, so let's use -v even though it's slower.
+ is_vboxgraphics=`prtconf -v | grep -i pci80ee,beef`
+ if test "$?" -eq 0; then
+ drivername="vboxvideo"
+ else
+ # Check for VMware graphics card
+ is_vmwaregraphics=`prtconf -v | grep -i pci15ad,405`
+ if test "$?" -eq 0; then
+ echo "Configuring X.Org to use VMware SVGA graphics driver..."
+ drivername="vmware"
+ fi
+ fi
+
+ # Adjust xorg.conf with video driver sections if a supported graphics card is found
+ if test ! -z "$drivername"; then
+ $vboxadditions_path/x11config15sol.pl "$drivername"
+ else
+ # No supported graphics card found, do nothing.
+ echo "## No supported graphics card found. Skipped configuring of X.org drivers."
+ fi
+ fi
+ fi
+
+
+ # Setup our VBoxClient
+ echo "Configuring client..."
+ vboxclient_src=$vboxadditions_path
+ vboxclient_dest="/usr/share/gnome/autostart"
+ clientinstalled=0
+ if test -d "$vboxclient_dest"; then
+ /usr/sbin/installf -c none $PKGINST $vboxclient_dest/vboxclient.desktop=$vboxadditions_path/vboxclient.desktop s
+ clientinstalled=1
+ fi
+ vboxclient_dest="/usr/dt/config/Xsession.d"
+ if test -d "$vboxclient_dest"; then
+ /usr/sbin/installf -c none $PKGINST $vboxclient_dest/1099.vboxclient=$vboxadditions_path/1099.vboxclient s
+ clientinstalled=1
+ fi
+
+ # Try other autostart locations if none of the above ones work
+ if test $clientinstalled -eq 0; then
+ vboxclient_dest="/etc/xdg/autostart"
+ if test -d "$vboxclient_dest"; then
+ /usr/sbin/installf -c none $PKGINST $vboxclient_dest/1099.vboxclient=$vboxadditions_path/1099.vboxclient s
+ clientinstalled=1
+ else
+ echo "*** Failed to configure client, couldn't find any autostart directory!"
+ # Exit as partially failed installation
+ retval=2
+ fi
+ fi
+else
+ echo "(*) X.Org not found, skipped configuring X.Org guest additions."
+fi
+
+
+# Shared Folder kernel module (different for S10 & Nevada)
+osverstr=`uname -r`
+vboxfsmod="vboxfs"
+vboxfsunused="vboxfs_s10"
+if test "$osverstr" = "5.10"; then
+ vboxfsmod="vboxfs_s10"
+ vboxfsunused="vboxfs"
+fi
+
+# Move the appropriate module to kernel/fs & remove the unused module name from pkg and file from disk
+# 64-bit shared folder module
+if test -f "$vboxadditions64_path/$vboxfsmod"; then
+ echo "Installing 64-bit shared folders module..."
+ /usr/sbin/installf -c none $PKGINST "/usr/kernel/fs/$solaris64dir/vboxfs" f
+ mv -f $vboxadditions64_path/$vboxfsmod /usr/kernel/fs/$solaris64dir/vboxfs
+ /usr/sbin/removef $PKGINST $vboxadditions64_path/$vboxfsmod 1>/dev/null
+ /usr/sbin/removef $PKGINST $vboxadditions64_path/$vboxfsunused 1>/dev/null
+ rm -f $vboxadditions64_path/$vboxfsunused
+fi
+
+# 32-bit shared folder module
+if test -f "$vboxadditions32_path/$vboxfsmod"; then
+ echo "Installing 32-bit shared folders module..."
+ /usr/sbin/installf -c none $PKGINST "/usr/kernel/fs/vboxfs" f
+ mv -f $vboxadditions32_path/$vboxfsmod /usr/kernel/fs/vboxfs
+ /usr/sbin/removef $PKGINST $vboxadditions32_path/$vboxfsmod 1>/dev/null
+ /usr/sbin/removef $PKGINST $vboxadditions32_path/$vboxfsunused 1>/dev/null
+ rm -f $vboxadditions32_path/$vboxfsunused
+fi
+
+# Add a group "vboxsf" for Shared Folders access
+# All users which want to access the auto-mounted Shared Folders have to
+# be added to this group.
+groupadd vboxsf >/dev/null 2>&1
+
+# Move the pointer integration module to kernel/drv & remove the unused module name from pkg and file from disk
+
+# Finalize
+/usr/sbin/removef -f $PKGINST
+/usr/sbin/installf -f $PKGINST
+
+
+if test "$currentzone" = "global"; then
+ /usr/sbin/devfsadm -i vboxguest
+
+ # Setup VBoxService and vboxmslnk and start the services automatically
+ echo "Configuring services (this might take a while)..."
+ cmax=32
+ cslept=0
+ success=0
+ sync
+
+ # 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.
+ /usr/sbin/svcadm restart svc:system/manifest-import:default
+ /usr/bin/svcs virtualbox/vboxservice virtualbox/vboxmslnk >/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
+ /usr/bin/svcs virtualbox/vboxservice virtualbox/vboxmslnk >/dev/null 2>&1
+ done
+ if test "$success" -eq 0; then
+ echo "Enabling services..."
+ /usr/sbin/svcadm enable -s virtualbox/vboxservice
+ /usr/sbin/svcadm enable -s virtualbox/vboxmslnk
+ else
+ echo "## Service import failed."
+ echo "## See /var/svc/log/system-manifest-import:default.log for details."
+ # Exit as partially failed installation
+ retval=2
+ fi
+
+ # Update boot archive
+ BOOTADMBIN=/sbin/bootadm
+ if test -x "$BOOTADMBIN"; then
+ if test -h "/dev/vboxguest"; then
+ echo "Updating boot archive..."
+ $BOOTADMBIN update-archive > /dev/null
+ else
+ echo "## Guest kernel module doesn't seem to be up. Skipped explicit boot-archive update."
+ fi
+ else
+ echo "## $BOOTADMBIN not found/executable. Skipped explicit boot-archive update."
+ fi
+fi
+
+echo "Done."
+if test $retval -eq 0; then
+ if test ! -z "$xorgbin"; then
+ echo "Please re-login to activate the X11 guest additions."
+ fi
+ echo "If you have just un-installed the previous guest additions a REBOOT is required."
+fi
+exit $retval
+
diff --git a/src/VBox/Additions/solaris/Installer/preremove.sh b/src/VBox/Additions/solaris/Installer/preremove.sh
new file mode 100755
index 00000000..2cdd137e
--- /dev/null
+++ b/src/VBox/Additions/solaris/Installer/preremove.sh
@@ -0,0 +1,69 @@
+#!/bin/sh
+# $Id: preremove.sh $
+## @file
+# VirtualBox preremove script for Solaris Guest Additions.
+#
+
+#
+# Copyright (C) 2008-2020 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+
+LC_ALL=C
+export LC_ALL
+
+LANG=C
+export LANG
+
+echo "Removing VirtualBox service..."
+
+# stop and unregister VBoxService
+/usr/sbin/svcadm disable -s virtualbox/vboxservice
+# Don't need to delete, taken care of by the manifest action
+# /usr/sbin/svccfg delete svc:/application/virtualbox/vboxservice:default
+/usr/sbin/svcadm restart svc:/system/manifest-import:default
+
+# stop VBoxClient
+pkill -INT VBoxClient
+
+echo "Removing VirtualBox kernel modules..."
+
+# vboxguest.sh would've been installed, we just need to call it.
+/opt/VirtualBoxAdditions/vboxguest.sh stopall silentunload
+
+# remove devlink.tab entry for vboxguest
+sed -e '
+/name=vboxguest/d' /etc/devlink.tab > /etc/devlink.vbox
+mv -f /etc/devlink.vbox /etc/devlink.tab
+
+# remove the link
+if test -h "/dev/vboxguest" || test -f "/dev/vboxguest"; then
+ rm -f /dev/vboxdrv
+fi
+if test -h "/dev/vboxms" || test -f "/dev/vboxms"; then
+ rm -f /dev/vboxms
+fi
+
+# Try and restore xorg.conf!
+echo "Restoring X.Org..."
+/opt/VirtualBoxAdditions/x11restore.pl
+
+
+echo "Done."
+
diff --git a/src/VBox/Additions/solaris/Installer/vbox_vendor_select b/src/VBox/Additions/solaris/Installer/vbox_vendor_select
new file mode 100755
index 00000000..0e788cfc
--- /dev/null
+++ b/src/VBox/Additions/solaris/Installer/vbox_vendor_select
@@ -0,0 +1,88 @@
+#!/bin/ksh93
+# $Id: vbox_vendor_select $
+## @file
+# ???
+#
+
+#
+# Copyright (C) 2013-2020 Oracle Corporation
+# This file is based on mesa_vendor_select from Solaris 11.3 with the following copyright:
+#
+# Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+#
+
+LINKDIR=/system/volatile/opengl
+MESA_SELECT=/lib/opengl/ogl_select/mesa_vendor_select
+
+PATH=/usr/bin:/usr/sbin
+
+ARCH="$(uname -p)"
+
+case "${ARCH}" in
+ i386) ;;
+ *) exit 1 ;; # Unsupported architecture
+esac
+
+# We need Mesa for the parts we do not supply.
+if [[ ! -x "${MESA_SELECT}" ]]; then
+ exit 0
+fi
+
+if [[ $# -eq 1 ]] && [[ $1 == "identify" ]] ; then
+ # Probe time. Check whether this system supports pass-through.
+ # If so, emit an identity string attaching us to the current
+ # console identifier.
+ if /usr/bin/VBoxClient --check3d ; then
+ print "$(constype) vbox"
+ fi
+ return 0
+fi
+
+# Make a file link. $1 is the source path, $2 is the target path
+function make_link {
+ if [[ $# != 2 ]]; then
+ return
+ fi
+ if [[ -h $2 ]]; then
+ rm -f $2
+ fi
+ ln -sf $1 $2
+}
+
+# Start by setting up Mesa, as we use that for everything except the user
+# libraries.
+${MESA_SELECT}
+
+# User libraries
+if [[ -f ${LINKDIR}/lib/libGL.so.1 ]] && [[ -f /usr/lib/VBoxOGL.so ]] ; then
+ make_link /usr/lib/VBoxOGL.so ${LINKDIR}/lib/libGL.so.1
+fi
+if [[ -f ${LINKDIR}/lib/i386/libGL.so.1 ]] && \
+ [[ -f /usr/lib/i386/VBoxOGL.so ]] ; then
+ make_link /usr/lib/i386/VBoxOGL.so ${LINKDIR}/lib/i386/libGL.so.1
+fi
+if [[ -f ${LINKDIR}/lib/amd64/libGL.so.1 ]] && \
+ [[ -f /usr/lib/amd64/VBoxOGL.so ]] ; then
+ make_link /usr/lib/amd64/VBoxOGL.so ${LINKDIR}/lib/amd64/libGL.so.1
+fi
+
+return 0
diff --git a/src/VBox/Additions/solaris/Installer/vboxdevlink.sed b/src/VBox/Additions/solaris/Installer/vboxdevlink.sed
new file mode 100644
index 00000000..4511962e
--- /dev/null
+++ b/src/VBox/Additions/solaris/Installer/vboxdevlink.sed
@@ -0,0 +1,34 @@
+# $Id$
+## @file
+# sed class script to modify /etc/devlink.tab
+#
+
+#
+# Copyright (C) 2008-2020 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+
+!install
+/name=vboxguest/d
+$i\
+type=ddi_pseudo;name=vboxguest \\D
+
+!remove
+/name=vboxguest/d
+
diff --git a/src/VBox/Additions/solaris/Installer/vboxguest.depend b/src/VBox/Additions/solaris/Installer/vboxguest.depend
new file mode 100644
index 00000000..68196355
--- /dev/null
+++ b/src/VBox/Additions/solaris/Installer/vboxguest.depend
@@ -0,0 +1 @@
+P SUNWuiu8 Iconv modules for UTF-8 Locale
diff --git a/src/VBox/Additions/solaris/Installer/vboxguest.pkginfo b/src/VBox/Additions/solaris/Installer/vboxguest.pkginfo
new file mode 100644
index 00000000..9456d0d4
--- /dev/null
+++ b/src/VBox/Additions/solaris/Installer/vboxguest.pkginfo
@@ -0,0 +1,15 @@
+PKG="SUNWvboxguest"
+NAME="@VBOX_PRODUCT@ Guest Additions"
+SUNW_PRODNAME="@VBOX_PRODUCT@ Guest Additions"
+ARCH="@UNAME_P@"
+VERSION="@VBOX_VERSION_STRING@,REV=r@VBOX_SVN_REV@.@VBOX_VERSION_REVSTAMP@"
+SUNW_PRODVERS="@VBOX_VERSION_STRING@"
+SUNW_PKGVERS=1.0
+CATEGORY="application"
+VENDOR="@VBOX_VENDOR@"
+EMAIL="info@virtualbox.org"
+HOTLINE="Please contact your local service provider"
+BASEDIR="/"
+CLASSES=none manifest
+DESC="@VBOX_PRODUCT@ Guest Additions for Solaris guests"
+
diff --git a/src/VBox/Additions/solaris/Installer/vboxguest.sh b/src/VBox/Additions/solaris/Installer/vboxguest.sh
new file mode 100755
index 00000000..6671bfe6
--- /dev/null
+++ b/src/VBox/Additions/solaris/Installer/vboxguest.sh
@@ -0,0 +1,252 @@
+#!/bin/sh
+# $Id: vboxguest.sh $
+## @file
+# VirtualBox Guest Additions kernel module control script for Solaris.
+#
+
+#
+# Copyright (C) 2008-2020 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+
+LC_ALL=C
+export LC_ALL
+
+LANG=C
+export LANG
+
+SILENTUNLOAD=""
+MODNAME="vboxguest"
+VFSMODNAME="vboxfs"
+VMSMODNAME="vboxms"
+MODDIR32="/usr/kernel/drv"
+MODDIR64="/usr/kernel/drv/amd64"
+VFSDIR32="/usr/kernel/fs"
+VFSDIR64="/usr/kernel/fs/amd64"
+
+abort()
+{
+ echo 1>&2 "## $1"
+ exit 1
+}
+
+info()
+{
+ echo 1>&2 "$1"
+}
+
+check_if_installed()
+{
+ cputype=`isainfo -k`
+ modulepath="$MODDIR32/$MODNAME"
+ if test "$cputype" = "amd64"; then
+ modulepath="$MODDIR64/$MODNAME"
+ fi
+ if test -f "$modulepath"; then
+ return 0
+ fi
+ abort "VirtualBox kernel module ($MODNAME) NOT installed."
+}
+
+module_loaded()
+{
+ if test -z "$1"; then
+ abort "missing argument to module_loaded()"
+ fi
+
+ modname=$1
+ # modinfo should now work properly since we prevent module autounloading.
+ loadentry=`/usr/sbin/modinfo | grep "$modname "`
+ if test -z "$loadentry"; then
+ return 1
+ fi
+ return 0
+}
+
+vboxguest_loaded()
+{
+ module_loaded $MODNAME
+ return $?
+}
+
+vboxfs_loaded()
+{
+ module_loaded $VFSMODNAME
+ return $?
+}
+
+vboxms_loaded()
+{
+ module_loaded $VMSMODNAME
+ return $?
+}
+
+check_root()
+{
+ # the reason we don't use "-u" is that some versions of id are old and do not
+ # support this option (eg. Solaris 10) and do not have a "--version" to check it either
+ # so go with the uglier but more generic approach
+ idbin=`which id`
+ isroot=`$idbin | grep "uid=0"`
+ if test -z "$isroot"; then
+ abort "This program must be run with administrator privileges. Aborting"
+ fi
+}
+
+start_module()
+{
+ /usr/sbin/add_drv -i'pci80ee,cafe' -m'* 0666 root sys' $MODNAME
+ if test ! vboxguest_loaded; then
+ abort "Failed to load VirtualBox guest kernel module."
+ elif test -c "/devices/pci@0,0/pci80ee,cafe@4:$MODNAME"; then
+ info "VirtualBox guest kernel module loaded."
+ else
+ info "VirtualBox guest kernel module failed to attach."
+ fi
+}
+
+stop_module()
+{
+ if vboxguest_loaded; then
+ /usr/sbin/rem_drv $MODNAME || abort "Failed to unload VirtualBox guest kernel module."
+ info "VirtualBox guest kernel module unloaded."
+ elif test -z "$SILENTUNLOAD"; then
+ info "VirtualBox guest kernel module not loaded."
+ fi
+}
+
+start_vboxfs()
+{
+ if vboxfs_loaded; then
+ info "VirtualBox FileSystem kernel module already loaded."
+ else
+ /usr/sbin/modload -p fs/$VFSMODNAME || abort "Failed to load VirtualBox FileSystem kernel module."
+ if test ! vboxfs_loaded; then
+ info "Failed to load VirtualBox FileSystem kernel module."
+ else
+ info "VirtualBox FileSystem kernel module loaded."
+ fi
+ fi
+}
+
+stop_vboxfs()
+{
+ if vboxfs_loaded; then
+ vboxfs_mod_id=`/usr/sbin/modinfo | grep $VFSMODNAME | cut -f 1 -d ' ' `
+ if test -n "$vboxfs_mod_id"; then
+ /usr/sbin/modunload -i $vboxfs_mod_id || abort "Failed to unload VirtualBox FileSystem module."
+ info "VirtualBox FileSystem kernel module unloaded."
+ fi
+ elif test -z "$SILENTUNLOAD"; then
+ info "VirtualBox FileSystem kernel module not loaded."
+ fi
+}
+
+start_vboxms()
+{
+ /usr/sbin/add_drv -m'* 0666 root sys' $VMSMODNAME
+ if test ! vboxms_loaded; then
+ abort "Failed to load VirtualBox pointer integration module."
+ elif test -c "/devices/pseudo/$VMSMODNAME@0:$VMSMODNAME"; then
+ info "VirtualBox pointer integration module loaded."
+ else
+ info "VirtualBox pointer integration module failed to attach."
+ fi
+}
+
+stop_vboxms()
+{
+ if vboxms_loaded; then
+ /usr/sbin/rem_drv $VMSMODNAME || abort "Failed to unload VirtualBox pointer integration module."
+ info "VirtualBox pointer integration module unloaded."
+ elif test -z "$SILENTUNLOAD"; then
+ info "VirtualBox pointer integration module not loaded."
+ fi
+}
+
+status_module()
+{
+ if vboxguest_loaded; then
+ info "Running."
+ else
+ info "Stopped."
+ fi
+}
+
+stop_all()
+{
+ stop_vboxms
+ stop_vboxfs
+ stop_module
+ return 0
+}
+
+restart_all()
+{
+ stop_all
+ start_module
+ start_vboxfs
+ start_vboxms
+ return 0
+}
+
+check_root
+check_if_installed
+
+if test "$2" = "silentunload"; then
+ SILENTUNLOAD="$2"
+fi
+
+case "$1" in
+stopall)
+ stop_all
+ ;;
+restartall)
+ restart_all
+ ;;
+start)
+ start_module
+ start_vboxms
+ ;;
+stop)
+ stop_vboxms
+ stop_module
+ ;;
+status)
+ status_module
+ ;;
+vfsstart)
+ start_vboxfs
+ ;;
+vfsstop)
+ stop_vboxfs
+ ;;
+vmsstart)
+ start_vboxms
+ ;;
+vmsstop)
+ stop_vboxms
+ ;;
+*)
+ echo "Usage: $0 {start|stop|restart|status}"
+ exit 1
+esac
+
+exit 0
+
diff --git a/src/VBox/Additions/solaris/Installer/vboxguest.space b/src/VBox/Additions/solaris/Installer/vboxguest.space
new file mode 100644
index 00000000..993a6f6d
--- /dev/null
+++ b/src/VBox/Additions/solaris/Installer/vboxguest.space
@@ -0,0 +1,5 @@
+# Space file for VirtualBox Guest Additions installer
+# We only create a few links and copy a few files, reserve some space
+# pathname blocks inodes
+/ 5000 8
+
diff --git a/src/VBox/Additions/solaris/Installer/vboxservice.xml b/src/VBox/Additions/solaris/Installer/vboxservice.xml
new file mode 100644
index 00000000..270c23f1
--- /dev/null
+++ b/src/VBox/Additions/solaris/Installer/vboxservice.xml
@@ -0,0 +1,76 @@
+<?xml version='1.0'?>
+<!--
+#
+# Solaris SMF service manifest for VBoxService (timesync).
+#
+ Copyright (C) 2008-2020 Oracle Corporation
+
+ This file is part of VirtualBox Open Source Edition (OSE), as
+ available from http://www.virtualbox.org. This file is free software;
+ you can redistribute it and/or modify it under the terms of the GNU
+ General Public License (GPL) as published by the Free Software
+ Foundation, in version 2 as it comes in the "COPYING" file of the
+ VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+ The contents of this file may alternatively be used under the terms
+ of the Common Development and Distribution License Version 1.0
+ (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ VirtualBox OSE distribution, in which case the provisions of the
+ CDDL are applicable instead of those of the GPL.
+
+ You may elect to license modified versions of this file under the
+ terms and conditions of either the GPL or the CDDL or both.
+-->
+<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
+
+<service_bundle type='manifest' name='SUNWvboxguest:vboxservice'>
+
+<service
+ name='application/virtualbox/vboxservice'
+ type='service'
+ version='1'>
+
+ <create_default_instance enabled='false' />
+
+ <single_instance/>
+
+ <!-- Wait for devices to be initialized as we depend on vboxguest (PCI) -->
+ <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='/usr/bin/VBoxService'
+ timeout_seconds='30' />
+
+ <exec_method
+ type='method'
+ name='stop'
+ exec=':kill'
+ timeout_seconds='60' />
+
+ <template>
+ <common_name>
+ <loctext xml:lang='C'>VirtualBox Service.</loctext>
+ </common_name>
+ </template>
+</service>
+
+</service_bundle>
+