VirtualBox

source: vbox/trunk/src/VBox/Installer/solaris/vboxconfig.sh@ 27404

Last change on this file since 27404 was 27356, checked in by vboxsync, 15 years ago

Solaris/Installer: extraneous info.

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
File size: 21.7 KB
Line 
1#!/bin/sh
2# $Id: vboxconfig.sh 27356 2010-03-15 12:42:03Z vboxsync $
3
4# Sun VirtualBox
5# VirtualBox Configuration Script, Solaris host.
6#
7# Copyright (C) 2009 Sun Microsystems, Inc.
8#
9# This file is part of VirtualBox Open Source Edition (OSE), as
10# available from http://www.virtualbox.org. This file is free software;
11# you can redistribute it and/or modify it under the terms of the GNU
12# General Public License (GPL) as published by the Free Software
13# Foundation, in version 2 as it comes in the "COPYING" file of the
14# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16#
17# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
18# Clara, CA 95054 USA or visit http://www.sun.com if you need
19# additional information or have any questions.
20#
21
22
23# Never use exit 2 or exit 20 etc., the return codes are used in
24# SRv4 postinstall procedures which carry special meaning. Just use exit 1 for failure.
25
26# S10 or OpenSoalris
27HOST_OS_MAJORVERSION=`uname -r`
28# Which OpenSolaris version (snv_xxx)?
29HOST_OS_MINORVERSION=`uname -v | sed -e "s/snv_//" -e "s/[^0-9]//"`
30
31DIR_VBOXBASE=/opt/VirtualBox
32DIR_CONF="/platform/i86pc/kernel/drv"
33DIR_MOD_32="/platform/i86pc/kernel/drv"
34DIR_MOD_64=$DIR_MOD_32/amd64
35
36BIN_ADDDRV=/usr/sbin/add_drv
37BIN_REMDRV=/usr/sbin/rem_drv
38BIN_MODLOAD=/usr/sbin/modload
39BIN_MODUNLOAD=/usr/sbin/modunload
40BIN_MODINFO=/usr/sbin/modinfo
41BIN_DEVFSADM=/usr/sbin/devfsadm
42BIN_BOOTADM=/sbin/bootadm
43BIN_SVCADM=/usr/sbin/svcadm
44BIN_SVCCFG=/usr/sbin/svccfg
45BIN_IFCONFIG=/sbin/ifconfig
46BIN_ID=/usr/bin/id
47
48# "vboxdrv" is also used in sed lines here (change those as well if it ever changes)
49MOD_VBOXDRV=vboxdrv
50DESC_VBOXDRV="Host"
51
52MOD_VBOXNET=vboxnet
53DESC_VBOXNET="NetAdapter"
54MOD_VBOXNET_INST=32
55
56MOD_VBOXFLT=vboxflt
57DESC_VBOXFLT="NetFilter"
58
59# No Separate VBI since (3.1)
60#MOD_VBI=vbi
61#DESC_VBI="Kernel Interface"
62
63MOD_VBOXUSBMON=vboxusbmon
64DESC_VBOXUSBMON="USBMonitor"
65
66MOD_VBOXUSB=vboxusb
67DESC_VBOXUSB="USB"
68
69FATALOP=fatal
70NULLOP=nulloutput
71SILENTOP=silent
72IPSOP=ips
73ISSILENT=
74ISIPS=
75
76infoprint()
77{
78 if test "$ISSILENT" != "$SILENTOP"; then
79 echo 1>&2 "$1"
80 fi
81}
82
83subprint()
84{
85 if test "$ISSILENT" != "$SILENTOP"; then
86 echo 1>&2 " - $1"
87 fi
88}
89
90warnprint()
91{
92 if test "$ISSILENT" != "$SILENTOP"; then
93 echo 1>&2 " * Warning!! $1"
94 fi
95}
96
97errorprint()
98{
99 echo 1>&2 "## $1"
100}
101
102
103# check_bin_path()
104# !! failure is always fatal
105check_bin_path()
106{
107 if test -z "$1"; then
108 errorprint "missing argument to check_bin_path()"
109 exit 1
110 fi
111
112 if test ! -x "$1"; then
113 errorprint "$1 missing or is not an executable"
114 exit 1
115 fi
116 return 0
117}
118
119# find_bins()
120# !! failure is always fatal
121find_bins()
122{
123 # Search only for binaries that might be in different locations
124 BIN_IFCONFIG=`which ifconfig 2> /dev/null`
125 BIN_SVCS=`which svcs 2> /dev/null`
126 BIN_ID=`which id 2> /dev/null`
127
128 check_bin_path "$BIN_ID"
129 check_bin_path "$BIN_ADDDRV"
130 check_bin_path "$BIN_REMDRV"
131 check_bin_path "$BIN_MODLOAD"
132 check_bin_path "$BIN_MODUNLOAD"
133 check_bin_path "$BIN_MODINFO"
134 check_bin_path "$BIN_DEVFSADM"
135 check_bin_path "$BIN_BOOTADM"
136 check_bin_path "$BIN_SVCADM"
137 check_bin_path "$BIN_SVCCFG"
138 check_bin_path "$BIN_SVCS"
139 check_bin_path "$BIN_IFCONFIG"
140}
141
142# check_root()
143# !! failure is always fatal
144check_root()
145{
146 # Don't use "-u" option as some id binaries don't support it, instead
147 # rely on "uid=101(username) gid=10(groupname) groups=10(staff)" output
148 curuid=`$BIN_ID | cut -f 2 -d '=' | cut -f 1 -d '('`
149 if test "$curuid" -ne 0; then
150 errorprint "This script must be run with administrator privileges."
151 exit 1
152 fi
153}
154
155# check_zone()
156# !! failure is always fatal
157check_zone()
158{
159 currentzone=`zonename`
160 if test "$currentzone" != "global"; then
161 errorprint "This script must be run from the global zone."
162 exit 1
163 fi
164}
165
166# check_isa()
167# !! failure is always fatal
168check_isa()
169{
170 currentisa=`uname -i`
171 if test "$currentisa" = "i86xpv"; then
172 errorprint "VirtualBox cannot run under xVM Dom0! Fatal Error, Aborting installation!"
173 exit 1
174 fi
175}
176
177# check_module_arch()
178# !! failure is always fatal
179check_module_arch()
180{
181 cputype=`isainfo -k`
182 if test "$cputype" != "amd64" && test "$cputype" != "i386"; then
183 errorprint "VirtualBox works only on i386/amd64 hosts, not $cputype"
184 exit 1
185 fi
186}
187
188# module_added(modname)
189# returns 1 if added, 0 otherwise
190module_added()
191{
192 if test -z "$1"; then
193 errorprint "missing argument to module_added()"
194 exit 1
195 fi
196
197 # Add a space at end of module name to make sure we have a perfect match to avoid
198 # any substring matches: e.g "vboxusb" & "vboxusbmon"
199 loadentry=`cat /etc/name_to_major | grep "$1 "`
200 if test -z "$loadentry"; then
201 return 1
202 fi
203 return 0
204}
205
206# module_loaded(modname)
207# returns 1 if loaded, 0 otherwise
208module_loaded()
209{
210 if test -z "$1"; then
211 errorprint "missing argument to module_loaded()"
212 exit 1
213 fi
214
215 modname=$1
216 # modinfo should now work properly since we prevent module autounloading.
217 loadentry=`$BIN_MODINFO | grep "$modname "`
218 if test -z "$loadentry"; then
219 return 1
220 fi
221 return 0
222}
223
224# add_driver(modname, moddesc, fatal, nulloutput, [driverperm])
225# failure: depends on "fatal"
226add_driver()
227{
228 if test -z "$1" || test -z "$2"; then
229 errorprint "missing argument to add_driver()"
230 exit 1
231 fi
232
233 modname="$1"
234 moddesc="$2"
235 fatal="$3"
236 nullop="$4"
237 modperm="$5"
238
239 if test -n "$modperm"; then
240 if test "$nullop" = "$NULLOP"; then
241 $BIN_ADDDRV -m"$modperm" $modname >/dev/null 2>&1
242 else
243 $BIN_ADDDRV -m"$modperm" $modname
244 fi
245 else
246 if test "$nullop" = "$NULLOP"; then
247 $BIN_ADDDRV $modname >/dev/null 2>&1
248 else
249 $BIN_ADDDRV $modname
250 fi
251 fi
252
253 if test $? -ne 0; then
254 subprint "Adding: $moddesc module ...FAILED!"
255 if test "$fatal" = "$FATALOP"; then
256 exit 1
257 fi
258 return 1
259 fi
260 return 0
261}
262
263# rem_driver(modname, moddesc, [fatal])
264# failure: depends on [fatal]
265rem_driver()
266{
267 if test -z "$1" || test -z "$2"; then
268 errorprint "missing argument to rem_driver()"
269 exit 1
270 fi
271
272 modname=$1
273 moddesc=$2
274 fatal=$3
275 module_added $modname
276 if test "$?" -eq 0; then
277 if test "$ISIPS" != "$IPSOP"; then
278 $BIN_REMDRV $modname
279 else
280 $BIN_REMDRV $modname >/dev/null 2>&1
281 fi
282 if test $? -eq 0; then
283 subprint "Removed: $moddesc module"
284 return 0
285 else
286 subprint "Removing: $moddesc ...FAILED!"
287 if test "$fatal" = "$FATALOP"; then
288 exit 1
289 fi
290 return 1
291 fi
292 fi
293}
294
295# unload_module(modname, moddesc, [fatal])
296# failure: fatal
297unload_module()
298{
299 if test -z "$1" || test -z "$2"; then
300 errorprint "missing argument to unload_module()"
301 exit 1
302 fi
303
304 modname=$1
305 moddesc=$2
306 fatal=$3
307 modid=`$BIN_MODINFO | grep "$modname " | cut -f 1 -d ' ' `
308 if test -n "$modid"; then
309 $BIN_MODUNLOAD -i $modid
310 if test $? -eq 0; then
311 subprint "Unloaded: $moddesc module"
312 else
313 subprint "Unloading: $moddesc module ...FAILED!"
314 if test "$fatal" = "$FATALOP"; then
315 exit 1
316 fi
317 return 1
318 fi
319 fi
320 return 0
321}
322
323# load_module(modname, moddesc, [fatal])
324# pass "drv/modname" or "misc/vbi" etc.
325# failure: fatal
326load_module()
327{
328 if test -z "$1" || test -z "$2"; then
329 errorprint "missing argument to load_module()"
330 exit 1
331 fi
332
333 modname=$1
334 moddesc=$2
335 fatal=$3
336 $BIN_MODLOAD -p $modname
337 if test $? -eq 0; then
338 subprint "Loaded: $moddesc module"
339 return 0
340 else
341 subprint "Loading: $moddesc ...FAILED!"
342 if test "$fatal" = "$FATALOP"; then
343 exit 1
344 fi
345 return 1
346 fi
347}
348
349# install_drivers()
350# !! failure is always fatal
351install_drivers()
352{
353 if test -f "$DIR_CONF/vboxdrv.conf"; then
354 if test -n "_HARDENED_"; then
355 add_driver "$MOD_VBOXDRV" "$DESC_VBOXDRV" "$FATALOP" "not-$NULLOP" "'* 0600 root sys'"
356 else
357 add_driver "$MOD_VBOXDRV" "$DESC_VBOXDRV" "$FATALOP" "not-$NULLOP" "'* 0666 root sys'"
358 fi
359 load_module "drv/$MOD_VBOXDRV" "$DESC_VBOXDRV" "$FATALOP"
360 else
361 errorprint "Extreme error! Missing $DIR_CONF/vboxdrv.conf, aborting."
362 return 1
363 fi
364
365 # Add vboxdrv to devlink.tab
366 sed -e '/name=vboxdrv/d' /etc/devlink.tab > /etc/devlink.vbox
367 echo "type=ddi_pseudo;name=vboxdrv \D" >> /etc/devlink.vbox
368 mv -f /etc/devlink.vbox /etc/devlink.tab
369
370 # Create the device link
371 /usr/sbin/devfsadm -i "$MOD_VBOXDRV"
372
373 if test $? -eq 0 && test -h "/dev/vboxdrv"; then
374
375 if test -f "$DIR_CONF/vboxnet.conf"; then
376 add_driver "$MOD_VBOXNET" "$DESC_VBOXNET" "$FATALOP"
377 load_module "drv/$MOD_VBOXNET" "$DESC_VBOXNET" "$FATALOP"
378 fi
379
380 if test -f "$DIR_CONF/vboxflt.conf"; then
381 add_driver "$MOD_VBOXFLT" "$DESC_VBOXFLT" "$FATALOP"
382 load_module "drv/$MOD_VBOXFLT" "$DESC_VBOXFLT" "$FATALOP"
383 fi
384
385 if test -f "$DIR_CONF/vboxusbmon.conf" && test "$HOST_OS_MAJORVERSION" != "5.10"; then
386 # For VirtualBox 3.1 the new USB code requires Nevada > 123
387 if test "$HOST_OS_MINORVERSION" -gt 123; then
388 add_driver "$MOD_VBOXUSBMON" "$DESC_VBOXUSBMON" "$FATALOP" "not-$NULLOP" "'* 0666 root sys'"
389 load_module "drv/$MOD_VBOXUSBMON" "$DESC_VBOXUSBMON" "$FATALOP"
390
391 # Add vboxusbmon to devlink.tab
392 sed -e '/name=vboxusbmon/d' /etc/devlink.tab > /etc/devlink.vbox
393 echo "type=ddi_pseudo;name=vboxusbmon \D" >> /etc/devlink.vbox
394 mv -f /etc/devlink.vbox /etc/devlink.tab
395
396 # Create the device link
397 /usr/sbin/devfsadm -i "$MOD_VBOXUSBMON"
398 if test $? -ne 0; then
399 errorprint "Failed to create device link for $MOD_VBOXUSBMON."
400 exit 1
401 fi
402
403 # Add vboxusb if present
404 # This driver is special, we need it in the boot-archive but since there is no
405 # USB device to attach to now (it's done at runtime) it will fail to attach so
406 # redirect attaching failure output to /dev/null
407 if test -f "$DIR_CONF/vboxusb.conf"; then
408 add_driver "$MOD_VBOXUSB" "$DESC_VBOXUSB" "$FATALOP" "$NULLOP"
409 load_module "drv/$MOD_VBOXUSB" "$DESC_VBOXUSB" "$FATALOP"
410 fi
411 else
412 warnprint "Solaris 5.11 snv_124 or higher required for USB support. Skipped installing USB support."
413 fi
414 fi
415 else
416 errorprint "Failed to create device link for $MOD_VBOXDRV."
417 exit 1
418 fi
419
420 return $?
421}
422
423# remove_all([fatal])
424# failure: depends on [fatal]
425remove_drivers()
426{
427 fatal=$1
428
429 # Remove vboxdrv from devlink.tab
430 devlinkfound=`cat /etc/devlink.tab | grep vboxdrv`
431 if test -n "$devlinkfound"; then
432 sed -e '/name=vboxdrv/d' /etc/devlink.tab > /etc/devlink.vbox
433 mv -f /etc/devlink.vbox /etc/devlink.tab
434 fi
435
436 # Remove vboxusbmon from devlink.tab
437 devlinkfound=`cat /etc/devlink.tab | grep vboxusbmon`
438 if test -n "$devlinkfound"; then
439 sed -e '/name=vboxusbmon/d' /etc/devlink.tab > /etc/devlink.vbox
440 mv -f /etc/devlink.vbox /etc/devlink.tab
441 fi
442
443 unload_module "$MOD_VBOXUSB" "$DESC_VBOXUSB" "$fatal"
444 rem_driver "$MOD_VBOXUSB" "$DESC_VBOXUSB" "$fatal"
445
446 unload_module "$MOD_VBOXUSBMON" "$DESC_VBOXUSBMON" "$fatal"
447 rem_driver "$MOD_VBOXUSBMON" "$DESC_VBOXUSBMON" "$fatal"
448
449 unload_module "$MOD_VBOXFLT" "$DESC_VBOXFLT" "$fatal"
450 rem_driver "$MOD_VBOXFLT" "$DESC_VBOXFLT" "$fatal"
451
452 unload_module "$MOD_VBOXNET" "$DESC_VBOXNET" "$fatal"
453 rem_driver "$MOD_VBOXNET" "$DESC_VBOXNET" "$fatal"
454
455 unload_module "$MOD_VBOXDRV" "$DESC_VBOXDRV" "$fatal"
456 rem_driver "$MOD_VBOXDRV" "$DESC_VBOXDRV" "$fatal"
457
458# No separate VBI since 3.1
459# unload_module "$MOD_VBI" "$DESC_VBI" "$fatal"
460
461 # remove devlinks
462 if test -h "/dev/vboxdrv" || test -f "/dev/vboxdrv"; then
463 rm -f /dev/vboxdrv
464 fi
465 if test -h "/dev/vboxusbmon" || test -f "/dev/vboxusbmon"; then
466 rm -f /dev/vboxusbmon
467 fi
468
469 # unpatch nwam/dhcpagent fix
470 nwamfile=/etc/nwam/llp
471 nwambackupfile=$nwamfile.vbox
472 if test -f "$nwamfile"; then
473 sed -e '/vboxnet/d' $nwamfile > $nwambackupfile
474 mv -f $nwambackupfile $nwamfile
475 fi
476
477 # remove netmask configuration
478 nmaskfile=/etc/netmasks
479 nmaskbackupfile=$nmaskfile.vbox
480 if test -f "$nmaskfile"; then
481 sed -e '/#VirtualBox_SectionStart/,/#VirtualBox_SectionEnd/d' $nmaskfile > $nmaskbackupfile
482 mv -f $nmaskbackupfile $nmaskfile
483 fi
484
485 return 0
486}
487
488# install_python_bindings(pythonbin)
489# remarks: changes pwd
490# failure: non fatal
491install_python_bindings()
492{
493 # The python binary might not be there, so just exit silently
494 if test -z "$1"; then
495 return 0
496 fi
497
498 if test -z "$2"; then
499 errorprint "missing argument to install_python_bindings"
500 exit 1
501 fi
502
503 pythonbin=$1
504 pythondesc=$2
505 if test -x "$pythonbin"; then
506 VBOX_INSTALL_PATH="$DIR_VBOXBASE"
507 export VBOX_INSTALL_PATH
508 cd $DIR_VBOXBASE/sdk/installer
509 $pythonbin ./vboxapisetup.py install > /dev/null
510 if test "$?" -eq 0; then
511 subprint "Installed: Bindings for $pythondesc"
512 fi
513 return 0
514 fi
515 return 1
516}
517
518
519# cleanup_install([fatal])
520# failure: depends on [fatal]
521cleanup_install()
522{
523 fatal=$1
524
525 # stop and unregister webservice SMF
526 servicefound=`$BIN_SVCS -a | grep "virtualbox/webservice" 2>/dev/null`
527 if test ! -z "$servicefound"; then
528 $BIN_SVCADM disable -s svc:/application/virtualbox/webservice:default
529 $BIN_SVCCFG delete svc:/application/virtualbox/webservice:default
530 if test "$?" -eq 0; then
531 subprint "Unloaded: Web service"
532 else
533 subprint "Unloading: Web service ...ERROR(S)."
534 fi
535 fi
536
537 # stop and unregister zoneaccess SMF
538 servicefound=`$BIN_SVCS -a | grep "virtualbox/zoneaccess" 2>/dev/null`
539 if test ! -z "$servicefound"; then
540 $BIN_SVCADM disable -s svc:/application/virtualbox/zoneaccess
541 $BIN_SVCCFG delete svc:/application/virtualbox/zoneaccess
542 if test "$?" -eq 0; then
543 subprint "Unloaded: Zone access service"
544 else
545 subprint "Unloading: Zone access service ...ERROR(S)."
546 fi
547 fi
548
549 # unplumb all vboxnet instances
550 inst=0
551 while test $inst -ne $MOD_VBOXNET_INST; do
552 vboxnetup=`$BIN_IFCONFIG vboxnet$inst >/dev/null 2>&1`
553 if test "$?" -eq 0; then
554 $BIN_IFCONFIG vboxnet$inst unplumb
555 if test "$?" -ne 0; then
556 errorprint "VirtualBox NetAdapter 'vboxnet$inst' couldn't be unplumbed (probably in use)."
557 if test "$fatal" = "$FATALOP"; then
558 exit 1
559 fi
560 fi
561 fi
562
563 # unplumb vboxnet0 ipv6
564 vboxnetup=`$BIN_IFCONFIG vboxnet$inst inet6 >/dev/null 2>&1`
565 if test "$?" -eq 0; then
566 $BIN_IFCONFIG vboxnet$inst inet6 unplumb
567 if test "$?" -ne 0; then
568 errorprint "VirtualBox NetAdapter 'vboxnet$inst' IPv6 couldn't be unplumbed (probably in use)."
569 if test "$fatal" = "$FATALOP"; then
570 exit 1
571 fi
572 fi
573 fi
574
575 inst=`expr $inst + 1`
576 done
577}
578
579
580# postinstall()
581# !! failure is always fatal
582postinstall()
583{
584 infoprint "Loading VirtualBox kernel modules..."
585 install_drivers
586
587 if test "$?" -eq 0; then
588 if test -f "$DIR_CONF/vboxnet.conf"; then
589 # nwam/dhcpagent fix
590 nwamfile=/etc/nwam/llp
591 nwambackupfile=$nwamfile.vbox
592 if test -f "$nwamfile"; then
593 sed -e '/vboxnet/d' $nwamfile > $nwambackupfile
594
595 # add all vboxnet instances as static to nwam
596 inst=0
597 networkn=56
598 while test $inst -ne 1; do
599 echo "vboxnet$inst static 192.168.$networkn.1" >> $nwambackupfile
600 inst=`expr $inst + 1`
601 networkn=`expr $networkn + 1`
602 done
603 mv -f $nwambackupfile $nwamfile
604 fi
605
606 # plumb and configure vboxnet0
607 $BIN_IFCONFIG vboxnet0 plumb up
608 if test "$?" -eq 0; then
609 $BIN_IFCONFIG vboxnet0 192.168.56.1 netmask 255.255.255.0 up
610
611 # add the netmask to stay persistent across host reboots
612 nmaskfile=/etc/netmasks
613 nmaskbackupfile=$nmaskfile.vbox
614 if test -f $nmaskfile; then
615 sed -e '/#VirtualBox_SectionStart,/#VirtualBox_SectionEnd/d' $nmaskfile > $nmaskbackupfile
616 echo "#VirtualBox_SectionStart" >> $nmaskbackupfile
617 inst=0
618 networkn=56
619 while test $inst -ne 1; do
620 echo "192.168.$networkn.0 255.255.255.0" >> $nmaskbackupfile
621 inst=`expr $inst + 1`
622 networkn=`expr $networkn + 1`
623 done
624 echo "#VirtualBox_SectionEnd" >> $nmaskbackupfile
625 mv -f $nmaskbackupfile $nmaskfile
626 fi
627 else
628 # Should this be fatal?
629 warnprint "Failed to bring up vboxnet0!!"
630 fi
631 fi
632
633 if test -f /var/svc/manifest/application/virtualbox/virtualbox-webservice.xml || test -f /var/svc/manifest/application/virtualbox/virtualbox-zoneaccess.xml; then
634 infoprint "Configuring services..."
635 fi
636
637 # Web service
638 if test -f /var/svc/manifest/application/virtualbox/virtualbox-webservice.xml; then
639 /usr/sbin/svccfg import /var/svc/manifest/application/virtualbox/virtualbox-webservice.xml
640 /usr/sbin/svcadm disable -s svc:/application/virtualbox/webservice:default
641 if test "$?" -eq 0; then
642 subprint "Loaded: Web service"
643 else
644 subprint "Loading: Web service ...ERROR(S)."
645 fi
646 fi
647
648 # Zone access service
649 if test -f /var/svc/manifest/application/virtualbox/virtualbox-zoneaccess.xml; then
650 /usr/sbin/svccfg import /var/svc/manifest/application/virtualbox/virtualbox-zoneaccess.xml
651 /usr/sbin/svcadm enable -s svc:/application/virtualbox/zoneaccess
652 if test "$?" -eq 0; then
653 subprint "Loaded: Zone access service"
654 else
655 subprint "Loading: Zone access service ...ERROR(S)."
656 fi
657 fi
658
659 # Install python bindings
660 if test -f "$DIR_VBOXBASE/sdk/installer/vboxapisetup.py" || test -h "$DIR_VBOXBASE/sdk/installer/vboxapisetup.py"; then
661 PYTHONBIN=`which python 2> /dev/null`
662 if test -f "$PYTHONBIN" || test -h "$PYTHONBIN"; then
663 infoprint "Installing Python bindings..."
664
665 INSTALLEDIT=1
666 PYTHONBIN=`which python2.4 2>/dev/null`
667 install_python_bindings "$PYTHONBIN" "Python 2.4"
668 if test "$?" -eq 0; then
669 INSTALLEDIT=0
670 fi
671 PYTHONBIN=`which python2.5 2>/dev/null`
672 install_python_bindings "$PYTHONBIN" "Python 2.5"
673 if test "$?" -eq 0; then
674 INSTALLEDIT=0
675 fi
676 PYTHONBIN=`which python2.6 2>/dev/null`
677 install_python_bindings "$PYTHONBIN" "Python 2.6"
678 if test "$?" -eq 0; then
679 INSTALLEDIT=0
680 fi
681
682 # remove files installed by Python build
683 rm -rf $DIR_VBOXBASE/sdk/installer/build
684
685 if test "$INSTALLEDIT" -ne 0; then
686 warnprint "No suitable Python version found. Required Python 2.4, 2.5 or 2.6."
687 warnprint "Skipped installing the Python bindings."
688 fi
689 else
690 warnprint "Python not found, skipped installed Python bindings."
691 fi
692 fi
693
694 # Update boot archive
695 infoprint "Updating the boot archive..."
696 $BIN_BOOTADM update-archive > /dev/null
697
698 return 0
699 else
700 errorprint "Failed to install drivers"
701 exit 666
702 fi
703 return 1
704}
705
706# preremove([fatal])
707# failure: depends on [fatal]
708preremove()
709{
710 fatal=$1
711
712 cleanup_install "$fatal"
713
714 remove_drivers "$fatal"
715 if test "$?" -eq 0; then
716 return 0;
717 fi
718 return 1
719}
720
721
722
723# And it begins...
724check_root
725check_isa
726check_zone
727find_bins
728
729# Get command line options
730while test $# -gt 0;
731do
732 case "$1" in
733 --postinstall | --preremove | --installdrivers | --removedrivers | --setupdrivers)
734 drvop="$1"
735 ;;
736 --fatal)
737 fatal="$FATALOP"
738 ;;
739 --silent)
740 ISSILENT="$SILENTOP"
741 ;;
742 --ips)
743 ISIPS="$IPSOP"
744 ;;
745 --altkerndir)
746 # Use alternate kernel driver config folder (dev only)
747 DIR_CONF="/usr/kernel/drv"
748 ;;
749 *)
750 break
751 ;;
752 esac
753 shift
754done
755
756case "$drvop" in
757--postinstall)
758 check_module_arch
759 postinstall
760 ;;
761--preremove)
762 preremove "$fatal"
763 ;;
764--installdrivers)
765 check_module_arch
766 install_drivers
767 ;;
768--removedrivers)
769 remove_drivers "$fatal"
770 ;;
771--setupdrivers)
772 remove_drivers "$fatal"
773 install_drivers
774 ;;
775*)
776 errorprint "Invalid operation $drvop"
777 exit 1
778esac
779
780exit "$?"
781
Note: See TracBrowser for help on using the repository browser.

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