diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2014-03-26 19:21:20 +0000 |
---|---|---|
committer | <> | 2014-05-08 15:03:54 +0000 |
commit | fb123f93f9f5ce42c8e5785d2f8e0edaf951740e (patch) | |
tree | c2103d76aec5f1f10892cd1d3a38e24f665ae5db /src/VBox/Installer/solaris | |
parent | 58ed4748338f9466599adfc8a9171280ed99e23f (diff) | |
download | VirtualBox-master.tar.gz |
Imported from /home/lorry/working-area/delta_VirtualBox/VirtualBox-4.3.10.tar.bz2.HEADVirtualBox-4.3.10master
Diffstat (limited to 'src/VBox/Installer/solaris')
-rw-r--r-- | src/VBox/Installer/solaris/Makefile.kmk | 36 | ||||
-rwxr-xr-x | src/VBox/Installer/solaris/VBox.sh | 5 | ||||
-rw-r--r-- | src/VBox/Installer/solaris/VBoxISAExec.c | 2 | ||||
-rw-r--r-- | src/VBox/Installer/solaris/VBoxZoneAccess.c | 23 | ||||
-rwxr-xr-x | src/VBox/Installer/solaris/checkinstall.sh | 26 | ||||
-rwxr-xr-x | src/VBox/Installer/solaris/makepackage.sh | 12 | ||||
-rwxr-xr-x | src/VBox/Installer/solaris/pkginstall.sh | 13 | ||||
-rwxr-xr-x | src/VBox/Installer/solaris/postinstall.sh | 7 | ||||
-rwxr-xr-x | src/VBox/Installer/solaris/preremove.sh | 7 | ||||
-rwxr-xr-x | src/VBox/Installer/solaris/smf-vboxautostart.sh | 58 | ||||
-rwxr-xr-x | src/VBox/Installer/solaris/smf-vboxballoonctrl.sh | 81 | ||||
-rwxr-xr-x | src/VBox/Installer/solaris/vboxconfig.sh | 174 | ||||
-rw-r--r-- | src/VBox/Installer/solaris/virtualbox-autostart.xml | 13 | ||||
-rw-r--r-- | src/VBox/Installer/solaris/virtualbox-balloonctrl.xml | 12 | ||||
-rw-r--r-- | src/VBox/Installer/solaris/virtualbox-webservice.xml | 8 | ||||
-rw-r--r-- | src/VBox/Installer/solaris/virtualbox-zoneaccess.xml | 2 |
16 files changed, 371 insertions, 108 deletions
diff --git a/src/VBox/Installer/solaris/Makefile.kmk b/src/VBox/Installer/solaris/Makefile.kmk index a94d1bb4..11a3519e 100644 --- a/src/VBox/Installer/solaris/Makefile.kmk +++ b/src/VBox/Installer/solaris/Makefile.kmk @@ -4,7 +4,7 @@ # # -# Copyright (C) 2007-2012 Oracle Corporation +# Copyright (C) 2007-2013 Oracle Corporation # # This file is part of VirtualBox Open Source Edition (OSE), as # available from http://www.virtualbox.org. This file is free software; @@ -206,10 +206,10 @@ SOLARIS_STRIP_EXES = \ VBoxZoneAccess \ $(if $(VBOX_WITH_QTGUI),VirtualBox,) \ VBoxManage \ - $(if $(VBOX_WITH_VBOXBFE),VBoxBFE,) \ $(if $(VBOX_WITH_VBOXSDL),VBoxSDL,) \ $(if $(VBOX_WITH_NETADP),VBoxNetAdpCtl,) \ VBoxNetDHCP \ + VBoxNetNAT \ $(if $(VBOX_WITH_EXTPACK),VBoxExtPackHelperApp,) \ VBoxSVC \ $(if $(VBOX_WITH_CROGL),VBoxTestOGL,) \ @@ -266,10 +266,18 @@ SOLARIS_STRIP_BINS = \ components/VBoxC.so \ components/VBoxSVCM.so \ components/VBoxXPCOMIPCC.so +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 += \ + SOLARIS_STRIP_BINS += \ VBoxNetDHCP.so \ - $(if $(VBOX_WITH_VBOXBFE),VBoxBFE.so,) \ + VBoxNetNAT.so \ $(if $(VBOX_WITH_VBOXSDL),VBoxSDL.so,) \ $(if $(VBOX_WITH_QTGUI),VirtualBox.so,) endif @@ -472,7 +480,8 @@ else $(ifeq ($(KBUILD_TARGET_ARCH),amd64),$(addprefix $(SOLARIS_VBOXINST_DIR_ISA)/,$(SOLARIS_STRIP_OBJ_64)),) \ $(addprefix $(SOLARIS_VBOXINST_DIR_ISA)/,$(SOLARIS_STRIP_OBJS)) \ $(addprefix $(SOLARIS_VBOXINST_DIR_ISA)/,$(SOLARIS_NO_STRIP)) \ - $(addprefix $(SOLARIS_VBOXINST_DIR_ISA)/,$(SOLARIS_QTLIBS)) + $(addprefix $(SOLARIS_VBOXINST_DIR_ISA)/,$(SOLARIS_QTLIBS)) \ + $(wildcard $(addprefix $(SOLARIS_OUT_BIN)/,VBoxPython*.so)) SOLARIS_DBG_DEPFILES = $(addprefix $(SOLARIS_DBG_DIR_ISA)/,$(SOLARIS_DBG_FILES)) endif SOLARIS_ARCH_DEPFILES += $(addprefix $(SOLARIS_VBOXINST_DIR)/,$(SOLARIS_COMMON)) \ @@ -529,6 +538,10 @@ include $(FILE_KBUILD_SUB_FOOTER) # # -=-=-=-=-=-=-=- Main package -=-=-=-=-=-=-=- # +# !!WARNING!! The current packing may NOT produce the expected rules in +# !!WARNING!! incremental build! Removed and renamed components may +# !!WARNING!! appear in the package! Always do clean builds for customers. +# ## @todo r=bird: makepackage.sh packing a directory tree, right? So, there is no guarantee that it's not # containing any obsolete files the way packing is performed here. Consider recursively @@ -613,7 +626,12 @@ else @# @todo -XXX- how to get rid of this manual MKDIR ? ifdef VBOX_WITH_PYTHON $(QUIET)$(if $(SOL64_PKG),$(MKDIR) -p $(SOLARIS_VBOXINST_DIR)/$(VBOX_SOL_PYTHON_DIR_64),) + ifdef VBOX_WITH_32_ON_64_MAIN_API + $(QUIET)$(INSTALL) -m 0644 $(if $(VBOX_DO_STRIP),-s) $(filter %_x86.so,$(wildcard $(SOLARIS_OUT_BIN)/VBoxPython*.so)) $(SOLARIS_VBOXINST_DIR)/ + $(QUIET)$(INSTALL) -m 0644 $(if $(VBOX_DO_STRIP),-s) $(filter-out %_x86.so,$(wildcard $(SOLARIS_OUT_BIN)/VBoxPython*.so)) $(SOLARIS_VBOXINST_DIR)/$(VBOX_SOL_PYTHON_DIR_64)/ + else $(QUIET)$(INSTALL) -m 0644 $(if $(VBOX_DO_STRIP),-s) $(wildcard $(SOLARIS_OUT_BIN)/VBoxPython*.so) $(SOLARIS_VBOXINST_DIR)/$(if $(SOL64_PKG),$(VBOX_SOL_PYTHON_DIR_64)/,) + endif endif $(QUIET)$(if $(VBOX_WITH_QTGUI),$(if $(VBOX_WITH_QT4_SUN),$(INSTALL) -m 0755 $(VBOX_PATH_QT4)/bin/qtconfig $(SOLARIS_VBOXINST_DIR_ISA)/VBoxQtconfig,),) $(QUIET)$(INSTALL) -m 0755 $(SOLARIS_OUT_BIN)/VBoxISAExec $(SOLARIS_VBOXINST_DIR)/VBoxISAExec @@ -688,7 +706,7 @@ endif @# Clean up files emitted as side-effect or result of packing $(QUIET)$(RM) -f $(SOLARIS_BASEINST_DIR)/$(PKG_FILENAME).tar.gz $(QUIET)$(RM) -f $(SOLARIS_BASEINST_DIR)/$(PKG_FILENAME).pkg - $(call MSG_L1,Packaging completed.) + $(call MSG_L1,Packaging $@ is completed.) # @@ -783,8 +801,7 @@ $(addprefix $(SOLARIS_USRSHR_ICONS_DIR)/,$(SOLARIS_COMMON_ICONS)): \ # Some symlinks are created manually in the prepackage steps above (eg. VBoxQtconfig) # as those binaries do not originate from $(PATH_STAGE_BIN) # -$(addprefix $(SOLARIS_USRBIN_DIR)/,$(SOLARIS_USRBIN_LINKS)): \ - $(SOLARIS_USRBIN_DIR)/% : % | $$(dir $$@) +$(addprefix $(SOLARIS_USRBIN_DIR)/,$(SOLARIS_USRBIN_LINKS)): | $$(dir $$@) $(LN_SYMLINK) -f ../../$(SOLARIS_VBOXINST_SUBDIR)/VBox.sh $@ @@ -798,9 +815,10 @@ $(PATH_STAGE_BIN)/$(DBG_ARCHIVE): \ $(SOLARIS_DBG_DEPFILES) $(call MSG_L1,Installing debug binaries $(SOLARIS_DBG_DIR)) $(call MSG_L1,Packing $@) - $(QUIET)/usr/sfw/bin/gtar --dereference --owner 0 --group 0 \ + $(QUIET)$(SOL_GTAR) --dereference --owner 0 --group 0 \ -cjRhf "$(PATH_STAGE_BIN)/$(DBG_ARCHIVE)" -C "$(SOLARIS_INST_OUT_DIR)" "$(SOLARIS_DBG_DIR_NAME)" $(QUIET)$(CHMOD) 0644 $@ + $(call MSG_L1,Packaging $@ is completed.) # # 32-bit Debug package diff --git a/src/VBox/Installer/solaris/VBox.sh b/src/VBox/Installer/solaris/VBox.sh index 50a68260..c8f3584a 100755 --- a/src/VBox/Installer/solaris/VBox.sh +++ b/src/VBox/Installer/solaris/VBox.sh @@ -2,7 +2,7 @@ # # Oracle VM VirtualBox startup script, Solaris hosts. # -# Copyright (C) 2006-2011 Oracle Corporation +# Copyright (C) 2006-2012 Oracle Corporation # # This file is part of VirtualBox Open Source Edition (OSE), as # available from http://www.virtualbox.org. This file is free software; @@ -43,9 +43,6 @@ case "$APP" in vboxwebsrv) exec "$INSTALL_DIR/vboxwebsrv" "$@" ;; - VBoxBFE|vboxbfe) - exec "$INSTALL_DIR/VBoxBFE" "$@" - ;; VBoxQtconfig) exec "$INSTALL_DIR/VBoxQtconfig" "$@" ;; diff --git a/src/VBox/Installer/solaris/VBoxISAExec.c b/src/VBox/Installer/solaris/VBoxISAExec.c index 97f8ad9f..ed33f198 100644 --- a/src/VBox/Installer/solaris/VBoxISAExec.c +++ b/src/VBox/Installer/solaris/VBoxISAExec.c @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2006-2007 Oracle Corporation + * Copyright (C) 2006-2010 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; diff --git a/src/VBox/Installer/solaris/VBoxZoneAccess.c b/src/VBox/Installer/solaris/VBoxZoneAccess.c index a77f32cb..5ec8c309 100644 --- a/src/VBox/Installer/solaris/VBoxZoneAccess.c +++ b/src/VBox/Installer/solaris/VBoxZoneAccess.c @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2006-2007 Oracle Corporation + * Copyright (C) 2006-2012 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; @@ -26,11 +26,16 @@ #include <iprt/process.h> -#define DEVICE_NAME "/dev/vboxdrv" +/******************************************************************************* +* 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) @@ -52,11 +57,22 @@ int main(int argc, char *argv[]) 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) + 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; } @@ -65,6 +81,7 @@ int main(int argc, char *argv[]) sleep(500000000U); close(hDevice); + close(hDeviceUsr); return 0; } diff --git a/src/VBox/Installer/solaris/checkinstall.sh b/src/VBox/Installer/solaris/checkinstall.sh index 92c186ce..8dec8036 100755 --- a/src/VBox/Installer/solaris/checkinstall.sh +++ b/src/VBox/Installer/solaris/checkinstall.sh @@ -5,7 +5,7 @@ # # -# Copyright (C) 2009-2010 Oracle Corporation +# Copyright (C) 2009-2012 Oracle Corporation # # This file is part of VirtualBox Open Source Edition (OSE), as # available from http://www.virtualbox.org. This file is free software; @@ -162,6 +162,13 @@ if test ! -z "$VBOXNETDHCP_PID" && test "$VBOXNETDHCP_PID" -ge 0; then 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 @@ -187,5 +194,22 @@ if test -x "$BIN_IFCONFIG"; then fi fi +# If we are using SVR4 packages then make sure that SMF has finished +# disabling any services left over from a previous installation which +# may interfere with installing new ones. Should only be relevant on +# Solaris 11. +if test -x "$BIN_PKGINFO"; then + for i in 1 2 3 4 5 6 7 8 9 10; do + svcs -a | grep virtualbox >/dev/null || break + if test "${i}" = "1"; then + printf "Waiting for services from previous installation to be removed." + else + printf "." + fi + sleep 1 + done + test "${i}" = "1" || printf "\n" +fi + exit 0 diff --git a/src/VBox/Installer/solaris/makepackage.sh b/src/VBox/Installer/solaris/makepackage.sh index 439923d1..1a82f18a 100755 --- a/src/VBox/Installer/solaris/makepackage.sh +++ b/src/VBox/Installer/solaris/makepackage.sh @@ -1,11 +1,11 @@ #!/bin/sh +# $Id: makepackage.sh $ ## @file -# # VirtualBox package creation script, Solaris hosts. # # -# Copyright (C) 2007-2011 Oracle Corporation +# Copyright (C) 2007-2012 Oracle Corporation # # This file is part of VirtualBox Open Source Edition (OSE), as # available from http://www.virtualbox.org. This file is free software; @@ -117,6 +117,7 @@ ln -f ./VBoxISAExec $VBOX_INSTALLED_DIR/VBoxAutostart ln -f ./VBoxISAExec $VBOX_INSTALLED_DIR/vboxwebsrv ln -f ./VBoxISAExec $VBOX_INSTALLED_DIR/webtest ln -f ./VBoxISAExec $VBOX_INSTALLED_DIR/VBoxZoneAccess +ln -f ./VBoxISAExec $VBOX_INSTALLED_DIR/VBoxSVC if test -f $VBOX_INSTALLED_DIR/amd64/VBoxTestOGL || test -f $VBOX_INSTALLED_DIR/i386/VBoxTestOGL; then ln -f ./VBoxISAExec $VBOX_INSTALLED_DIR/VBoxTestOGL fi @@ -124,9 +125,6 @@ fi if test -f $VBOX_INSTALLED_DIR/amd64/VirtualBox || test -f $VBOX_INSTALLED_DIR/i386/VirtualBox; then ln -f ./VBoxISAExec $VBOX_INSTALLED_DIR/VirtualBox fi -if test -f $VBOX_INSTALLED_DIR/amd64/VBoxBFE || test -f $VBOX_INSTALLED_DIR/i386/VBoxBFE; then - ln -f ./VBoxISAExec $VBOX_INSTALLED_DIR/VBoxBFE -fi if test -f $VBOX_INSTALLED_DIR/amd64/VBoxHeadless || test -f $VBOX_INSTALLED_DIR/i386/VBoxHeadless; then ln -f ./VBoxISAExec $VBOX_INSTALLED_DIR/VBoxHeadless ln -fs ./VBoxHeadless $VBOX_INSTALLED_DIR/VBoxVRDP @@ -192,12 +190,10 @@ if test -n "$HARDENED"; then || $3 == "opt/VirtualBox/amd64/VirtualBox3" \ || $3 == "opt/VirtualBox/amd64/VBoxHeadless" \ || $3 == "opt/VirtualBox/amd64/VBoxSDL" \ - || $3 == "opt/VirtualBox/amd64/VBoxBFE" \ || $3 == "opt/VirtualBox/i386/VirtualBox" \ || $3 == "opt/VirtualBox/i386/VirtualBox3" \ || $3 == "opt/VirtualBox/i386/VBoxHeadless" \ || $3 == "opt/VirtualBox/i386/VBoxSDL" \ - || $3 == "opt/VirtualBox/i386/VBoxBFE" \ ) \ { $4 = "4755" } { print }' prototype > prototype2 mv -f prototype2 prototype @@ -209,6 +205,8 @@ $VBOX_AWK 'NF == 6 \ || $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" } { print }' prototype > prototype2 mv -f prototype2 prototype diff --git a/src/VBox/Installer/solaris/pkginstall.sh b/src/VBox/Installer/solaris/pkginstall.sh index 49aea0cf..79b0d7c8 100755 --- a/src/VBox/Installer/solaris/pkginstall.sh +++ b/src/VBox/Installer/solaris/pkginstall.sh @@ -1,4 +1,5 @@ #!/bin/sh +# $Id: pkginstall.sh $ ## @file # # VirtualBox postinstall script for Solaris. @@ -8,7 +9,7 @@ # # -# Copyright (C) 2009-2010 Oracle Corporation +# Copyright (C) 2009-2012 Oracle Corporation # # This file is part of VirtualBox Open Source Edition (OSE), as # available from http://www.virtualbox.org. This file is free software; @@ -29,12 +30,18 @@ else 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" +${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 + $PKG_INSTALL_ROOT/opt/VirtualBox/vboxconfig.sh --postinstall ${DEBUGOPT} rc=$? if test "$rc" -ne 0; then echo 1>&2 "## Completed but with errors." diff --git a/src/VBox/Installer/solaris/postinstall.sh b/src/VBox/Installer/solaris/postinstall.sh index 1dbfa2bd..6264ac61 100755 --- a/src/VBox/Installer/solaris/postinstall.sh +++ b/src/VBox/Installer/solaris/postinstall.sh @@ -1,11 +1,11 @@ #!/bin/sh +# $Id: postinstall.sh $ ## @file -# # VirtualBox postinstall script for Solaris. # # -# Copyright (C) 2007-2010 Oracle Corporation +# Copyright (C) 2007-2012 Oracle Corporation # # This file is part of VirtualBox Open Source Edition (OSE), as # available from http://www.virtualbox.org. This file is free software; @@ -19,7 +19,8 @@ rc=0 currentzone=`zonename` if test "$currentzone" = "global"; then - ${PKG_INSTALL_ROOT:=/}/opt/VirtualBox/pkginstall.sh --srv4 + 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 diff --git a/src/VBox/Installer/solaris/preremove.sh b/src/VBox/Installer/solaris/preremove.sh index a0ab4b52..388980f9 100755 --- a/src/VBox/Installer/solaris/preremove.sh +++ b/src/VBox/Installer/solaris/preremove.sh @@ -1,8 +1,13 @@ #!/bin/sh +# $Id: preremove.sh $ +## @file +# VirtualBox preremove script for Solaris. +# + # # VirtualBox preremove script for Solaris. # -# Copyright (C) 2007-2010 Oracle Corporation +# Copyright (C) 2007-2013 Oracle Corporation # # This file is part of VirtualBox Open Source Edition (OSE), as # available from http://www.virtualbox.org. This file is free software; diff --git a/src/VBox/Installer/solaris/smf-vboxautostart.sh b/src/VBox/Installer/solaris/smf-vboxautostart.sh index 5a9314fa..6e0332b0 100755 --- a/src/VBox/Installer/solaris/smf-vboxautostart.sh +++ b/src/VBox/Installer/solaris/smf-vboxautostart.sh @@ -1,7 +1,7 @@ #!/sbin/sh # $Id: smf-vboxautostart.sh $ -# Copyright (C) 2012 Oracle Corporation +# Copyright (C) 2012-2014 Oracle Corporation # # This file is part of VirtualBox Open Source Edition (OSE), as # available from http://www.virtualbox.org. This file is free software; @@ -24,13 +24,13 @@ VW_EXIT=0 case $VW_OPT in start) - if [ ! -x /opt/VirtualBox/VBoxAutostart ]; then + if [ ! -f /opt/VirtualBox/VBoxAutostart ]; then echo "ERROR: /opt/VirtualBox/VBoxAutostart does not exist." return $SMF_EXIT_ERR_CONFIG fi - if [ ! -f /opt/VirtualBox/VBoxAutostart ]; then - echo "ERROR: /opt/VirtualBox/VBoxAutostart does not exist." + if [ ! -x /opt/VirtualBox/VBoxAutostart ]; then + echo "ERROR: /opt/VirtualBox/VBoxAutostart is not exectuable." return $SMF_EXIT_ERR_CONFIG fi @@ -43,17 +43,20 @@ case $VW_OPT in [ $? != 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 staff` + for VW_USER in `logins -g $VW_VBOXGROUP | cut -d' ' -f1` do - exec su - "$VW_USER" -c "/opt/VirtualBox/VBoxAutostart --background --start --config \"$VW_CONFIG\" --logrotate \"$VW_ROTATE\" --logsize \"$VW_LOGSIZE\" --loginterval \"$VW_LOGINTERVAL\"" + 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 @@ -64,8 +67,47 @@ case $VW_OPT in done ;; stop) - # Kill service contract - smf_kill_contract $2 TERM 1 + 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 diff --git a/src/VBox/Installer/solaris/smf-vboxballoonctrl.sh b/src/VBox/Installer/solaris/smf-vboxballoonctrl.sh index a01b4681..d27124cf 100755 --- a/src/VBox/Installer/solaris/smf-vboxballoonctrl.sh +++ b/src/VBox/Installer/solaris/smf-vboxballoonctrl.sh @@ -1,7 +1,7 @@ #!/sbin/sh # $Id: smf-vboxballoonctrl.sh $ -# Copyright (C) 2008-2012 Oracle Corporation +# Copyright (C) 2008-2013 Oracle Corporation # # This file is part of VirtualBox Open Source Edition (OSE), as # available from http://www.virtualbox.org. This file is free software; @@ -35,33 +35,62 @@ case $VW_OPT in fi # Get svc configuration - VW_USER=`/usr/bin/svcprop -p config/user $SMF_FMRI 2>/dev/null` - [ $? != 0 ] && VW_USER= - VW_INTERVAL=`/usr/bin/svcprop -p config/interval $SMF_FMRI 2>/dev/null` - [ $? != 0 ] && VW_INTERVAL= - VW_INCREMENT=`/usr/bin/svcprop -p config/increment $SMF_FMRI 2>/dev/null` - [ $? != 0 ] && VW_INCREMENT= - VW_DECREMENT=`/usr/bin/svcprop -p config/decrement $SMF_FMRI 2>/dev/null` - [ $? != 0 ] && VW_DECREMENT= - VW_LOWERLIMIT=`/usr/bin/svcprop -p config/lowerlimit $SMF_FMRI 2>/dev/null` - [ $? != 0 ] && VW_LOWERLIMIT= - 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= + 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 "$VW_USER" ] && VW_USER=root - [ -z "$VW_INTERVAL" ] && VW_INTERVAL=10000 - [ -z "$VW_INCREMENT" ] && VW_INCREMENT=256 - [ -z "$VW_DECREMENT" ] && VW_DECREMENT=128 - [ -z "$VW_LOWERLIMIT" ] && VW_LOWERLIMIT=64 - [ -z "$VW_ROTATE" ] && VW_ROTATE=10 - [ -z "$VW_LOGSIZE" ] && VW_LOGSIZE=104857600 - [ -z "$VW_LOGINTERVAL" ] && VW_LOGINTERVAL=86400 - exec su - "$VW_USER" -c "/opt/VirtualBox/VBoxBalloonCtrl --background --balloon-interval \"$VW_INTERVAL\" --balloon-inc \"$VW_INCREMENT\" --balloon-dec \"$VW_DECREMENT\" --balloon-lower-limit \"$VW_LOWERLIMIT\" --logrotate \"$VW_ROTATE\" --logsize \"$VW_LOGSIZE\" --loginterval \"$VW_LOGINTERVAL\"" + [ -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 diff --git a/src/VBox/Installer/solaris/vboxconfig.sh b/src/VBox/Installer/solaris/vboxconfig.sh index f06823ae..85448d80 100755 --- a/src/VBox/Installer/solaris/vboxconfig.sh +++ b/src/VBox/Installer/solaris/vboxconfig.sh @@ -1,10 +1,11 @@ #!/bin/sh # $Id: vboxconfig.sh $ - -# +## @file # VirtualBox Configuration Script, Solaris host. # -# Copyright (C) 2009-2010 Oracle Corporation + +# +# Copyright (C) 2009-2013 Oracle Corporation # # This file is part of VirtualBox Open Source Edition (OSE), as # available from http://www.virtualbox.org. This file is free software; @@ -40,7 +41,7 @@ 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_SVCS=/usr/bin/svcs BIN_IFCONFIG=/sbin/ifconfig BIN_SVCS=/usr/bin/svcs BIN_ID=/usr/bin/id @@ -256,9 +257,10 @@ get_sysinfo() # 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 + BRANCH_VERSION=$STR_KERN_MAJOR HOST_OS_MAJORVERSION=`echo "$BRANCH_VERSION" | cut -f2 -d'-' | cut -f1,2 -d'.'` - if test "HOST_OS_MAJORVERSION" = "5.12"; then + if test "$HOST_OS_MAJORVERSION" = "5.12"; then + HOST_OS_MAJORVERSION="12" HOST_OS_MINORVERSION=`echo "$BRANCH_VERSION" | cut -f2 -d'-' | cut -f6 -d'.'` return 0 else @@ -488,7 +490,7 @@ rem_driver() fi } -# unload_module(modname, moddesc, [fatal]) +# unload_module(modname, moddesc, retry, [fatal]) # failure: fatal unload_module() { @@ -504,16 +506,42 @@ unload_module() modname=$1 moddesc=$2 - fatal=$3 + 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 - subprint "Unloading: $moddesc module ...FAILED!" - if test "$fatal" = "$FATALOP"; then - exit 1 + # + # 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 "$fatal" = "$FATALOP"; then + exit 1 + fi + else + subprint "Unloaded: $moddesc module" fi return 1 fi @@ -580,9 +608,9 @@ 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'" + 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'" + 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 @@ -590,20 +618,21 @@ install_drivers() return 1 fi - # Add vboxdrv to devlink.tab + ## Add vboxdrv to devlink.tab (KEEP TABS!) if test -f "$PKG_INSTALL_ROOT/etc/devlink.tab"; then - sed -e '/name=vboxdrv/d' "$PKG_INSTALL_ROOT/etc/devlink.tab" > "$PKG_INSTALL_ROOT/etc/devlink.vbox" - echo "type=ddi_pseudo;name=vboxdrv \D" >> "$PKG_INSTALL_ROOT/etc/devlink.vbox" + 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" 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 + # 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"; then + 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 @@ -624,9 +653,10 @@ install_drivers() # 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 - infoprint "here" + 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 @@ -687,11 +717,11 @@ remove_drivers() { fatal=$1 - # Remove vboxdrv from devlink.tab + # 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' "$PKG_INSTALL_ROOT/etc/devlink.tab" > "$PKG_INSTALL_ROOT/etc/devlink.vbox" + sed -e '/name=vboxdrv/d' -e '/name=vboxdrvu/d' "$PKG_INSTALL_ROOT/etc/devlink.tab" > "$PKG_INSTALL_ROOT/etc/devlink.vbox" mv -f "$PKG_INSTALL_ROOT/etc/devlink.vbox" "$PKG_INSTALL_ROOT/etc/devlink.tab" fi @@ -703,28 +733,31 @@ remove_drivers() fi fi - unload_module "$MOD_VBOXUSB" "$DESC_VBOXUSB" "$fatal" + unload_module "$MOD_VBOXUSB" "$DESC_VBOXUSB" 0 "$fatal" rem_driver "$MOD_VBOXUSB" "$DESC_VBOXUSB" "$fatal" - unload_module "$MOD_VBOXUSBMON" "$DESC_VBOXUSBMON" "$fatal" + unload_module "$MOD_VBOXUSBMON" "$DESC_VBOXUSBMON" 0 "$fatal" rem_driver "$MOD_VBOXUSBMON" "$DESC_VBOXUSBMON" "$fatal" - unload_module "$MOD_VBOXFLT" "$DESC_VBOXFLT" "$fatal" + unload_module "$MOD_VBOXFLT" "$DESC_VBOXFLT" 0 "$fatal" rem_driver "$MOD_VBOXFLT" "$DESC_VBOXFLT" "$fatal" - unload_module "$MOD_VBOXBOW" "$DESC_VBOXBOW" "$fatal" + unload_module "$MOD_VBOXBOW" "$DESC_VBOXBOW" 0 "$fatal" rem_driver "$MOD_VBOXBOW" "$DESC_VBOXBOW" "$fatal" - unload_module "$MOD_VBOXNET" "$DESC_VBOXNET" "$fatal" + unload_module "$MOD_VBOXNET" "$DESC_VBOXNET" 0 "$fatal" rem_driver "$MOD_VBOXNET" "$DESC_VBOXNET" "$fatal" - unload_module "$MOD_VBOXDRV" "$DESC_VBOXDRV" "$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 @@ -774,6 +807,13 @@ install_python_bindings() pythonbin=$1 pythondesc=$2 if test -x "$pythonbin"; then + # 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" + return 0 + fi + VBOX_INSTALL_PATH="$DIR_VBOXBASE" export VBOX_INSTALL_PATH cd $DIR_VBOXBASE/sdk/installer @@ -786,6 +826,24 @@ install_python_bindings() return 1 } +# 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 + procpid=`ps -eo pid,fname | grep $procname | grep -v grep | awk '{ print $1 }'` + if test ! -z "$procpid" && test "$procpid" -ge 0; then + return 1 + fi + return 0 +} + + # stop_process(processname) # failure: depends on [fatal] stop_process() @@ -795,6 +853,7 @@ stop_process() exit 1 fi + # @todo use is_process_running() procname=$1 procpid=`ps -eo pid,fname | grep $procname | grep -v grep | awk '{ print $1 }'` if test ! -z "$procpid" && test "$procpid" -ge 0; then @@ -864,7 +923,7 @@ stop_service() errorprint "missing argument to stop_service()" exit 1 fi - servicefound=`$BIN_SVCS -a | grep "$2" 2>/dev/null` + 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 @@ -925,8 +984,40 @@ cleanup_install() done # Stop our other daemons, non-fatal - stop_process VBoxSVC - stop_process VBoxNetDHCP + 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 } @@ -991,13 +1082,13 @@ postinstall() 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 + # 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 + fi echo "#VirtualBox_SectionStart" >> $nmaskbackupfile inst=0 @@ -1039,10 +1130,14 @@ postinstall() if test "$REMOTEINST" -eq 1; then subprint "Skipped for targetted installs." else - # Start ZoneAccess service, other services are disabled by default. + # 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" + "/var/svc/log/application-virtualbox-zoneaccess:default.log" fi fi @@ -1073,7 +1168,7 @@ postinstall() INSTALLEDIT=0 fi PYTHONBIN=`which python2.5 2>/dev/null` - install_python_bindings "$PYTHONBIN" "Python 2.5" + install_python_bindings "$PYTHONBIN" "Python 2.5" if test "$?" -eq 0; then INSTALLEDIT=0 fi @@ -1099,7 +1194,7 @@ postinstall() fi update_boot_archive - + return 0 else errorprint "Failed to install drivers" @@ -1157,12 +1252,17 @@ do # Use alternate kernel driver config folder (dev only) DIR_CONF="/usr/kernel/drv" ;; + --sh-trace) # forwarded pkgadd -v + set -x + ;; --help) printusage exit 1 ;; *) - break + # Take a hard line on invalid options. + errorprint "Invalid command line option: \"$1\"" + exit 1; ;; esac shift diff --git a/src/VBox/Installer/solaris/virtualbox-autostart.xml b/src/VBox/Installer/solaris/virtualbox-autostart.xml index ed079394..e523b9f2 100644 --- a/src/VBox/Installer/solaris/virtualbox-autostart.xml +++ b/src/VBox/Installer/solaris/virtualbox-autostart.xml @@ -33,6 +33,14 @@ </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' @@ -70,8 +78,8 @@ <exec_method type='method' name='stop' - exec=':kill' - timeout_seconds='15'> + exec='/opt/VirtualBox/smf-vboxautostart.sh %m' + timeout_seconds='0'> <method_context> <method_credential user='root' group='root' /> </method_context> @@ -85,6 +93,7 @@ <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> diff --git a/src/VBox/Installer/solaris/virtualbox-balloonctrl.xml b/src/VBox/Installer/solaris/virtualbox-balloonctrl.xml index 44080c1b..5150f055 100644 --- a/src/VBox/Installer/solaris/virtualbox-balloonctrl.xml +++ b/src/VBox/Installer/solaris/virtualbox-balloonctrl.xml @@ -2,9 +2,9 @@ <!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1"> <!-- # Solaris SMF service manifest for VirtualBox balloon control service. -# $Id$ +# $Id: virtualbox-balloonctrl.xml $ - Copyright (C) 2008-2011 Oracle Corporation + Copyright (C) 2008-2013 Oracle Corporation This file is part of VirtualBox Open Source Edition (OSE), as available from http://www.virtualbox.org. This file is free software; @@ -33,6 +33,14 @@ </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' diff --git a/src/VBox/Installer/solaris/virtualbox-webservice.xml b/src/VBox/Installer/solaris/virtualbox-webservice.xml index 6f7ac8f0..50af4f9d 100644 --- a/src/VBox/Installer/solaris/virtualbox-webservice.xml +++ b/src/VBox/Installer/solaris/virtualbox-webservice.xml @@ -33,6 +33,14 @@ </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' diff --git a/src/VBox/Installer/solaris/virtualbox-zoneaccess.xml b/src/VBox/Installer/solaris/virtualbox-zoneaccess.xml index 3efc6a2b..9ca61223 100644 --- a/src/VBox/Installer/solaris/virtualbox-zoneaccess.xml +++ b/src/VBox/Installer/solaris/virtualbox-zoneaccess.xml @@ -3,7 +3,7 @@ # # Solaris SMF service manifest for Solaris Zone Access. # - Copyright (C) 2008-2010 Oracle Corporation + Copyright (C) 2008-2012 Oracle Corporation This file is part of VirtualBox Open Source Edition (OSE), as available from http://www.virtualbox.org. This file is free software; |