VirtualBox

忽略:
時間撮記:
2008-10-22 下午03:40:54 (16 年 以前)
作者:
vboxsync
訊息:

Solaris/installer: Always remove driver on uninstall even if modunload fails, cleaned up vboxdrv.sh a bit, and added some error handling to zoneaccess.sh.

位置:
trunk/src/VBox/Installer/solaris
檔案:
修改 4 筆資料

圖例:

未更動
新增
刪除
  • trunk/src/VBox/Installer/solaris/postinstall.sh

    r13484 r13499  
    3030currentzone=`zonename`
    3131if test "$currentzone" = "global"; then
    32     echo "Configuring VirtualBox kernel module(s)..."
    33     /opt/VirtualBox/vboxdrv.sh stopall silentunload
     32    echo "Configuring VirtualBox kernel modules..."
     33    /opt/VirtualBox/vboxdrv.sh stopall silentunload checkarch
    3434    rc=$?
    3535    if test "$rc" -eq 0; then
     
    8484    # create the device link
    8585    /usr/sbin/devfsadm -i vboxdrv
     86    sync
    8687
    8788    # We need to touch the desktop link in order to add it to the menu right away
  • trunk/src/VBox/Installer/solaris/preremove.sh

    r13485 r13499  
    3838
    3939    # vboxdrv.sh would've been installed, we just need to call it.
    40     /opt/VirtualBox/vboxdrv.sh stopall
     40    /opt/VirtualBox/vboxdrv.sh fltstop alwaysremdrv
     41    /opt/VirtualBox/vboxdrv.sh stop alwaysremdrv
    4142
    4243    # remove devlink.tab entry for vboxdrv
  • trunk/src/VBox/Installer/solaris/vboxdrv.sh

    r13484 r13499  
    1818#
    1919
    20 STOPPING=""
     20CHECKARCH=""
    2121SILENTUNLOAD=""
     22ALWAYSREMDRV=""
     23
     24
    2225MODNAME="vboxdrv"
    2326VBIMODNAME="vbi"
     
    3740}
    3841
     42warn()
     43{
     44    echo 1>&2 "WARNING!! $!"
     45}
     46
    3947check_if_installed()
    4048{
     
    4856    fi
    4957
    50     # Check arch only if we are not stopping things (because rem_drv works for both arch.)
    51     if test -z "$STOPPING"; then
     58    # Check arch only while installing (because rem_drv works for both arch.)
     59    if test -n "$CHECKARCH"; then
    5260        # Let us go a step further and check if user has mixed up x86/amd64
    5361        # amd64 ISA, x86 kernel module??
     
    7280}
    7381
    74 module_loaded()
    75 {
    76     # modinfo should now work properly since we prevent module autounloading
    77     loadentry=`/usr/sbin/modinfo | grep $MODNAME`
     82module_added()
     83{
     84    loadentry=`cat /etc/name_to_major | grep $1`
    7885    if test -z "$loadentry"; then
    7986        return 1
     
    8289}
    8390
    84 vboxflt_module_loaded()
     91module_loaded()
    8592{
    8693    # modinfo should now work properly since we prevent module autounloading
    87     loadentry=`/usr/sbin/modinfo | grep $FLTMODNAME`
     94    loadentry=`/usr/sbin/modinfo | grep $1`
    8895    if test -z "$loadentry"; then
    8996        return 1
    9097    fi
    91     return 0
     98    return 0   
     99}
     100
     101vboxdrv_loaded()
     102{
     103    module_loaded $MODNAME
     104    return $?
     105}
     106
     107vboxdrv_added()
     108{
     109    module_added $MODNAME
     110    return $?
     111}
     112
     113vboxflt_loaded()
     114{
     115    module_loaded $FLTMODNAME
     116    return $?
     117}
     118
     119vboxflt_added()
     120{
     121    module_added $FLTMODNAME
     122    return $?
    92123}
    93124
     
    111142start_module()
    112143{
    113     if module_loaded; then
     144    if vboxdrv_loaded; then
    114145        info "VirtualBox Host kernel module already loaded."
    115146    else
     
    120151        fi
    121152        /usr/sbin/modload -p drv/$MODNAME
    122         if test ! module_loaded; then
     153        if test ! vboxdrv_loaded; then
    123154            abort "Failed to load VirtualBox Host kernel module."
    124155        elif test -c "/devices/pseudo/$MODNAME@0:$MODNAME"; then
     
    132163stop_module()
    133164{
    134     if module_loaded; then
     165    if vboxdrv_loaded; then
    135166        vboxdrv_mod_id=`/usr/sbin/modinfo | grep $MODNAME | cut -f 1 -d ' ' `
    136167        if test -n "$vboxdrv_mod_id"; then
    137168            /usr/sbin/modunload -i $vboxdrv_mod_id
    138             if test "$?" -eq 0; then
    139                 /usr/sbin/rem_drv $MODNAME || abort "Unloaded VirtualBox Host kernel module, but failed to remove it!"
    140                 info "VirtualBox Host kernel module unloaded."
     169
     170            # While uninstalling we always remove the driver whether we unloaded successfully or not,
     171            # while installing we make SURE if there is an existing driver about, it is cleanly unloaded
     172            # and the new one is added hence the "alwaysremdrv" option.
     173            if test -n "$ALWAYSREMDRV"; then
     174                /usr/sbin/rem_drv $MODNAME
    141175            else
    142                 abort "Failed to unload VirtualBox Host kernel module. Old one still active!!"
     176                if test "$?" -eq 0; then
     177                    /usr/sbin/rem_drv $MODNAME || abort "Unloaded VirtualBox Host kernel module, but failed to remove it!"
     178                else
     179                    abort "Failed to unload VirtualBox Host kernel module. Old one still active!!"
     180                fi
    143181            fi
    144         fi
     182
     183            info "VirtualBox Host kernel module unloaded."
     184        fi
     185    elif vboxdrv_added; then
     186        /usr/sbin/rem_drv $MODNAME || abort "Unloaded VirtualBox Host kernel module, but failed to remove it!"
     187        info "VirtualBox Host kernel module unloaded."
    145188    elif test -z "$SILENTUNLOAD"; then
    146189        info "VirtualBox Host kernel module not loaded."
     
    156199start_vboxflt()
    157200{
    158     if vboxflt_module_loaded; then
     201    if vboxflt_loaded; then
    159202        info "VirtualBox NetFilter kernel module already loaded."
    160203    else
    161204        /usr/sbin/add_drv -m'* 0600 root sys' $FLTMODNAME || abort "Failed to add VirtualBox NetFilter Kernel module."
    162205        /usr/sbin/modload -p drv/$FLTMODNAME
    163         if test ! vboxflt_module_loaded; then
     206        if test ! vboxflt_loaded; then
    164207            abort "Failed to load VirtualBox NetFilter kernel module."
    165208        else
     
    171214stop_vboxflt()
    172215{
    173     if vboxflt_module_loaded; then
     216    if vboxflt_loaded; then
    174217        vboxflt_mod_id=`/usr/sbin/modinfo | grep $FLTMODNAME | cut -f 1 -d ' '`
    175218        if test -n "$vboxflt_mod_id"; then
    176219            /usr/sbin/modunload -i $vboxflt_mod_id
    177             if test "$?" -eq 0; then
    178                 /usr/sbin/rem_drv $FLTMODNAME || abort "Unloaded VirtualBox NetFilter kernel module, but failed to remove it!"
    179                 info "VirtualBox NetFilter kernel module unloaded."
     220
     221            # see stop_vboxdrv() for why we have "alwaysremdrv".
     222            if test -n "$ALWAYSREMDRV"; then
     223                /usr/sbin/rem_drv $FLTMODNAME
    180224            else
    181                 abort "Failed to unload VirtualBox NetFilter kernel module. Old one still active!!"
     225                if test "$?" -eq 0; then
     226                    /usr/sbin/rem_drv $FLTMODNAME || abort "Unloaded VirtualBox NetFilter kernel module, but failed to remove it!"
     227                else
     228                    abort "Failed to unload VirtualBox NetFilter kernel module. Old one still active!!"
     229                fi
    182230            fi
    183         fi
     231
     232            info "VirtualBox NetFilter kernel module unloaded."
     233        fi
     234    elif vboxflt_added; then
     235        /usr/sbin/rem_drv $FLTMODNAME || abort "Unloaded VirtualBox NetFilter kernel module, but failed to remove it!"
     236        info "VirtualBox NetFilter kernel module unloaded."
    184237    elif test -z "$SILENTUNLOAD"; then
    185238        info "VirtualBox NetFilter kernel module not loaded."
     
    187240}
    188241
    189 status_module()
    190 {
    191     if module_loaded; then
     242status_vboxdrv()
     243{
     244    if vboxdrv_loaded; then
    192245        info "Running."
     246    elif vboxdrv_added; then
     247        info "Inactive."
    193248    else
    194         info "Stopped."
     249        info "Not installed."
    195250    fi
    196251}
     
    211266check_if_installed
    212267
    213 if test "$2" = "silentunload"; then
     268if test "$2" = "silentunload" || test "$3" = "silentunload"; then
    214269    SILENTUNLOAD="$2"
    215270fi
    216271
     272if test "$2" = "alwaysremdrv" || test "$3" = "alwaysremdrv"; then
     273    ALWAYSREMDRV="alwaysremdrv"
     274fi
     275
     276if test "$2" = "checkarch" || test "$3" = "checkarch"; then
     277    CHECKARCH="checkarch"
     278fi
     279
    217280case "$1" in
    218281stopall)
    219     STOPPING="stopping"
    220282    stop_all_modules
    221283    ;;
     
    230292    ;;
    231293status)
    232     status_module
     294    status_vboxdrv
    233295    ;;
    234296fltstart)
  • trunk/src/VBox/Installer/solaris/zoneaccess.sh

    r13484 r13499  
    1818#
    1919
    20 sleep 1000000000 < /dev/vboxdrv
     20if test -c "/devices/pseudo/vboxdrv@0:vboxdrv"; then
     21    if test -h "/dev/vboxdrv" || test -f "/dev/vboxdrv"; then
     22        sleep 1000000000 < /dev/vboxdrv &
     23    else
     24        echo "VirtualBox Host kernel module device link missing..."
     25        exit 2
     26    fi
     27else
     28    echo "VirtualBox Host kernel module not loaded!! Zone access hack failed."
     29    exit 1
     30fi
    2131
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

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