VirtualBox

Changeset 22368 in vbox for trunk


Ignore:
Timestamp:
Aug 20, 2009 12:45:58 PM (15 years ago)
Author:
vboxsync
Message:

Solaris/Installer: improved vboxconfig.sh, combine postinstall and ipsinstall, fixed error with missing python binary.

Location:
trunk/src/VBox/Installer/solaris
Files:
3 edited

Legend:

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

    r22003 r22368  
    11#!/bin/sh
    22## @file
    3 # Sun VirtualBox - Manual IPS/pkg(5) postinstall script for Solaris.
     3# Sun VirtualBox - VirtualBox postinstall script for Solaris.
    44#
    55# If you just installed VirtualBox using IPS/pkg(5), you should run this
     
    2323#
    2424
    25 check_root()
    26 {
    27     idbin=/usr/xpg4/bin/id
    28     if test ! -f "$idbin"; then
    29         found=`which id`
    30         if test ! -f "$found" || test ! -h "$found"; then
    31             echo "## Failed to find a suitable user id binary."
    32             exit 1
    33         else
    34             idbin=$found
     25if test "$1" != "--srv4"; then
     26    # IPS package
     27    echo "Checking for older & partially installed bits..."
     28    ISIPS="--ips"
     29else
     30    # SRv4 package
     31    echo "Checking for older bits..."
     32    ISIPS=""
     33fi
     34
     35/opt/VirtualBox/vboxconfig.sh --preremove --fatal "$ISIPS"
     36
     37if test "$?" -eq 0; then
     38    echo "Installing new ones..."
     39    /opt/VirtualBox/vboxconfig.sh --postinstall
     40    rc=$?
     41    if test "$rc" -ne 0; then
     42        echo "Completed but with errors."
     43        rc=20
     44    else
     45        if test "$1" != "--srv4"; then
     46            echo "Post installation completed successfully!"
    3547        fi
    3648    fi
    37 
    38     if test `$idbin -u` -ne 0; then
    39         echo "## This script must be run with administrator privileges."
    40         exit 2
    41     fi
    42 }
    43 
    44 check_zone()
    45 {
    46     currentzone=`zonename`
    47     if test "$currentzone" != "global"; then
    48         echo "## This script must be run from the global zone."
    49         exit 3
    50     fi
    51 }
    52 
    53 install_python_bindings()
    54 {
    55     PYTHONBIN=$1
    56     if test -x "$PYTHONBIN"; then
    57         VBOX_INSTALL_PATH=/opt/VirtualBox
    58         export VBOX_INSTALL_PATH
    59         cd /opt/VirtualBox/sdk/installer
    60         $PYTHONBIN ./vboxapisetup.py install > /dev/null
    61         return 0
    62     fi
    63     return 1
    64 }
    65 
    66 check_root
    67 check_zone
    68 
    69 osversion=`uname -r`
    70 
    71 BIN_REMDRV=/usr/sbin/rem_drv
    72 BIN_ADDDRV=/usr/sbin/add_drv
    73 BIN_MODLOAD=/usr/sbin/modload
    74 BIN_DEVFSADM=/usr/sbin/devfsadm
    75 
    76 # Halt services in case of installation update
    77 zoneaccessfound=`svcs -a | grep "virtualbox/zoneaccess"`
    78 if test ! -z "$zoneaccessfound"; then
    79     /usr/sbin/svcadm disable -s svc:/application/virtualbox/zoneaccess
     49else
     50    echo "## ERROR!! Failed to remove older/partially installed bits."
     51    rc=1
    8052fi
    8153
    82 # Remove drivers ignoring errors as they are not really loaded
    83 # just updated various boot archive files without really loading
    84 # them... But we _want_ them to be loaded.
    85 echo "Removing stale driver configurations..."
     54exit "$rc"
    8655
    87 $BIN_REMDRV vboxflt > /dev/null 2>&1
    88 /sbin/ifconfig vboxnet0 unplumb > /dev/null 2>&1
    89 $BIN_REMDRV vboxnet > /dev/null 2>&1
    90 $BIN_REMDRV vboxusbmon > /dev/null 2>&1
    91 $BIN_REMDRV vboxdrv > /dev/null 2>&1
    92 
    93 echo "Loading VirtualBox Drivers:"
    94 # Add drivers the proper way and load them immediately
    95 /opt/VirtualBox/vboxdrv.sh start
    96 rc=$?
    97 if test "$rc" -eq 0; then
    98     # Add vboxdrv to the devlink.tab
    99     sed -e '/name=vboxdrv/d' /etc/devlink.tab > /etc/devlink.vbox
    100     echo "type=ddi_pseudo;name=vboxdrv  \D" >> /etc/devlink.vbox
    101     mv -f /etc/devlink.vbox /etc/devlink.tab
    102 
    103     # Create the device link
    104     /usr/sbin/devfsadm -i vboxdrv
    105     rc=$?
    106 
    107     if test "$rc" -eq 0; then
    108         # Load VBoxNetAdapter vboxnet
    109         if test -f /platform/i86pc/kernel/drv/vboxnet.conf; then
    110             /opt/VirtualBox/vboxdrv.sh netstart
    111             rc=$?
    112 
    113             if test "$rc" -eq 0; then
    114                 # nwam/dhcpagent fix
    115                 nwamfile=/etc/nwam/llp
    116                 nwambackupfile=$nwamfile.vbox
    117                 if test -f "$nwamfile"; then
    118                     sed -e '/vboxnet/d' $nwamfile > $nwambackupfile
    119                     echo "vboxnet0      static 192.168.56.1" >> $nwambackupfile
    120                     mv -f $nwambackupfile $nwamfile
    121                     echo "   -> patched /etc/nwam/llp to use static IP for vboxnet0"
    122                 fi
    123             fi
    124         fi
    125     else
    126         echo "## Failed to create device link in /dev for vboxdrv"
    127     fi
    128 
    129     # Load VBoxNetFilter vboxflt
    130     if test "$rc" -eq 0 && test -f /platform/i86pc/kernel/drv/vboxflt.conf; then
    131         /opt/VirtualBox/vboxdrv.sh fltstart
    132         rc=$?
    133     fi
    134 
    135     # Load VBoxUSBMonitor vboxusbmon (do NOT load for Solaris 10)
    136     if test "$rc" -eq 0 && test -f /platform/i86pc/kernel/drv/vboxusbmon.conf && test "$osversion" != "5.10"; then
    137         /opt/VirtualBox/vboxdrv.sh usbstart
    138         rc=$?
    139         if test "$rc" -eq 0; then
    140 
    141             # Add vboxusbmon to the devlink.tab
    142             sed -e '/name=vboxusbmon/d' /etc/devlink.tab > /etc/devlink.vbox
    143             echo "type=ddi_pseudo;name=vboxusbmon       \D" >> /etc/devlink.vbox
    144             mv -f /etc/devlink.vbox /etc/devlink.tab
    145 
    146             /usr/sbin/devfsadm -i vboxusbmon
    147             rc=$?
    148             if test "$rc" -ne 0; then
    149                 echo "## Failed to create device link in /dev for vboxusbmon"
    150             fi
    151         fi
    152     fi
    153 fi
    154 
    155 rc2=0
    156 if test -f "/var/svc/manifest/application/virtualbox/virtualbox-zoneaccess.xml"; then
    157     /usr/sbin/svccfg import /var/svc/manifest/application/virtualbox/virtualbox-zoneaccess.xml
    158     rc2=$?
    159     if test "$rc2" -eq 0; then
    160         /usr/sbin/svcadm enable -s svc:/application/virtualbox/zoneaccess
    161         rc2=$?
    162         if test "$rc2" -eq 0; then
    163             echo "Enabled VirtualBox zone service."
    164         else
    165             echo "## Failed to enable VirtualBox zone service."
    166         fi
    167     else
    168         echo "## Failed to import VirtualBox zone service."
    169     fi
    170 fi
    171 
    172 # We need to touch the desktop link in order to add it to the menu right away
    173 if test -f "/usr/share/applications/virtualbox.desktop"; then
    174     touch /usr/share/applications/virtualbox.desktop
    175     echo "Added VirtualBox shortcut menu item."
    176 fi
    177 
    178 # Install python bindings
    179 rc3=0
    180 if test -f "/opt/VirtualBox/sdk/installer/vboxapisetup.py" || test -h "/opt/VirtualBox/sdk/installer/vboxapisetup.py"; then
    181     PYTHONBIN=`which python 2>/dev/null`
    182     if test -f "$PYTHONBIN" || test -h "$PYTHONBIN"; then
    183         echo "Installing Python bindings..."
    184 
    185         INSTALLEDIT=1
    186         PYTHONBIN=`which python2.4 2>/dev/null`
    187         install_python_bindings "$PYTHONBIN"
    188         if test "$?" -eq 0; then
    189             INSTALLEDIT=0
    190         fi
    191         PYTHONBIN=`which python2.5 2>/dev/null`
    192         install_python_bindings "$PYTHONBIN"
    193         if test "$?" -eq 0; then
    194             INSTALLEDIT=0
    195         fi
    196         PYTHONBIN=`which python2.6 2>/dev/null`
    197         install_python_bindings "$PYTHONBIN"
    198         if test "$?" -eq 0; then
    199             INSTALLEDIT=0
    200         fi
    201 
    202         # remove files installed by Python build
    203         rm -rf /opt/VirtualBox/sdk/installer/build
    204 
    205         if test "$INSTALLEDIT" -ne 0; then
    206             echo "** No suitable Python version found. Requires Python 2.4, 2.5 or 2.6."
    207         fi
    208         rc3=$INSTALLEDIT
    209     else
    210         echo "** WARNING! Python not found, skipped installed Python bindings."
    211         echo "   Manually run '/opt/VirtualBox/sdk/installer/vboxapisetup.py install'"
    212         echo "   to install the bindings when python is available."
    213         rc3=1
    214     fi
    215 fi
    216 
    217 # Update boot archive (only when driver's were all successfully loaded)
    218 rc4=0
    219 if test "$rc" -eq 0; then
    220     BOOTADMBIN=/sbin/bootadm
    221     if test -f "$BOOTADMBIN" || test -h "$BOOTADMBIN"; then
    222         echo "Updating boot archive..."
    223         $BOOTADMBIN update-archive > /dev/null
    224         rc4=$?
    225     fi
    226 fi
    227 
    228 echo "Done."
    229 if test "$rc" -eq 0 && test "$rc2" -eq 0 && test "$rc3" -eq 0 && test "$rc4" -eq 0; then
    230     echo "Post install successfully completed."
    231 else
    232     echo "Post install completed but with some errors."
    233     # 20 - partially failed installed
    234     $rc=20
    235 fi
    236 exit $rc
    237 
  • trunk/src/VBox/Installer/solaris/postinstall.sh

    r22123 r22368  
    2121#
    2222
    23 # Check for xVM/Xen
    24 currentisa=`uname -i`
    25 if test "$currentisa" = "i86xpv"; then
    26     echo "## VirtualBox cannot run under xVM Dom0! Fatal Error, Aborting installation!"
    27     exit 1
    28 fi
    29 
    3023currentzone=`zonename`
    3124if test "$currentzone" = "global"; then
    32     echo "Checking for older bits..."
    33     /opt/VirtualBox/vboxconfig.sh preremove fatal
     25    /opt/VirtualBox/ipsinstall.sh --srv4
    3426    rc=$?
    35     if test "$rc" -eq 0; then
    36         echo "Installing new ones..."
    37         /opt/VirtualBox/vboxconfig.sh postinstall
    38     fi
    39     rc=$?
    40     if test "$rc" -ne 0; then
    41         echo "Completed but with errors."
    42         rc=20
    43     fi
    4427fi
    4528
  • trunk/src/VBox/Installer/solaris/vboxconfig.sh

    r22350 r22368  
    5959FATALOP=fatal
    6060SILENTOP=silent
     61IPSOP=ips
    6162ISSILENT=
     63ISIPS=
    6264
    6365infoprint()
     
    263265    module_added $modname
    264266    if test "$?" -eq 0; then
    265         $BIN_REMDRV $modname
     267        if test "$ISIPS" != "$IPSOP"; then
     268            $BIN_REMDRV $modname
     269        else
     270            $BIN_REMDRV $modname >/dev/null 2>&1
     271        fi
    266272        if test $? -eq 0; then
    267273            subprint "Removed: $moddesc module"
     
    444450install_python_bindings()
    445451{
    446     if test -z "$1" || test -z "$2"; then
     452    # The python binary might not be there, so just exit silently
     453    if test -z "$1"; then
     454        return 0
     455    fi
     456
     457    if test -z "$2"; then
    447458        errorprint "missing argument to install_python_bindings"
    448459        exit 1
     
    645656find_bins
    646657
    647 drvop=$1
    648 if test "$2" = "$FATALOP" || test "$3" = "$FATALOP"; then
    649     fatal=$FATALOP
    650 fi
    651 if test "$2" = "$SILENTOP" || test "$3" = "$SILENTOP"; then
    652     ISSILENT=$SILENTOP
    653 fi
     658# Get command line options
     659while test $# -gt 0;
     660do
     661    case "$1" in
     662        --postinstall | --preremove | --installdrivers | --removedrivers)
     663            drvop="$1"
     664            ;;
     665        --fatal)
     666            fatal="$FATALOP"
     667            ;;
     668        --silent)
     669            ISSILENT="$SILENTOP"
     670            ;;
     671        --ips)
     672            ISIPS="$IPSOP"
     673            ;;
     674        *)
     675            errorprint "Invalid arguments"
     676            exit 1
     677            break
     678            ;;
     679    esac
     680    shift
     681done
    654682
    655683case "$drvop" in
    656 postinstall)
     684--postinstall)
    657685    check_module_arch
    658686    postinstall
    659687    ;;
    660 preremove)
     688--preremove)
    661689    preremove "$fatal"
    662690    ;;
    663 install_drivers)
     691--installdrivers)
    664692    check_module_arch
    665693    install_drivers
    666694    ;;
    667 remove_drivers)
     695--removedrivers)
    668696    remove_drivers "$fatal"
    669697    ;;
    670698*)
    671     echo "Usage: $0 postinstall|preremove|install_drivers|remove_drivers [fatal] [silent]"
     699    errorprint "Invalid operation $drvop"
    672700    exit 1
    673701esac
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