1 | #!/bin/sh
|
---|
2 | # $Id: vboxconfig.sh 39026 2011-10-19 09:44:50Z vboxsync $
|
---|
3 |
|
---|
4 | #
|
---|
5 | # VirtualBox Configuration Script, Solaris host.
|
---|
6 | #
|
---|
7 | # Copyright (C) 2009-2010 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 | # Never use exit 2 or exit 20 etc., the return codes are used in
|
---|
19 | # SRv4 postinstall procedures which carry special meaning. Just use exit 1 for failure.
|
---|
20 |
|
---|
21 | LANG=C
|
---|
22 | export LANG
|
---|
23 |
|
---|
24 | # S10 or S11
|
---|
25 | HOST_OS_MAJORVERSION=`uname -r`
|
---|
26 | # Which Solaris version (snv_xxx or oi_xxx or 11.x)?
|
---|
27 | HOST_OS_MINORVERSION=`uname -v | egrep 'snv|oi|11.' | sed -e "s/snv_//" -e "s/oi_//" -e "s/[^0-9.]//"`
|
---|
28 |
|
---|
29 | DIR_VBOXBASE="$PKG_INSTALL_ROOT/opt/VirtualBox"
|
---|
30 | DIR_CONF="$PKG_INSTALL_ROOT/platform/i86pc/kernel/drv"
|
---|
31 | DIR_MOD_32="$PKG_INSTALL_ROOT/platform/i86pc/kernel/drv"
|
---|
32 | DIR_MOD_64="$DIR_MOD_32/amd64"
|
---|
33 |
|
---|
34 | # Default paths, these will be overridden by 'which' if they don't exist
|
---|
35 | BIN_ADDDRV=/usr/sbin/add_drv
|
---|
36 | BIN_REMDRV=/usr/sbin/rem_drv
|
---|
37 | BIN_MODLOAD=/usr/sbin/modload
|
---|
38 | BIN_MODUNLOAD=/usr/sbin/modunload
|
---|
39 | BIN_MODINFO=/usr/sbin/modinfo
|
---|
40 | BIN_DEVFSADM=/usr/sbin/devfsadm
|
---|
41 | BIN_BOOTADM=/sbin/bootadm
|
---|
42 | BIN_SVCADM=/usr/sbin/svcadm
|
---|
43 | BIN_SVCCFG=/usr/sbin/svccfg
|
---|
44 | BIN_IFCONFIG=/sbin/ifconfig
|
---|
45 | BIN_SVCS=/usr/bin/svcs
|
---|
46 | BIN_ID=/usr/bin/id
|
---|
47 | BIN_PKILL=/usr/bin/pkill
|
---|
48 |
|
---|
49 | # "vboxdrv" is also used in sed lines here (change those as well if it ever changes)
|
---|
50 | MOD_VBOXDRV=vboxdrv
|
---|
51 | DESC_VBOXDRV="Host"
|
---|
52 |
|
---|
53 | MOD_VBOXNET=vboxnet
|
---|
54 | DESC_VBOXNET="NetAdapter"
|
---|
55 | MOD_VBOXNET_INST=32
|
---|
56 |
|
---|
57 | MOD_VBOXFLT=vboxflt
|
---|
58 | DESC_VBOXFLT="NetFilter (STREAMS)"
|
---|
59 |
|
---|
60 | MOD_VBOXBOW=vboxbow
|
---|
61 | DESC_VBOXBOW="NetFilter (Crossbow)"
|
---|
62 |
|
---|
63 | # No Separate VBI since (3.1)
|
---|
64 | #MOD_VBI=vbi
|
---|
65 | #DESC_VBI="Kernel Interface"
|
---|
66 |
|
---|
67 | MOD_VBOXUSBMON=vboxusbmon
|
---|
68 | DESC_VBOXUSBMON="USBMonitor"
|
---|
69 |
|
---|
70 | MOD_VBOXUSB=vboxusb
|
---|
71 | DESC_VBOXUSB="USB"
|
---|
72 |
|
---|
73 | UPDATEBOOTARCHIVE=0
|
---|
74 | REMOTEINST=0
|
---|
75 | FATALOP=fatal
|
---|
76 | NULLOP=nulloutput
|
---|
77 | SILENTOP=silent
|
---|
78 | IPSOP=ips
|
---|
79 | ISSILENT=
|
---|
80 | ISIPS=
|
---|
81 |
|
---|
82 | infoprint()
|
---|
83 | {
|
---|
84 | if test "$ISSILENT" != "$SILENTOP"; then
|
---|
85 | echo 1>&2 "$1"
|
---|
86 | fi
|
---|
87 | }
|
---|
88 |
|
---|
89 | subprint()
|
---|
90 | {
|
---|
91 | if test "$ISSILENT" != "$SILENTOP"; then
|
---|
92 | echo 1>&2 " - $1"
|
---|
93 | fi
|
---|
94 | }
|
---|
95 |
|
---|
96 | warnprint()
|
---|
97 | {
|
---|
98 | if test "$ISSILENT" != "$SILENTOP"; then
|
---|
99 | echo 1>&2 " * Warning!! $1"
|
---|
100 | fi
|
---|
101 | }
|
---|
102 |
|
---|
103 | errorprint()
|
---|
104 | {
|
---|
105 | echo 1>&2 "## $1"
|
---|
106 | }
|
---|
107 |
|
---|
108 | helpprint()
|
---|
109 | {
|
---|
110 | echo 1>&2 "$1"
|
---|
111 | }
|
---|
112 |
|
---|
113 | printusage()
|
---|
114 | {
|
---|
115 | helpprint "VirtualBox Configuration Script"
|
---|
116 | helpprint "usage: $0 <operation> [options]"
|
---|
117 | helpprint
|
---|
118 | helpprint "<operation> must be one of the following:"
|
---|
119 | helpprint " --postinstall Perform full post installation procedure"
|
---|
120 | helpprint " --preremove Perform full pre remove procedure"
|
---|
121 | helpprint " --installdrivers Only install the drivers"
|
---|
122 | helpprint " --removedrivers Only remove the drivers"
|
---|
123 | helpprint " --setupdrivers Setup drivers, reloads existing drivers"
|
---|
124 | helpprint
|
---|
125 | helpprint "[options] are one or more of the following:"
|
---|
126 | helpprint " --silent Silent mode"
|
---|
127 | helpprint " --fatal Don't continue on failure (required for postinstall)"
|
---|
128 | helpprint " --ips This is an IPS package postinstall/preremove"
|
---|
129 | helpprint " --altkerndir Use /usr/kernel/drv as the driver directory"
|
---|
130 | helpprint
|
---|
131 | }
|
---|
132 |
|
---|
133 | # find_bin_path()
|
---|
134 | # !! failure is always fatal
|
---|
135 | find_bin_path()
|
---|
136 | {
|
---|
137 | if test -z "$1"; then
|
---|
138 | errorprint "missing argument to find_bin_path()"
|
---|
139 | exit 1
|
---|
140 | fi
|
---|
141 |
|
---|
142 | binfilename=`basename $1`
|
---|
143 | binfilepath=`which $binfilename 2> /dev/null`
|
---|
144 | if test -x "$binfilepath"; then
|
---|
145 | echo "$binfilepath"
|
---|
146 | return 0
|
---|
147 | else
|
---|
148 | errorprint "$1 missing or is not an executable"
|
---|
149 | exit 1
|
---|
150 | fi
|
---|
151 | }
|
---|
152 |
|
---|
153 | # find_bins()
|
---|
154 | # !! failure is always fatal
|
---|
155 | find_bins()
|
---|
156 | {
|
---|
157 | # Search only for binaries that might be in different locations
|
---|
158 | if test ! -x "$BIN_ID"; then
|
---|
159 | BIN_ID=`find_bin_path "$BIN_ID"`
|
---|
160 | fi
|
---|
161 |
|
---|
162 | if test ! -x "$BIN_ADDDRV"; then
|
---|
163 | BIN_ADDDRV=`find_bin_path "$BIN_ADDDRV"`
|
---|
164 | fi
|
---|
165 |
|
---|
166 | if test ! -x "$BIN_REMDRV"; then
|
---|
167 | BIN_REMDRV=`find_bin_path "$BIN_REMDRV"`
|
---|
168 | fi
|
---|
169 |
|
---|
170 | if test ! -x "$BIN_MODLOAD"; then
|
---|
171 | BIN_MODLOAD=`check_bin_path "$BIN_MODLOAD"`
|
---|
172 | fi
|
---|
173 |
|
---|
174 | if test ! -x "$BIN_MODUNLOAD"; then
|
---|
175 | BIN_MODUNLOAD=`find_bin_path "$BIN_MODUNLOAD"`
|
---|
176 | fi
|
---|
177 |
|
---|
178 | if test ! -x "$BIN_MODINFO"; then
|
---|
179 | BIN_MODINFO=`find_bin_path "$BIN_MODINFO"`
|
---|
180 | fi
|
---|
181 |
|
---|
182 | if test ! -x "$BIN_DEVFSADM"; then
|
---|
183 | BIN_DEVFSADM=`find_bin_path "$BIN_DEVFSADM"`
|
---|
184 | fi
|
---|
185 |
|
---|
186 | if test ! -x "$BIN_BOOTADM"; then
|
---|
187 | BIN_BOOTADM=`find_bin_path "$BIN_BOOTADM"`
|
---|
188 | fi
|
---|
189 |
|
---|
190 | if test ! -x "$BIN_SVCADM"; then
|
---|
191 | BIN_SVCADM=`find_bin_path "$BIN_SVCADM"`
|
---|
192 | fi
|
---|
193 |
|
---|
194 | if test ! -x "$BIN_SVCCFG"; then
|
---|
195 | BIN_SVCCFG=`find_bin_path "$BIN_SVCCFG"`
|
---|
196 | fi
|
---|
197 |
|
---|
198 | if test ! -x "$BIN_SVCS"; then
|
---|
199 | BIN_SVCS=`find_bin_path "$BIN_SVCS"`
|
---|
200 | fi
|
---|
201 |
|
---|
202 | if test ! -x "$BIN_IFCONFIG"; then
|
---|
203 | BIN_IFCONFIG=`find_bin_path "$BIN_IFCONFIG"`
|
---|
204 | fi
|
---|
205 |
|
---|
206 | if test ! -x "$BIN_PKILL"; then
|
---|
207 | BIN_PKILL=`find_bin_path "$BIN_PKILL"`
|
---|
208 | fi
|
---|
209 | }
|
---|
210 |
|
---|
211 | # check_root()
|
---|
212 | # !! failure is always fatal
|
---|
213 | check_root()
|
---|
214 | {
|
---|
215 | # Don't use "-u" option as some id binaries don't support it, instead
|
---|
216 | # rely on "uid=101(username) gid=10(groupname) groups=10(staff)" output
|
---|
217 | curuid=`$BIN_ID | cut -f 2 -d '=' | cut -f 1 -d '('`
|
---|
218 | if test "$curuid" -ne 0; then
|
---|
219 | errorprint "This script must be run with administrator privileges."
|
---|
220 | exit 1
|
---|
221 | fi
|
---|
222 | }
|
---|
223 |
|
---|
224 | # get_sysinfo
|
---|
225 | # cannot fail
|
---|
226 | get_sysinfo()
|
---|
227 | {
|
---|
228 | if test "$HOST_OS_MAJORVERSION" = "5.11" && test "$HOST_OS_MINORVERSION" = "11.0"; then
|
---|
229 | HOST_OS_MINORVERSION="175"
|
---|
230 | else
|
---|
231 | # try find version for remote installs or if previous version parsing failed (empty strings), will minor will be empty
|
---|
232 | # for S10 hosts
|
---|
233 | if test "$REMOTEINST" -eq 1 || test -z "$HOST_OS_MINORVERSION" || test -z "$HOST_OS_MAJORVERSION"; then
|
---|
234 | if test -f "$PKG_INSTALL_ROOT/etc/release"; then
|
---|
235 | HOST_OS_MAJORVERSION=`cat "$PKG_INSTALL_ROOT/etc/release" | grep "Solaris 10"`
|
---|
236 | if test -n "$HOST_OS_MAJORVERSION"; then
|
---|
237 | HOST_OS_MAJORVERSION="5.10"
|
---|
238 | else
|
---|
239 | HOST_OS_MAJORVERSION=`cat "$PKG_INSTALL_ROOT/etc/release" | egrep "snv_|oi_"`
|
---|
240 | if test -n "$HOST_OS_MAJORVERSION"; then
|
---|
241 | HOST_OS_MAJORVERSION="5.11"
|
---|
242 | fi
|
---|
243 | fi
|
---|
244 | if test "$HOST_OS_MAJORVERSION" != "5.10"; then
|
---|
245 | HOST_OS_MINORVERSION=`cat "$PKG_INSTALL_ROOT/etc/release" | tr ' ' '\n' | egrep 'snv_|oi_' | sed -e "s/snv_//" -e "s/oi_//" -e "s/[^0-9]//"`
|
---|
246 | else
|
---|
247 | HOST_OS_MINORVERSION=""
|
---|
248 | fi
|
---|
249 | else
|
---|
250 | HOST_OS_MAJORVERSION=""
|
---|
251 | HOST_OS_MINORVERSION=""
|
---|
252 | fi
|
---|
253 | fi
|
---|
254 | fi
|
---|
255 | }
|
---|
256 |
|
---|
257 | # check_zone()
|
---|
258 | # !! failure is always fatal
|
---|
259 | check_zone()
|
---|
260 | {
|
---|
261 | currentzone=`zonename`
|
---|
262 | if test "$currentzone" != "global"; then
|
---|
263 | errorprint "This script must be run from the global zone."
|
---|
264 | exit 1
|
---|
265 | fi
|
---|
266 | }
|
---|
267 |
|
---|
268 | # check_isa()
|
---|
269 | # !! failure is always fatal
|
---|
270 | check_isa()
|
---|
271 | {
|
---|
272 | currentisa=`uname -i`
|
---|
273 | if test "$currentisa" = "i86xpv"; then
|
---|
274 | errorprint "VirtualBox cannot run under xVM Dom0! Fatal Error, Aborting installation!"
|
---|
275 | exit 1
|
---|
276 | fi
|
---|
277 | }
|
---|
278 |
|
---|
279 | # check_module_arch()
|
---|
280 | # !! failure is always fatal
|
---|
281 | check_module_arch()
|
---|
282 | {
|
---|
283 | cputype=`isainfo -k`
|
---|
284 | if test "$cputype" != "amd64" && test "$cputype" != "i386"; then
|
---|
285 | errorprint "VirtualBox works only on i386/amd64 hosts, not $cputype"
|
---|
286 | exit 1
|
---|
287 | fi
|
---|
288 | }
|
---|
289 |
|
---|
290 | # update_boot_archive()
|
---|
291 | # cannot fail
|
---|
292 | update_boot_archive()
|
---|
293 | {
|
---|
294 | infoprint "Updating the boot archive..."
|
---|
295 | if test "$REMOTEINST" -eq 0; then
|
---|
296 | $BIN_BOOTADM update-archive > /dev/null
|
---|
297 | else
|
---|
298 | $BIN_BOOTADM update-archive -R "$PKG_INSTALL_ROOT" > /dev/null
|
---|
299 | fi
|
---|
300 | UPDATEBOOTARCHIVE=0
|
---|
301 | }
|
---|
302 |
|
---|
303 |
|
---|
304 | # module_added(modname)
|
---|
305 | # returns 1 if added, 0 otherwise
|
---|
306 | module_added()
|
---|
307 | {
|
---|
308 | if test -z "$1"; then
|
---|
309 | errorprint "missing argument to module_added()"
|
---|
310 | exit 1
|
---|
311 | fi
|
---|
312 |
|
---|
313 | # Add a space at end of module name to make sure we have a perfect match to avoid
|
---|
314 | # any substring matches: e.g "vboxusb" & "vboxusbmon"
|
---|
315 | loadentry=`cat "$PKG_INSTALL_ROOT/etc/name_to_major" | grep "$1 "`
|
---|
316 | if test -z "$loadentry"; then
|
---|
317 | return 1
|
---|
318 | fi
|
---|
319 | return 0
|
---|
320 | }
|
---|
321 |
|
---|
322 | # module_loaded(modname)
|
---|
323 | # returns 1 if loaded, 0 otherwise
|
---|
324 | module_loaded()
|
---|
325 | {
|
---|
326 | if test -z "$1"; then
|
---|
327 | errorprint "missing argument to module_loaded()"
|
---|
328 | exit 1
|
---|
329 | fi
|
---|
330 |
|
---|
331 | modname=$1
|
---|
332 | # modinfo should now work properly since we prevent module autounloading.
|
---|
333 | loadentry=`$BIN_MODINFO | grep "$modname "`
|
---|
334 | if test -z "$loadentry"; then
|
---|
335 | return 1
|
---|
336 | fi
|
---|
337 | return 0
|
---|
338 | }
|
---|
339 |
|
---|
340 | # add_driver(modname, moddesc, fatal, nulloutput, [driverperm])
|
---|
341 | # failure: depends on "fatal"
|
---|
342 | add_driver()
|
---|
343 | {
|
---|
344 | if test -z "$1" || test -z "$2"; then
|
---|
345 | errorprint "missing argument to add_driver()"
|
---|
346 | exit 1
|
---|
347 | fi
|
---|
348 |
|
---|
349 | modname="$1"
|
---|
350 | moddesc="$2"
|
---|
351 | fatal="$3"
|
---|
352 | nullop="$4"
|
---|
353 | modperm="$5"
|
---|
354 |
|
---|
355 | if test -n "$modperm"; then
|
---|
356 | if test "$nullop" = "$NULLOP"; then
|
---|
357 | $BIN_ADDDRV $BASEDIR_OPT -m"$modperm" $modname >/dev/null 2>&1
|
---|
358 | else
|
---|
359 | $BIN_ADDDRV $BASEDIR_OPT -m"$modperm" $modname
|
---|
360 | fi
|
---|
361 | else
|
---|
362 | if test "$nullop" = "$NULLOP"; then
|
---|
363 | $BIN_ADDDRV $BASEDIR_OPT $modname >/dev/null 2>&1
|
---|
364 | else
|
---|
365 | $BIN_ADDDRV $BASEDIR_OPT $modname
|
---|
366 | fi
|
---|
367 | fi
|
---|
368 |
|
---|
369 | if test $? -ne 0; then
|
---|
370 | subprint "Adding: $moddesc module ...FAILED!"
|
---|
371 | if test "$fatal" = "$FATALOP"; then
|
---|
372 | exit 1
|
---|
373 | fi
|
---|
374 | return 1
|
---|
375 | elif test "$REMOTEINST" -eq 1 && test "$?" -eq 0; then
|
---|
376 | subprint "Added: $moddesc driver"
|
---|
377 | fi
|
---|
378 | return 0
|
---|
379 | }
|
---|
380 |
|
---|
381 | # rem_driver(modname, moddesc, [fatal])
|
---|
382 | # failure: depends on [fatal]
|
---|
383 | rem_driver()
|
---|
384 | {
|
---|
385 | if test -z "$1" || test -z "$2"; then
|
---|
386 | errorprint "missing argument to rem_driver()"
|
---|
387 | exit 1
|
---|
388 | fi
|
---|
389 |
|
---|
390 | modname=$1
|
---|
391 | moddesc=$2
|
---|
392 | fatal=$3
|
---|
393 |
|
---|
394 | module_added $modname
|
---|
395 | if test "$?" -eq 0; then
|
---|
396 | UPDATEBOOTARCHIVE=1
|
---|
397 | if test "$ISIPS" != "$IPSOP"; then
|
---|
398 | $BIN_REMDRV $BASEDIR_OPT $modname
|
---|
399 | else
|
---|
400 | $BIN_REMDRV $BASEDIR_OPT $modname >/dev/null 2>&1
|
---|
401 | fi
|
---|
402 | # for remote installs, don't bother with return values of rem_drv
|
---|
403 | if test $? -eq 0; then
|
---|
404 | subprint "Removed: $moddesc module"
|
---|
405 | return 0
|
---|
406 | else
|
---|
407 | subprint "Removing: $moddesc ...FAILED!"
|
---|
408 | if test "$fatal" = "$FATALOP"; then
|
---|
409 | exit 1
|
---|
410 | fi
|
---|
411 | return 1
|
---|
412 | fi
|
---|
413 | fi
|
---|
414 | }
|
---|
415 |
|
---|
416 | # unload_module(modname, moddesc, [fatal])
|
---|
417 | # failure: fatal
|
---|
418 | unload_module()
|
---|
419 | {
|
---|
420 | if test -z "$1" || test -z "$2"; then
|
---|
421 | errorprint "missing argument to unload_module()"
|
---|
422 | exit 1
|
---|
423 | fi
|
---|
424 |
|
---|
425 | # No-OP for non-root installs
|
---|
426 | if test "$REMOTEINST" -eq 1; then
|
---|
427 | return 0
|
---|
428 | fi
|
---|
429 |
|
---|
430 | modname=$1
|
---|
431 | moddesc=$2
|
---|
432 | fatal=$3
|
---|
433 | modid=`$BIN_MODINFO | grep "$modname " | cut -f 1 -d ' ' `
|
---|
434 | if test -n "$modid"; then
|
---|
435 | $BIN_MODUNLOAD -i $modid
|
---|
436 | if test $? -eq 0; then
|
---|
437 | subprint "Unloaded: $moddesc module"
|
---|
438 | else
|
---|
439 | subprint "Unloading: $moddesc module ...FAILED!"
|
---|
440 | if test "$fatal" = "$FATALOP"; then
|
---|
441 | exit 1
|
---|
442 | fi
|
---|
443 | return 1
|
---|
444 | fi
|
---|
445 | fi
|
---|
446 | return 0
|
---|
447 | }
|
---|
448 |
|
---|
449 | # load_module(modname, moddesc, [fatal])
|
---|
450 | # pass "drv/modname" or "misc/vbi" etc.
|
---|
451 | # failure: fatal
|
---|
452 | load_module()
|
---|
453 | {
|
---|
454 | if test -z "$1" || test -z "$2"; then
|
---|
455 | errorprint "missing argument to load_module()"
|
---|
456 | exit 1
|
---|
457 | fi
|
---|
458 |
|
---|
459 | # No-OP for non-root installs
|
---|
460 | if test "$REMOTEINST" -eq 1; then
|
---|
461 | return 0
|
---|
462 | fi
|
---|
463 |
|
---|
464 | modname=$1
|
---|
465 | moddesc=$2
|
---|
466 | fatal=$3
|
---|
467 | $BIN_MODLOAD -p $modname
|
---|
468 | if test $? -eq 0; then
|
---|
469 | subprint "Loaded: $moddesc module"
|
---|
470 | return 0
|
---|
471 | else
|
---|
472 | subprint "Loading: $moddesc ...FAILED!"
|
---|
473 | if test "$fatal" = "$FATALOP"; then
|
---|
474 | exit 1
|
---|
475 | fi
|
---|
476 | return 1
|
---|
477 | fi
|
---|
478 | }
|
---|
479 |
|
---|
480 | load_vboxflt()
|
---|
481 | {
|
---|
482 | if test -f "$DIR_CONF/vboxflt.conf"; then
|
---|
483 | add_driver "$MOD_VBOXFLT" "$DESC_VBOXFLT" "$FATALOP"
|
---|
484 | load_module "drv/$MOD_VBOXFLT" "$DESC_VBOXFLT" "$FATALOP"
|
---|
485 | else
|
---|
486 | # For custom pkgs that optionally ship this module, let's not fail but just warn
|
---|
487 | warnprint "$DESC_VBOXFLT installation requested but not shipped in this package."
|
---|
488 | fi
|
---|
489 | }
|
---|
490 |
|
---|
491 | load_vboxbow()
|
---|
492 | {
|
---|
493 | if test -f "$DIR_CONF/vboxbow.conf"; then
|
---|
494 | add_driver "$MOD_VBOXBOW" "$DESC_VBOXBOW" "$FATALOP"
|
---|
495 | load_module "drv/$MOD_VBOXBOW" "$DESC_VBOXBOW" "$FATALOP"
|
---|
496 | else
|
---|
497 | # For custom pkgs that optionally ship this module, let's not fail but just warn
|
---|
498 | warnprint "$DESC_VBOXBOW installation requested but not shipped in this package."
|
---|
499 | fi
|
---|
500 | }
|
---|
501 |
|
---|
502 | # install_drivers()
|
---|
503 | # !! failure is always fatal
|
---|
504 | install_drivers()
|
---|
505 | {
|
---|
506 | if test -f "$DIR_CONF/vboxdrv.conf"; then
|
---|
507 | if test -n "_HARDENED_"; then
|
---|
508 | add_driver "$MOD_VBOXDRV" "$DESC_VBOXDRV" "$FATALOP" "not-$NULLOP" "'* 0600 root sys'"
|
---|
509 | else
|
---|
510 | add_driver "$MOD_VBOXDRV" "$DESC_VBOXDRV" "$FATALOP" "not-$NULLOP" "'* 0666 root sys'"
|
---|
511 | fi
|
---|
512 | load_module "drv/$MOD_VBOXDRV" "$DESC_VBOXDRV" "$FATALOP"
|
---|
513 | else
|
---|
514 | errorprint "Extreme error! Missing $DIR_CONF/vboxdrv.conf, aborting."
|
---|
515 | return 1
|
---|
516 | fi
|
---|
517 |
|
---|
518 | # Add vboxdrv to devlink.tab
|
---|
519 | if test -f "$PKG_INSTALL_ROOT/etc/devlink.tab"; then
|
---|
520 | sed -e '/name=vboxdrv/d' "$PKG_INSTALL_ROOT/etc/devlink.tab" > "$PKG_INSTALL_ROOT/etc/devlink.vbox"
|
---|
521 | echo "type=ddi_pseudo;name=vboxdrv \D" >> "$PKG_INSTALL_ROOT/etc/devlink.vbox"
|
---|
522 | mv -f "$PKG_INSTALL_ROOT/etc/devlink.vbox" "$PKG_INSTALL_ROOT/etc/devlink.tab"
|
---|
523 | else
|
---|
524 | errorprint "Missing $PKG_INSTALL_ROOT/etc/devlink.tab, aborting install"
|
---|
525 | return 1
|
---|
526 | fi
|
---|
527 |
|
---|
528 | # Create the device link for non-remote installs
|
---|
529 | if test "$REMOTEINST" -eq 0; then
|
---|
530 | /usr/sbin/devfsadm -i "$MOD_VBOXDRV"
|
---|
531 | if test $? -ne 0 || test ! -h "/dev/vboxdrv"; then
|
---|
532 | errorprint "Failed to create device link for $MOD_VBOXDRV."
|
---|
533 | exit 1
|
---|
534 | fi
|
---|
535 | fi
|
---|
536 |
|
---|
537 | # Load VBoxNetAdp
|
---|
538 | if test -f "$DIR_CONF/vboxnet.conf"; then
|
---|
539 | add_driver "$MOD_VBOXNET" "$DESC_VBOXNET" "$FATALOP"
|
---|
540 | load_module "drv/$MOD_VBOXNET" "$DESC_VBOXNET" "$FATALOP"
|
---|
541 | fi
|
---|
542 |
|
---|
543 | # If both vboxinst_vboxbow and vboxinst_vboxflt exist, bail.
|
---|
544 | if test -f "$PKG_INSTALL_ROOT/etc/vboxinst_vboxflt" && test -f "$PKG_INSTALL_ROOT/etc/vboxinst_vboxbow"; then
|
---|
545 | errorprint "Force-install files '$PKG_INSTALL_ROOT/etc/vboxinst_vboxflt' and '$PKG_INSTALL_ROOT/etc/vboxinst_vboxbow' both exist."
|
---|
546 | errorprint "Cannot load $DESC_VBOXFLT and $DESC_VBOXBOW drivers at the same time."
|
---|
547 | return 1
|
---|
548 | fi
|
---|
549 |
|
---|
550 | # If the force-install files exists, install blindly
|
---|
551 | if test -f "$PKG_INSTALL_ROOT/etc/vboxinst_vboxflt"; then
|
---|
552 | load_vboxflt
|
---|
553 | elif test -f "$PKG_INSTALL_ROOT/etc/vboxinst_vboxbow"; then
|
---|
554 | infoprint "here"
|
---|
555 | load_vboxbow
|
---|
556 | else
|
---|
557 | # If host is S10 or S11 (< snv_159) or vboxbow isn't shipped, then load vboxflt
|
---|
558 | if test "$HOST_OS_MAJORVERSION" = "5.10" || test "$HOST_OS_MINORVERSION" -lt 159 || test ! -f "$DIR_CONF/vboxbow.conf"; then
|
---|
559 | load_vboxflt
|
---|
560 | else
|
---|
561 | # For S11 snv_159+ load vboxbow
|
---|
562 | load_vboxbow
|
---|
563 | fi
|
---|
564 | fi
|
---|
565 |
|
---|
566 | # Load VBoxUSBMon, VBoxUSB
|
---|
567 | if test -f "$DIR_CONF/vboxusbmon.conf" && test "$HOST_OS_MAJORVERSION" != "5.10"; then
|
---|
568 | # For VirtualBox 3.1 the new USB code requires Nevada > 123
|
---|
569 | if test "$HOST_OS_MINORVERSION" -gt 123; then
|
---|
570 | # Add a group "vboxuser" (8-character limit) for USB access.
|
---|
571 | # All users which need host USB-passthrough support will have to be added to this group.
|
---|
572 | groupadd vboxuser >/dev/null 2>&1
|
---|
573 |
|
---|
574 | add_driver "$MOD_VBOXUSBMON" "$DESC_VBOXUSBMON" "$FATALOP" "not-$NULLOP" "'* 0666 root sys'"
|
---|
575 | load_module "drv/$MOD_VBOXUSBMON" "$DESC_VBOXUSBMON" "$FATALOP"
|
---|
576 |
|
---|
577 | chown root:vboxuser "/devices/pseudo/vboxusbmon@0:vboxusbmon"
|
---|
578 |
|
---|
579 | # Add vboxusbmon to devlink.tab
|
---|
580 | sed -e '/name=vboxusbmon/d' "$PKG_INSTALL_ROOT/etc/devlink.tab" > "$PKG_INSTALL_ROOT/etc/devlink.vbox"
|
---|
581 | echo "type=ddi_pseudo;name=vboxusbmon \D" >> "$PKG_INSTALL_ROOT/etc/devlink.vbox"
|
---|
582 | mv -f "$PKG_INSTALL_ROOT/etc/devlink.vbox" "$PKG_INSTALL_ROOT/etc/devlink.tab"
|
---|
583 |
|
---|
584 | # Create the device link for non-remote installs
|
---|
585 | if test "$REMOTEINST" -eq 0; then
|
---|
586 | /usr/sbin/devfsadm -i "$MOD_VBOXUSBMON"
|
---|
587 | if test $? -ne 0; then
|
---|
588 | errorprint "Failed to create device link for $MOD_VBOXUSBMON."
|
---|
589 | exit 1
|
---|
590 | fi
|
---|
591 | fi
|
---|
592 |
|
---|
593 | # Add vboxusb if present
|
---|
594 | # This driver is special, we need it in the boot-archive but since there is no
|
---|
595 | # USB device to attach to now (it's done at runtime) it will fail to attach so
|
---|
596 | # redirect attaching failure output to /dev/null
|
---|
597 | if test -f "$DIR_CONF/vboxusb.conf"; then
|
---|
598 | add_driver "$MOD_VBOXUSB" "$DESC_VBOXUSB" "$FATALOP" "$NULLOP"
|
---|
599 | load_module "drv/$MOD_VBOXUSB" "$DESC_VBOXUSB" "$FATALOP"
|
---|
600 | fi
|
---|
601 | else
|
---|
602 | if test -n "$HOST_OS_MINORVERSION"; then
|
---|
603 | warnprint "Solaris 5.11 build 124 or higher required for USB support. Skipped installing USB support."
|
---|
604 | else
|
---|
605 | warnprint "Failed to determine Solaris 5.11 snv version. Skipped installing USB support."
|
---|
606 | fi
|
---|
607 | fi
|
---|
608 | fi
|
---|
609 |
|
---|
610 | return $?
|
---|
611 | }
|
---|
612 |
|
---|
613 | # remove_drivers([fatal])
|
---|
614 | # failure: depends on [fatal]
|
---|
615 | remove_drivers()
|
---|
616 | {
|
---|
617 | fatal=$1
|
---|
618 |
|
---|
619 | # Remove vboxdrv from devlink.tab
|
---|
620 | if test -f "$PKG_INSTALL_ROOT/etc/devlink.tab"; then
|
---|
621 | devlinkfound=`cat "$PKG_INSTALL_ROOT/etc/devlink.tab" | grep vboxdrv`
|
---|
622 | if test -n "$devlinkfound"; then
|
---|
623 | sed -e '/name=vboxdrv/d' "$PKG_INSTALL_ROOT/etc/devlink.tab" > "$PKG_INSTALL_ROOT/etc/devlink.vbox"
|
---|
624 | mv -f "$PKG_INSTALL_ROOT/etc/devlink.vbox" "$PKG_INSTALL_ROOT/etc/devlink.tab"
|
---|
625 | fi
|
---|
626 |
|
---|
627 | # Remove vboxusbmon from devlink.tab
|
---|
628 | devlinkfound=`cat "$PKG_INSTALL_ROOT/etc/devlink.tab" | grep vboxusbmon`
|
---|
629 | if test -n "$devlinkfound"; then
|
---|
630 | sed -e '/name=vboxusbmon/d' "$PKG_INSTALL_ROOT/etc/devlink.tab" > "$PKG_INSTALL_ROOT/etc/devlink.vbox"
|
---|
631 | mv -f "$PKG_INSTALL_ROOT/etc/devlink.vbox" "$PKG_INSTALL_ROOT/etc/devlink.tab"
|
---|
632 | fi
|
---|
633 | fi
|
---|
634 |
|
---|
635 | unload_module "$MOD_VBOXUSB" "$DESC_VBOXUSB" "$fatal"
|
---|
636 | rem_driver "$MOD_VBOXUSB" "$DESC_VBOXUSB" "$fatal"
|
---|
637 |
|
---|
638 | unload_module "$MOD_VBOXUSBMON" "$DESC_VBOXUSBMON" "$fatal"
|
---|
639 | rem_driver "$MOD_VBOXUSBMON" "$DESC_VBOXUSBMON" "$fatal"
|
---|
640 |
|
---|
641 | unload_module "$MOD_VBOXFLT" "$DESC_VBOXFLT" "$fatal"
|
---|
642 | rem_driver "$MOD_VBOXFLT" "$DESC_VBOXFLT" "$fatal"
|
---|
643 |
|
---|
644 | unload_module "$MOD_VBOXBOW" "$DESC_VBOXBOW" "$fatal"
|
---|
645 | rem_driver "$MOD_VBOXBOW" "$DESC_VBOXBOW" "$fatal"
|
---|
646 |
|
---|
647 | unload_module "$MOD_VBOXNET" "$DESC_VBOXNET" "$fatal"
|
---|
648 | rem_driver "$MOD_VBOXNET" "$DESC_VBOXNET" "$fatal"
|
---|
649 |
|
---|
650 | unload_module "$MOD_VBOXDRV" "$DESC_VBOXDRV" "$fatal"
|
---|
651 | rem_driver "$MOD_VBOXDRV" "$DESC_VBOXDRV" "$fatal"
|
---|
652 |
|
---|
653 | # No separate VBI since 3.1
|
---|
654 | # unload_module "$MOD_VBI" "$DESC_VBI" "$fatal"
|
---|
655 |
|
---|
656 | # remove devlinks
|
---|
657 | if test -h "$PKG_INSTALL_ROOT/dev/vboxdrv" || test -f "$PKG_INSTALL_ROOT/dev/vboxdrv"; then
|
---|
658 | rm -f "$PKG_INSTALL_ROOT/dev/vboxdrv"
|
---|
659 | fi
|
---|
660 | if test -h "$PKG_INSTALL_ROOT/dev/vboxusbmon" || test -f "$PKG_INSTALL_ROOT/dev/vboxusbmon"; then
|
---|
661 | rm -f "$PKG_INSTALL_ROOT/dev/vboxusbmon"
|
---|
662 | fi
|
---|
663 |
|
---|
664 | # unpatch nwam/dhcpagent fix
|
---|
665 | nwamfile="$PKG_INSTALL_ROOT/etc/nwam/llp"
|
---|
666 | nwambackupfile=$nwamfile.vbox
|
---|
667 | if test -f "$nwamfile"; then
|
---|
668 | sed -e '/vboxnet/d' $nwamfile > $nwambackupfile
|
---|
669 | mv -f $nwambackupfile $nwamfile
|
---|
670 | fi
|
---|
671 |
|
---|
672 | # remove netmask configuration
|
---|
673 | if test -h "$PKG_INSTALL_ROOT/etc/netmasks"; then
|
---|
674 | nmaskfile="$PKG_INSTALL_ROOT/etc/inet/netmasks"
|
---|
675 | else
|
---|
676 | nmaskfile="$PKG_INSTALL_ROOT/etc/netmasks"
|
---|
677 | fi
|
---|
678 | nmaskbackupfile=$nmaskfile.vbox
|
---|
679 | if test -f "$nmaskfile"; then
|
---|
680 | sed -e '/#VirtualBox_SectionStart/,/#VirtualBox_SectionEnd/d' $nmaskfile > $nmaskbackupfile
|
---|
681 | mv -f $nmaskbackupfile $nmaskfile
|
---|
682 | fi
|
---|
683 |
|
---|
684 | if test $UPDATEBOOTARCHIVE -eq 1; then
|
---|
685 | update_boot_archive
|
---|
686 | fi
|
---|
687 |
|
---|
688 | return 0
|
---|
689 | }
|
---|
690 |
|
---|
691 | # install_python_bindings(pythonbin)
|
---|
692 | # remarks: changes pwd
|
---|
693 | # failure: non fatal
|
---|
694 | install_python_bindings()
|
---|
695 | {
|
---|
696 | # The python binary might not be there, so just exit silently
|
---|
697 | if test -z "$1"; then
|
---|
698 | return 0
|
---|
699 | fi
|
---|
700 |
|
---|
701 | if test -z "$2"; then
|
---|
702 | errorprint "missing argument to install_python_bindings"
|
---|
703 | exit 1
|
---|
704 | fi
|
---|
705 |
|
---|
706 | pythonbin=$1
|
---|
707 | pythondesc=$2
|
---|
708 | if test -x "$pythonbin"; then
|
---|
709 | VBOX_INSTALL_PATH="$DIR_VBOXBASE"
|
---|
710 | export VBOX_INSTALL_PATH
|
---|
711 | cd $DIR_VBOXBASE/sdk/installer
|
---|
712 | $pythonbin ./vboxapisetup.py install > /dev/null
|
---|
713 | if test "$?" -eq 0; then
|
---|
714 | subprint "Installed: Bindings for $pythondesc"
|
---|
715 | fi
|
---|
716 | return 0
|
---|
717 | fi
|
---|
718 | return 1
|
---|
719 | }
|
---|
720 |
|
---|
721 | # stop_process(processname)
|
---|
722 | # failure: depends on [fatal]
|
---|
723 | stop_process()
|
---|
724 | {
|
---|
725 | if test -z "$1"; then
|
---|
726 | errorprint "missing argument to stop_process()"
|
---|
727 | exit 1
|
---|
728 | fi
|
---|
729 |
|
---|
730 | procname=$1
|
---|
731 | procpid=`ps -eo pid,fname | grep $procname | grep -v grep | awk '{ print $1 }'`
|
---|
732 | if test ! -z "$procpid" && test "$procpid" -ge 0; then
|
---|
733 | $BIN_PKILL "$procname"
|
---|
734 | sleep 2
|
---|
735 | procpid=`ps -eo pid,fname | grep $procname | grep -v grep | awk '{ print $1 }'`
|
---|
736 | if test ! -z "$procpid" && test "$procpid" -ge 0; then
|
---|
737 | subprint "Terminating: $procname ...FAILED!"
|
---|
738 | if test "$fatal" = "$FATALOP"; then
|
---|
739 | exit 1
|
---|
740 | fi
|
---|
741 | else
|
---|
742 | subprint "Terminated: $procname"
|
---|
743 | fi
|
---|
744 | fi
|
---|
745 | }
|
---|
746 |
|
---|
747 |
|
---|
748 | # stop_service(servicename, shortFMRI-suitable for grep, full FMRI)
|
---|
749 | # failure: non fatal
|
---|
750 | stop_service()
|
---|
751 | {
|
---|
752 | if test -z "$1" || test -z "$2" || test -z "$3"; then
|
---|
753 | errorprint "missing argument to stop_service()"
|
---|
754 | exit 1
|
---|
755 | fi
|
---|
756 | servicefound=`$BIN_SVCS -a | grep "$2" 2>/dev/null`
|
---|
757 | if test ! -z "$servicefound"; then
|
---|
758 | $BIN_SVCADM disable -s "$3"
|
---|
759 | # Don't delete the manifest, this is handled by the manifest class action
|
---|
760 | # $BIN_SVCCFG delete "$3"
|
---|
761 | if test "$?" -eq 0; then
|
---|
762 | subprint "Unloaded: $1"
|
---|
763 | else
|
---|
764 | subprint "Unloading: $1 ...ERROR(S)."
|
---|
765 | fi
|
---|
766 | fi
|
---|
767 | }
|
---|
768 |
|
---|
769 |
|
---|
770 | # cleanup_install([fatal])
|
---|
771 | # failure: depends on [fatal]
|
---|
772 | cleanup_install()
|
---|
773 | {
|
---|
774 | fatal=$1
|
---|
775 |
|
---|
776 | # No-Op for remote installs
|
---|
777 | if test "$REMOTEINST" -eq 1; then
|
---|
778 | return 0
|
---|
779 | fi
|
---|
780 |
|
---|
781 | # stop the services
|
---|
782 | stop_service "Web service" "virtualbox/webservice" "svc:/application/virtualbox/webservice:default"
|
---|
783 | stop_service "Balloon control service" "virtualbox/balloonctrl" "svc:/application/virtualbox/balloonctrl:default"
|
---|
784 | stop_service "Zone access service" "virtualbox/zoneaccess" "svc:/application/virtualbox/zoneaccess:default"
|
---|
785 |
|
---|
786 | # unplumb all vboxnet instances for non-remote installs
|
---|
787 | inst=0
|
---|
788 | while test $inst -ne $MOD_VBOXNET_INST; do
|
---|
789 | vboxnetup=`$BIN_IFCONFIG vboxnet$inst >/dev/null 2>&1`
|
---|
790 | if test "$?" -eq 0; then
|
---|
791 | $BIN_IFCONFIG vboxnet$inst unplumb
|
---|
792 | if test "$?" -ne 0; then
|
---|
793 | errorprint "VirtualBox NetAdapter 'vboxnet$inst' couldn't be unplumbed (probably in use)."
|
---|
794 | if test "$fatal" = "$FATALOP"; then
|
---|
795 | exit 1
|
---|
796 | fi
|
---|
797 | fi
|
---|
798 | fi
|
---|
799 |
|
---|
800 | # unplumb vboxnet0 ipv6
|
---|
801 | vboxnetup=`$BIN_IFCONFIG vboxnet$inst inet6 >/dev/null 2>&1`
|
---|
802 | if test "$?" -eq 0; then
|
---|
803 | $BIN_IFCONFIG vboxnet$inst inet6 unplumb
|
---|
804 | if test "$?" -ne 0; then
|
---|
805 | errorprint "VirtualBox NetAdapter 'vboxnet$inst' IPv6 couldn't be unplumbed (probably in use)."
|
---|
806 | if test "$fatal" = "$FATALOP"; then
|
---|
807 | exit 1
|
---|
808 | fi
|
---|
809 | fi
|
---|
810 | fi
|
---|
811 |
|
---|
812 | inst=`expr $inst + 1`
|
---|
813 | done
|
---|
814 |
|
---|
815 | # Stop our other daemons, non-fatal
|
---|
816 | stop_process VBoxSVC
|
---|
817 | stop_process VBoxNetDHCP
|
---|
818 | }
|
---|
819 |
|
---|
820 |
|
---|
821 | # postinstall()
|
---|
822 | # !! failure is always fatal
|
---|
823 | postinstall()
|
---|
824 | {
|
---|
825 | infoprint "Detected Solaris $HOST_OS_MAJORVERSION Version $HOST_OS_MINORVERSION"
|
---|
826 | infoprint "Loading VirtualBox kernel modules..."
|
---|
827 | install_drivers
|
---|
828 |
|
---|
829 | if test "$?" -eq 0; then
|
---|
830 | if test -f "$DIR_CONF/vboxnet.conf"; then
|
---|
831 | # nwam/dhcpagent fix
|
---|
832 | nwamfile="$PKG_INSTALL_ROOT/etc/nwam/llp"
|
---|
833 | nwambackupfile=$nwamfile.vbox
|
---|
834 | if test -f "$nwamfile"; then
|
---|
835 | sed -e '/vboxnet/d' $nwamfile > $nwambackupfile
|
---|
836 |
|
---|
837 | # add all vboxnet instances as static to nwam
|
---|
838 | inst=0
|
---|
839 | networkn=56
|
---|
840 | while test $inst -ne 1; do
|
---|
841 | echo "vboxnet$inst static 192.168.$networkn.1" >> $nwambackupfile
|
---|
842 | inst=`expr $inst + 1`
|
---|
843 | networkn=`expr $networkn + 1`
|
---|
844 | done
|
---|
845 | mv -f $nwambackupfile $nwamfile
|
---|
846 | fi
|
---|
847 |
|
---|
848 | # plumb and configure vboxnet0 for non-remote installs
|
---|
849 | if test "$REMOTEINST" -eq 0; then
|
---|
850 | # S11 175a renames vboxnet0 as 'netX', undo this and rename it back
|
---|
851 | if test "$HOST_OS_MAJORVERSION" = "5.11" && test "$HOST_OS_MINORVERSION" -gt 174; then
|
---|
852 | vanityname=`dladm show-phys -po link,device | grep vboxnet0 | cut -f1 -d':'`
|
---|
853 | if test $? -eq 0 && test ! -z "$vanityname" && test "$vanityname" != "vboxnet0"; then
|
---|
854 | dladm rename-link "$vanityname" vboxnet0
|
---|
855 | if test $? -ne 0; then
|
---|
856 | errorprint "Failed to rename vanity interface ($vanityname) to vboxnet0"
|
---|
857 | fi
|
---|
858 | fi
|
---|
859 | fi
|
---|
860 |
|
---|
861 | $BIN_IFCONFIG vboxnet0 plumb
|
---|
862 | $BIN_IFCONFIG vboxnet0 up
|
---|
863 | if test "$?" -eq 0; then
|
---|
864 | $BIN_IFCONFIG vboxnet0 192.168.56.1 netmask 255.255.255.0 up
|
---|
865 |
|
---|
866 | # /etc/netmasks is a symlink, older installers replaced this with
|
---|
867 | # a copy of the actual file, repair that behaviour here.
|
---|
868 | recreatelink=0
|
---|
869 | if test -h "$PKG_INSTALL_ROOT/etc/netmasks"; then
|
---|
870 | nmaskfile="$PKG_INSTALL_ROOT/etc/inet/netmasks"
|
---|
871 | else
|
---|
872 | nmaskfile="$PKG_INSTALL_ROOT/etc/netmasks"
|
---|
873 | recreatelink=1
|
---|
874 | fi
|
---|
875 |
|
---|
876 | # add the netmask to stay persistent across host reboots
|
---|
877 | nmaskbackupfile=$nmaskfile.vbox
|
---|
878 | if test -f $nmaskfile; then
|
---|
879 | sed -e '/#VirtualBox_SectionStart/,/#VirtualBox_SectionEnd/d' $nmaskfile > $nmaskbackupfile
|
---|
880 |
|
---|
881 | if test $recreatelink -eq 1; then
|
---|
882 | # Check after removing our settings if /etc/netmasks is identifcal to /etc/inet/netmasks
|
---|
883 | anydiff=`diff $nmaskbackupfile "$PKG_INSTALL_ROOT/etc/inet/netmasks"`
|
---|
884 | if test ! -z "$anydiff"; then
|
---|
885 | # User may have some custom settings in /etc/netmasks, don't overwrite /etc/netmasks!
|
---|
886 | recreatelink=2
|
---|
887 | fi
|
---|
888 | fi
|
---|
889 |
|
---|
890 | echo "#VirtualBox_SectionStart" >> $nmaskbackupfile
|
---|
891 | inst=0
|
---|
892 | networkn=56
|
---|
893 | while test $inst -ne 1; do
|
---|
894 | echo "192.168.$networkn.0 255.255.255.0" >> $nmaskbackupfile
|
---|
895 | inst=`expr $inst + 1`
|
---|
896 | networkn=`expr $networkn + 1`
|
---|
897 | done
|
---|
898 | echo "#VirtualBox_SectionEnd" >> $nmaskbackupfile
|
---|
899 | mv -f $nmaskbackupfile $nmaskfile
|
---|
900 |
|
---|
901 | # Recreate /etc/netmasks as a link if necessary
|
---|
902 | if test $recreatelink -eq 1; then
|
---|
903 | cp -f "$PKG_INSTALL_ROOT/etc/netmasks" "$PKG_INSTALL_ROOT/etc/inet/netmasks"
|
---|
904 | ln -sf ./inet/netmasks "$PKG_INSTALL_ROOT/etc/netmasks"
|
---|
905 | elif test $recreatelink -eq 2; then
|
---|
906 | warnprint "/etc/netmasks is a symlink (to /etc/inet/netmasks) that older"
|
---|
907 | warnprint "VirtualBox installers incorrectly overwrote. Now the contents"
|
---|
908 | warnprint "of /etc/netmasks and /etc/inet/netmasks differ, therefore "
|
---|
909 | warnprint "VirtualBox will not attempt to overwrite /etc/netmasks as a"
|
---|
910 | warnprint "symlink to /etc/inet/netmasks. Please resolve this manually."
|
---|
911 | fi
|
---|
912 | fi
|
---|
913 | else
|
---|
914 | # Should this be fatal?
|
---|
915 | warnprint "Failed to bring up vboxnet0!!"
|
---|
916 | fi
|
---|
917 | fi
|
---|
918 | fi
|
---|
919 |
|
---|
920 | if test -f "$PKG_INSTALL_ROOT/var/svc/manifest/application/virtualbox/virtualbox-webservice.xml" || test -f "$PKG_INSTALL_ROOT/var/svc/manifest/application/virtualbox/virtualbox-zoneaccess.xml"; then
|
---|
921 | infoprint "Configuring services..."
|
---|
922 | if test "$REMOTEINST" -eq 1; then
|
---|
923 | subprint "Skipped for targetted installs."
|
---|
924 | else
|
---|
925 | # Enable Zone access service for non-remote installs, other services (Webservice) are delivered disabled by the manifest class action
|
---|
926 | servicefound=`$BIN_SVCS -a | grep "virtualbox/zoneaccess" | grep "disabled" 2>/dev/null`
|
---|
927 | if test ! -z "$servicefound"; then
|
---|
928 | /usr/sbin/svcadm enable -s svc:/application/virtualbox/zoneaccess
|
---|
929 | if test "$?" -eq 0; then
|
---|
930 | subprint "Loaded: Zone access service"
|
---|
931 | else
|
---|
932 | subprint "Loading Zone access service ...FAILED."
|
---|
933 | fi
|
---|
934 | fi
|
---|
935 | fi
|
---|
936 | fi
|
---|
937 |
|
---|
938 | # Update mime and desktop databases to get the right menu entries
|
---|
939 | # and icons. There is still some delay until the GUI picks it up,
|
---|
940 | # but that cannot be helped.
|
---|
941 | if test -d "$PKG_INSTALL_ROOT/usr/share/icons"; then
|
---|
942 | infoprint "Installing MIME types and icons..."
|
---|
943 | if test "$REMOTEINST" -eq 0; then
|
---|
944 | /usr/bin/update-mime-database /usr/share/mime >/dev/null 2>&1
|
---|
945 | /usr/bin/update-desktop-database -q 2>/dev/null
|
---|
946 | else
|
---|
947 | subprint "Skipped for targetted installs."
|
---|
948 | fi
|
---|
949 | fi
|
---|
950 |
|
---|
951 | # Install python bindings for non-remote installs
|
---|
952 | if test "$REMOTEINST" -eq 0; then
|
---|
953 | if test -f "$DIR_VBOXBASE/sdk/installer/vboxapisetup.py" || test -h "$DIR_VBOXBASE/sdk/installer/vboxapisetup.py"; then
|
---|
954 | PYTHONBIN=`which python 2> /dev/null`
|
---|
955 | if test -f "$PYTHONBIN" || test -h "$PYTHONBIN"; then
|
---|
956 | infoprint "Installing Python bindings..."
|
---|
957 |
|
---|
958 | INSTALLEDIT=1
|
---|
959 | PYTHONBIN=`which python2.4 2>/dev/null`
|
---|
960 | install_python_bindings "$PYTHONBIN" "Python 2.4"
|
---|
961 | if test "$?" -eq 0; then
|
---|
962 | INSTALLEDIT=0
|
---|
963 | fi
|
---|
964 | PYTHONBIN=`which python2.5 2>/dev/null`
|
---|
965 | install_python_bindings "$PYTHONBIN" "Python 2.5"
|
---|
966 | if test "$?" -eq 0; then
|
---|
967 | INSTALLEDIT=0
|
---|
968 | fi
|
---|
969 | PYTHONBIN=`which python2.6 2>/dev/null`
|
---|
970 | install_python_bindings "$PYTHONBIN" "Python 2.6"
|
---|
971 | if test "$?" -eq 0; then
|
---|
972 | INSTALLEDIT=0
|
---|
973 | fi
|
---|
974 |
|
---|
975 | # remove files installed by Python build
|
---|
976 | rm -rf $DIR_VBOXBASE/sdk/installer/build
|
---|
977 |
|
---|
978 | if test "$INSTALLEDIT" -ne 0; then
|
---|
979 | warnprint "No suitable Python version found. Required Python 2.4, 2.5 or 2.6."
|
---|
980 | warnprint "Skipped installing the Python bindings."
|
---|
981 | fi
|
---|
982 | else
|
---|
983 | warnprint "Python not found, skipped installed Python bindings."
|
---|
984 | fi
|
---|
985 | fi
|
---|
986 | else
|
---|
987 | warnprint "Skipped installing Python bindings. Run, as root, 'vboxapisetup.py install' manually from the booted system."
|
---|
988 | fi
|
---|
989 |
|
---|
990 | update_boot_archive
|
---|
991 |
|
---|
992 | return 0
|
---|
993 | else
|
---|
994 | errorprint "Failed to install drivers"
|
---|
995 | exit 666
|
---|
996 | fi
|
---|
997 | return 1
|
---|
998 | }
|
---|
999 |
|
---|
1000 | # preremove([fatal])
|
---|
1001 | # failure: depends on [fatal]
|
---|
1002 | preremove()
|
---|
1003 | {
|
---|
1004 | fatal=$1
|
---|
1005 |
|
---|
1006 | cleanup_install "$fatal"
|
---|
1007 |
|
---|
1008 | remove_drivers "$fatal"
|
---|
1009 | if test "$?" -eq 0; then
|
---|
1010 | return 0;
|
---|
1011 | fi
|
---|
1012 | return 1
|
---|
1013 | }
|
---|
1014 |
|
---|
1015 |
|
---|
1016 |
|
---|
1017 | # And it begins...
|
---|
1018 | find_bins
|
---|
1019 | check_root
|
---|
1020 | check_isa
|
---|
1021 | check_zone
|
---|
1022 | get_sysinfo
|
---|
1023 |
|
---|
1024 | if test "x${PKG_INSTALL_ROOT:=/}" != "x/"; then
|
---|
1025 | BASEDIR_OPT="-b $PKG_INSTALL_ROOT"
|
---|
1026 | REMOTEINST=1
|
---|
1027 | fi
|
---|
1028 |
|
---|
1029 | # Get command line options
|
---|
1030 | while test $# -gt 0;
|
---|
1031 | do
|
---|
1032 | case "$1" in
|
---|
1033 | --postinstall | --preremove | --installdrivers | --removedrivers | --setupdrivers)
|
---|
1034 | drvop="$1"
|
---|
1035 | ;;
|
---|
1036 | --fatal)
|
---|
1037 | fatal="$FATALOP"
|
---|
1038 | ;;
|
---|
1039 | --silent)
|
---|
1040 | ISSILENT="$SILENTOP"
|
---|
1041 | ;;
|
---|
1042 | --ips)
|
---|
1043 | ISIPS="$IPSOP"
|
---|
1044 | ;;
|
---|
1045 | --altkerndir)
|
---|
1046 | # Use alternate kernel driver config folder (dev only)
|
---|
1047 | DIR_CONF="/usr/kernel/drv"
|
---|
1048 | ;;
|
---|
1049 | --help)
|
---|
1050 | printusage
|
---|
1051 | exit 1
|
---|
1052 | ;;
|
---|
1053 | *)
|
---|
1054 | break
|
---|
1055 | ;;
|
---|
1056 | esac
|
---|
1057 | shift
|
---|
1058 | done
|
---|
1059 |
|
---|
1060 | case "$drvop" in
|
---|
1061 | --postinstall)
|
---|
1062 | check_module_arch
|
---|
1063 | postinstall
|
---|
1064 | ;;
|
---|
1065 | --preremove)
|
---|
1066 | preremove "$fatal"
|
---|
1067 | ;;
|
---|
1068 | --installdrivers)
|
---|
1069 | check_module_arch
|
---|
1070 | install_drivers
|
---|
1071 | ;;
|
---|
1072 | --removedrivers)
|
---|
1073 | remove_drivers "$fatal"
|
---|
1074 | ;;
|
---|
1075 | --setupdrivers)
|
---|
1076 | remove_drivers "$fatal"
|
---|
1077 | infoprint "Installing VirtualBox drivers:"
|
---|
1078 | install_drivers
|
---|
1079 | ;;
|
---|
1080 | *)
|
---|
1081 | printusage
|
---|
1082 | exit 1
|
---|
1083 | esac
|
---|
1084 |
|
---|
1085 | exit "$?"
|
---|
1086 |
|
---|