Changeset 22067 in vbox for trunk/src/VBox/Installer
- Timestamp:
- Aug 7, 2009 12:48:22 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Installer/solaris/vboxconfig.sh
r22033 r22067 22 22 23 23 HOST_OS_VERSION=`uname -r` 24 25 DIR_VBOXBASE=/opt/VirtualBox 26 DIR_MOD_32="/platform/i86pc/kernel/drv" 27 DIR_MOD_64=$DIR_MOD_32/amd64 28 24 29 BIN_ADDDRV=/usr/sbin/add_drv 25 30 BIN_REMDRV=/usr/sbin/rem_drv … … 33 38 BIN_IFCONFIG=/sbin/ifconfig 34 39 35 DIR_VBOXBASE=/opt/VirtualBox36 37 40 # "vboxdrv" is also used in sed lines here (change those as well if it ever changes) 38 41 MOD_VBOXDRV=vboxdrv … … 43 46 FATALOP=fatal 44 47 45 MODDIR32="/platform/i86pc/kernel/drv"46 MODDIR64=$MODDIR32/amd6447 48 48 49 49 infoprint() … … 62 62 } 63 63 64 error ()64 errorprint() 65 65 { 66 66 echo 1>&2 "## $1" 67 67 } 68 68 69 69 70 # check_bin_path() 70 71 # !! failure is always fatal 71 check_bin_path s()72 { 73 if test -z "$1"; then 74 error "missing argument to check_bin_path()"72 check_bin_path() 73 { 74 if test -z "$1"; then 75 errorprint "missing argument to check_bin_path()" 75 76 exit 50 76 77 fi 77 78 78 79 if test ! -x "$1"; then 79 error "$1 missing or is not an executable"80 errorprint "$1 missing or is not an executable" 80 81 exit 51 81 82 fi … … 83 84 } 84 85 86 # find_bins() 87 # !! failure is always fatal 88 find_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 85 107 # check_root() 86 108 # !! failure is always fatal … … 88 110 { 89 111 idbin=/usr/xpg4/bin/id 90 if test ! - f"$idbin"; then112 if test ! -x "$idbin"; then 91 113 found=`which id` 92 if test ! - f "$found" || test ! -h"$found"; then93 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." 94 116 exit 1 95 117 else … … 99 121 100 122 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." 102 124 exit 2 103 125 fi … … 110 132 currentzone=`zonename` 111 133 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." 113 135 exit 3 114 136 fi … … 121 143 currentisa=`uname -i` 122 144 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!" 124 146 exit 4 125 147 fi … … 131 153 { 132 154 cputype=`isainfo -k` 133 modulepath="$ MODDIR32/$MOD_VBOXDRV"155 modulepath="$DIR_MOD_32/$MOD_VBOXDRV" 134 156 if test "$cputype" = "amd64"; then 135 modulepath="$ MODDIR64/$MOD_VBOXDRV"157 modulepath="$DIR_MOD_64/$MOD_VBOXDRV" 136 158 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" 138 160 exit 98 139 161 fi … … 147 169 # amd64 ISA, x86 kernel module?? 148 170 if test "$cputype" = "amd64"; then 149 modulepath="$ MODDIR32/$MOD_VBOXDRV"171 modulepath="$DIR_MOD_32/$MOD_VBOXDRV" 150 172 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!" 152 174 exit 97 153 175 fi 154 176 else 155 177 # x86 ISA, amd64 kernel module?? 156 modulepath="$ MODDIR64/$MOD_VBOXDRV"178 modulepath="$DIR_MOD_64/$MOD_VBOXDRV" 157 179 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!" 159 181 exit 96 160 182 fi … … 162 184 163 185 # Shouldn't really happen... 164 error "VirtualBox Host kernel module NOT installed."186 errorprint "VirtualBox Host kernel module NOT installed." 165 187 exit 99 166 188 } … … 171 193 { 172 194 if test -z "$1"; then 173 error "missing argument to module_added()"195 errorprint "missing argument to module_added()" 174 196 exit 5 175 197 fi … … 187 209 { 188 210 if test -z "$1"; then 189 error "missing argument to module_loaded()"211 errorprint "missing argument to module_loaded()" 190 212 exit 6 191 213 fi … … 205 227 { 206 228 if test -z "$1"; then 207 error "missing argument to add_driver()"229 errorprint "missing argument to add_driver()" 208 230 exit 7 209 231 fi … … 219 241 220 242 if test $? -ne 0; then 221 error "Failed to load: $modname"243 errorprint "Failed to load: $modname" 222 244 if test "$fatal" = "$FATALOP"; then 223 245 exit 8 … … 233 255 { 234 256 if test -z "$1"; then 235 error "missing argument to rem_driver()"257 errorprint "missing argument to rem_driver()" 236 258 exit 9 237 259 fi … … 246 268 return 0 247 269 else 248 error "Failed to remove: $modname"270 errorprint "Failed to remove: $modname" 249 271 if test "$fatal" = "$FATALOP"; then 250 272 exit 10 … … 260 282 { 261 283 if test -z "$1"; then 262 error "missing argument to unload_module()"284 errorprint "missing argument to unload_module()" 263 285 exit 11 264 286 fi … … 272 294 success "Unloaded: $modname successfully" 273 295 else 274 error "Failed to unload: $modname"296 errorprint "Failed to unload: $modname" 275 297 if test "$fatal" = "$FATALOP"; then 276 298 exit 12 … … 288 310 { 289 311 if test -z "$1"; then 290 error "missing argument to load_module()"312 errorprint "missing argument to load_module()" 291 313 exit 14 292 314 fi … … 299 321 return 0 300 322 else 301 error "Failed to load: $modname"323 errorprint "Failed to load: $modname" 302 324 if test "$fatal" = "$FATALOP"; then 303 325 exit 15 … … 349 371 /usr/sbin/devfsadm -i $MOD_VBOXUSBMON 350 372 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." 352 374 exit 16 353 375 fi 354 376 fi 355 377 else 356 error "Failed to create device link for $MOD_VBOXDRV."378 errorprint "Failed to create device link for $MOD_VBOXDRV." 357 379 exit 17 358 380 fi … … 413 435 fi 414 436 return 1 437 } 438 439 440 # cleanup_install([fatal]) 441 # failure: depends on [fatal] 442 cleanup_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 415 471 } 416 472 … … 483 539 return 0 484 540 else 485 error "Failed to update boot-archive"541 errorprint "Failed to update boot-archive" 486 542 exit 666 487 543 fi 488 544 return 1 489 545 } 546 490 547 491 548 # pre_remove([fatal]) … … 495 552 fatal=$1 496 553 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 510 555 511 556 remove_drivers "$fatal" … … 515 560 return 1 516 561 } 562 517 563 518 564 … … 521 567 check_isa 522 568 check_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 569 find_bins 534 570 535 571 drvop=$1
Note:
See TracChangeset
for help on using the changeset viewer.