VirtualBox

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

Last change on this file since 30131 was 28800, checked in by vboxsync, 15 years ago

Automated rebranding to Oracle copyright/license strings via filemuncher

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