VirtualBox

Changeset 41620 in vbox for trunk/src/VBox/Installer


Ignore:
Timestamp:
Jun 8, 2012 11:53:04 AM (13 years ago)
Author:
vboxsync
Message:

Solaris/Installer: Fix ZoneAccess service autostart.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Installer/solaris/vboxconfig.sh

    r41101 r41620  
    4141BIN_SVCADM=/usr/sbin/svcadm
    4242BIN_SVCCFG=/usr/sbin/svccfg
     43BIN_SVCS=/usr/bin/svcs
    4344BIN_IFCONFIG=/sbin/ifconfig
    4445BIN_SVCS=/usr/bin/svcs
     
    769770        fi
    770771    fi
     772}
     773
     774# start_service(servicename, shortFMRI pretty printing, full FMRI)
     775# failure: non-fatal
     776start_service()
     777{
     778    if test -z "$1" || test -z "$2" || test -z "$3"; then
     779        errorprint "missing argument to enable_service()"
     780        exit 1
     781    fi
     782
     783    # Since S11 the way to import a manifest is via restarting manifest-import which is asynchronous and can
     784    # take a while to complete, using disable/enable -s doesn't work either. So we restart it, and poll in
     785    # 1 second intervals to see if our service has been successfully imported and timeout after 'cmax' seconds.
     786    cmax=32
     787    cslept=0
     788    success=0
     789
     790    $BIN_SVCS "$3" >/dev/null 2>&1
     791    while test $? -ne 0;
     792    do
     793        sleep 1
     794        cslept=`expr $cslept + 1`
     795        if test "$cslept" -eq "$cmax"; then
     796            success=1
     797            break
     798        fi
     799        $BIN_SVCS "$3" >/dev/null 2>&1
     800    done
     801    if test "$success" -eq 0; then
     802        $BIN_SVCADM enable -s "$3"
     803        if test "$?" -eq 0; then
     804            subprint "Loaded: $1"
     805            return 0
     806        else
     807            warnprint "Loading $1  ...FAILED."
     808            warnprint "Refer /var/svc/log/application-virtualbox-zoneaccess:default.log for details."
     809        fi
     810    else
     811        warnprint "Importing $1  ...FAILED."
     812        warnprint "Refer /var/svc/log/system-manifest-import:default.log for details."
     813    fi
     814    return 1
    771815}
    772816
     
    946990        fi
    947991
    948         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"; then
     992        if     test -f "$PKG_INSTALL_ROOT/var/svc/manifest/application/virtualbox/virtualbox-webservice.xml" \
     993            || test -f "$PKG_INSTALL_ROOT/var/svc/manifest/application/virtualbox/virtualbox-zoneaccess.xml" \
     994            || test -f "$PKG_INSTALL_ROOT/var/svc/manifest/application/virtualbox/virtualbox-balloonctrl.xml"; then
    949995            infoprint "Configuring services..."
    950996            if test "$REMOTEINST" -eq 1; then
    951997                subprint "Skipped for targetted installs."
    952998            else
    953                 # Enable Zone access service for non-remote installs, other services (Webservice) are delivered disabled by the manifest class action
    954                 servicefound=`$BIN_SVCS -a | grep "virtualbox/zoneaccess" | grep "disabled" 2>/dev/null`
    955                 if test ! -z "$servicefound"; then
    956                     $BIN_SVCADM enable -s svc:/application/virtualbox/zoneaccess
    957                     if test "$?" -eq 0; then
    958                         subprint "Loaded: Zone access service"
    959                     else
    960                         subprint "Loading Zone access service  ...FAILED."
    961                     fi
    962                 fi
     999                # Start ZoneAccess service, other services are disabled by default.
     1000                $BIN_SVCADM restart svc:system/manifest-import:default
     1001                start_service "Zone access service" "virtualbox/zoneaccess" "svc:/application/virtualbox/zoneaccess:default"
    9631002            fi
    9641003        fi
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette