VirtualBox

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


Ignore:
Timestamp:
Aug 7, 2009 12:48:22 PM (15 years ago)
Author:
vboxsync
Message:

Solaris/Installer: vboxconfig.sh bits.

File:
1 edited

Legend:

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

    r22033 r22067  
    2222
    2323HOST_OS_VERSION=`uname -r`
     24
     25DIR_VBOXBASE=/opt/VirtualBox
     26DIR_MOD_32="/platform/i86pc/kernel/drv"
     27DIR_MOD_64=$DIR_MOD_32/amd64
     28
    2429BIN_ADDDRV=/usr/sbin/add_drv
    2530BIN_REMDRV=/usr/sbin/rem_drv
     
    3338BIN_IFCONFIG=/sbin/ifconfig
    3439
    35 DIR_VBOXBASE=/opt/VirtualBox
    36 
    3740# "vboxdrv" is also used in sed lines here (change those as well if it ever changes)
    3841MOD_VBOXDRV=vboxdrv
     
    4346FATALOP=fatal
    4447
    45 MODDIR32="/platform/i86pc/kernel/drv"
    46 MODDIR64=$MODDIR32/amd64
    47 
    4848
    4949infoprint()
     
    6262}
    6363
    64 error()
     64errorprint()
    6565{
    6666    echo 1>&2 "## $1"
    6767}
    6868
     69
    6970# check_bin_path()
    7071# !! failure is always fatal
    71 check_bin_paths()
    72 {
    73     if test -z "$1"; then
    74         error "missing argument to check_bin_path()"
     72check_bin_path()
     73{
     74    if test -z "$1"; then
     75        errorprint "missing argument to check_bin_path()"
    7576        exit 50
    7677    fi
    7778
    7879    if test !  -x "$1"; then
    79         error "$1 missing or is not an executable"
     80        errorprint "$1 missing or is not an executable"
    8081        exit 51
    8182    fi
     
    8384}
    8485
     86# find_bins()
     87# !! failure is always fatal
     88find_bins()
     89{
     90    # Search only for binaries that might be in different locations
     91    BIN_IFCONFIG=`which ifconfig 2> /dev/null`
     92    BIN_SVCS=`which svcs 2> /dev/null`
     93
     94    check_bin_path "$BIN_ADDDRV"
     95    check_bin_path "$BIN_REMDRV"
     96    check_bin_path "$BIN_MODLOAD"
     97    check_bin_path "$BIN_MODUNLOAD"
     98    check_bin_path "$BIN_MODINFO"
     99    check_bin_path "$BIN_DEVFSADM"
     100    check_bin_path "$BIN_BOOTADM"
     101    check_bin_path "$BIN_SVCADM"
     102    check_bin_path "$BIN_SVCCFG"
     103    check_bin_path "$BIN_SVCS"
     104    check_bin_path "$BIN_IFCONFIG"
     105}
     106
    85107# check_root()
    86108# !! failure is always fatal
     
    88110{
    89111    idbin=/usr/xpg4/bin/id
    90     if test ! -f "$idbin"; then
     112    if test ! -x "$idbin"; then
    91113        found=`which id`
    92         if test ! -f "$found" || test ! -h "$found"; then
    93             error "Failed to find a suitable user id binary."
     114        if test ! -x "$found"; then
     115            errorprint "Failed to find a suitable user id executable."
    94116            exit 1
    95117        else
     
    99121
    100122    if test `$idbin -u` -ne 0; then
    101         error "This script must be run with administrator privileges."
     123        errorprint "This script must be run with administrator privileges."
    102124        exit 2
    103125    fi
     
    110132    currentzone=`zonename`
    111133    if test "$currentzone" != "global"; then
    112         error "This script must be run from the global zone."
     134        errorprint "This script must be run from the global zone."
    113135        exit 3
    114136    fi
     
    121143    currentisa=`uname -i`
    122144    if test "$currentisa" = "i86xpv"; then
    123         error "VirtualBox cannot run under xVM Dom0! Fatal Error, Aborting installation!"
     145        errorprint "VirtualBox cannot run under xVM Dom0! Fatal Error, Aborting installation!"
    124146        exit 4
    125147    fi
     
    131153{
    132154    cputype=`isainfo -k`
    133     modulepath="$MODDIR32/$MOD_VBOXDRV"
     155    modulepath="$DIR_MOD_32/$MOD_VBOXDRV"
    134156    if test "$cputype" = "amd64"; then
    135         modulepath="$MODDIR64/$MOD_VBOXDRV"
     157        modulepath="$DIR_MOD_64/$MOD_VBOXDRV"
    136158    elif test "$cputype" != "i386"; then
    137         error "VirtualBox works only on i386/amd64 architectures, not $cputype"
     159        errorprint "VirtualBox works only on i386/amd64 architectures, not $cputype"
    138160        exit 98
    139161    fi
     
    147169    # amd64 ISA, x86 kernel module??
    148170    if test "$cputype" = "amd64"; then
    149         modulepath="$MODDIR32/$MOD_VBOXDRV"
     171        modulepath="$DIR_MOD_32/$MOD_VBOXDRV"
    150172        if test -f "$modulepath"; then
    151             error "Found 32-bit module instead of 64-bit. Please install the amd64 package!"
     173            errorprint "Found 32-bit module instead of 64-bit. Please install the amd64 package!"
    152174            exit 97
    153175        fi
    154176    else
    155177        # x86 ISA, amd64 kernel module??
    156         modulepath="$MODDIR64/$MOD_VBOXDRV"
     178        modulepath="$DIR_MOD_64/$MOD_VBOXDRV"
    157179        if test -f "$modulepath"; then
    158             error "Found 64-bit module instead of 32-bit. Please install the x86 package!"
     180            errorprint "Found 64-bit module instead of 32-bit. Please install the x86 package!"
    159181            exit 96
    160182        fi
     
    162184
    163185    # Shouldn't really happen...
    164     error "VirtualBox Host kernel module NOT installed."
     186    errorprint "VirtualBox Host kernel module NOT installed."
    165187    exit 99
    166188}
     
    171193{
    172194    if test -z "$1"; then
    173         error "missing argument to module_added()"
     195        errorprint "missing argument to module_added()"
    174196        exit 5
    175197    fi
     
    187209{
    188210    if test -z "$1"; then
    189         error "missing argument to module_loaded()"
     211        errorprint "missing argument to module_loaded()"
    190212        exit 6
    191213    fi
     
    205227{
    206228    if test -z "$1"; then
    207         error "missing argument to add_driver()"
     229        errorprint "missing argument to add_driver()"
    208230        exit 7
    209231    fi
     
    219241
    220242    if test $? -ne 0; then
    221         error "Failed to load: $modname"
     243        errorprint "Failed to load: $modname"
    222244        if test "$fatal" = "$FATALOP"; then
    223245            exit 8
     
    233255{
    234256    if test -z "$1"; then
    235         error "missing argument to rem_driver()"
     257        errorprint "missing argument to rem_driver()"
    236258        exit 9
    237259    fi
     
    246268            return 0
    247269        else
    248             error "Failed to remove: $modname"
     270            errorprint "Failed to remove: $modname"
    249271            if test "$fatal" = "$FATALOP"; then
    250272                exit 10
     
    260282{
    261283    if test -z "$1"; then
    262         error "missing argument to unload_module()"
     284        errorprint "missing argument to unload_module()"
    263285        exit 11
    264286    fi
     
    272294            success "Unloaded: $modname successfully"
    273295        else
    274             error "Failed to unload: $modname"
     296            errorprint "Failed to unload: $modname"
    275297            if test "$fatal" = "$FATALOP"; then
    276298                exit 12
     
    288310{
    289311    if test -z "$1"; then
    290         error "missing argument to load_module()"
     312        errorprint "missing argument to load_module()"
    291313        exit 14
    292314    fi
     
    299321        return 0
    300322    else
    301         error "Failed to load: $modname"
     323        errorprint "Failed to load: $modname"
    302324        if test "$fatal" = "$FATALOP"; then
    303325            exit 15
     
    349371            /usr/sbin/devfsadm -i  $MOD_VBOXUSBMON
    350372            if test $? -ne 0; then
    351                 error "Failed to create device link for $MOD_VBOXUSBMON."
     373                errorprint "Failed to create device link for $MOD_VBOXUSBMON."
    352374                exit 16
    353375            fi
    354376        fi
    355377    else
    356         error "Failed to create device link for $MOD_VBOXDRV."
     378        errorprint "Failed to create device link for $MOD_VBOXDRV."
    357379        exit 17
    358380    fi
     
    413435    fi
    414436    return 1
     437}
     438
     439
     440# cleanup_install([fatal])
     441# failure: depends on [fatal]
     442cleanup_install()
     443{
     444    fatal=$1
     445
     446    # stop and unregister webservice SMF
     447    servicefound=`$BIN_SVCS -a | grep "virtualbox/webservice"`
     448    if test ! -z "$servicefound"; then
     449        $BIN_SVCADM disable -s svc:/application/virtualbox/webservice:default
     450        $BIN_SVCCFG delete svc:/application/virtualbox/webservice:default
     451    fi
     452
     453    # stop and unregister zoneaccess SMF
     454    servicefound=`$BIN_SVCS -a | grep "virtualbox/zoneaccess"`
     455    if test ! -z "$servicefound"; then
     456        $BIN_SVCADM disable -s svc:/application/virtualbox/zoneaccess
     457        $BIN_SVCCFG delete svc:/application/virtualbox/zoneaccess
     458    fi
     459   
     460    # unplumb vboxnet0
     461    vboxnetup=`$BIN_IFCONFIG vboxnet0 >/dev/null 2>&1`
     462    if test "$?" -eq 0; then
     463        $BIN_IFCONFIG vboxnet0 unplumb
     464        if test "$?" -ne 0; then
     465            errorprint "VirtualBox NetAdapter 'vboxnet0' couldn't be unplumbed (probably in use)."
     466            if test "$fatal" = "$FATALOP"; then
     467                exit 33
     468            fi
     469        fi
     470    fi
    415471}
    416472
     
    483539        return 0
    484540    else
    485         error "Failed to update boot-archive"
     541        errorprint "Failed to update boot-archive"
    486542        exit 666
    487543    fi
    488544    return 1
    489545}
     546
    490547
    491548# pre_remove([fatal])
     
    495552    fatal=$1
    496553
    497     # stop and unregister webservice SMF (if present)
    498     servicefound=`svcs -a | grep "virtualbox/webservice"`
    499     if test ! -z "$servicefound"; then
    500         $BIN_SVCADM disable -s svc:/application/virtualbox/webservice:default
    501         $BIN_SVCCFG delete svc:/application/virtualbox/webservice:default
    502     fi
    503 
    504     # stop and unregister zoneaccess SMF (if present)
    505     servicefound=`svcs -a | grep "virtualbox/zoneaccess"`
    506     if test ! -z "$servicefound"; then
    507         $BIN_SVCADM disable -s svc:/application/virtualbox/zoneaccess
    508         $BIN_SVCCFG delete svc:/application/virtualbox/zoneaccess
    509     fi
     554    cleanup_install
    510555
    511556    remove_drivers "$fatal"
     
    515560    return 1
    516561}
     562
    517563
    518564
     
    521567check_isa
    522568check_zone
    523 
    524 check_bin_path $BIN_ADDDRV
    525 check_bin_path $BIN_REMDRV
    526 check_bin_path $BIN_MODLOAD
    527 check_bin_path $BIN_MODUNLOAD
    528 check_bin_path $BIN_MODINFO
    529 check_bin_path $BIN_DEVFSADM
    530 check_bin_path $BIN_BOOTADM
    531 check_bin_path $BIN_SVCADM
    532 check_bin_path $BIN_SVCCFG
    533 check_bin_path $BIN_IFCONFIG
     569find_bins
    534570
    535571drvop=$1
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