1 | #!/bin/sh
|
---|
2 | # $Id: vboxconfig.sh 72294 2018-05-23 11:17:08Z vboxsync $
|
---|
3 | ## @file
|
---|
4 | # VirtualBox Configuration Script, Solaris host.
|
---|
5 | #
|
---|
6 |
|
---|
7 | #
|
---|
8 | # Copyright (C) 2009-2017 Oracle Corporation
|
---|
9 | #
|
---|
10 | # This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
11 | # available from http://www.virtualbox.org. This file is free software;
|
---|
12 | # you can redistribute it and/or modify it under the terms of the GNU
|
---|
13 | # General Public License (GPL) as published by the Free Software
|
---|
14 | # Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
15 | # VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
16 | # hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
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 | # LC_ALL should take precedence over LC_* and LANG but whatever...
|
---|
23 | LC_ALL=C
|
---|
24 | export LC_ALL
|
---|
25 |
|
---|
26 | LANG=C
|
---|
27 | export LANG
|
---|
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_SVCS=/usr/bin/svcs
|
---|
45 | BIN_IFCONFIG=/sbin/ifconfig
|
---|
46 | BIN_SVCS=/usr/bin/svcs
|
---|
47 | BIN_ID=/usr/bin/id
|
---|
48 | BIN_PKILL=/usr/bin/pkill
|
---|
49 | BIN_PGREP=/usr/bin/pgrep
|
---|
50 | BIN_IPADM=/usr/sbin/ipadm
|
---|
51 |
|
---|
52 | # "vboxdrv" is also used in sed lines here (change those as well if it ever changes)
|
---|
53 | MOD_VBOXDRV=vboxdrv
|
---|
54 | DESC_VBOXDRV="Host"
|
---|
55 |
|
---|
56 | MOD_VBOXNET=vboxnet
|
---|
57 | DESC_VBOXNET="NetAdapter"
|
---|
58 | MOD_VBOXNET_INST=8
|
---|
59 |
|
---|
60 | MOD_VBOXFLT=vboxflt
|
---|
61 | DESC_VBOXFLT="NetFilter (STREAMS)"
|
---|
62 |
|
---|
63 | MOD_VBOXBOW=vboxbow
|
---|
64 | DESC_VBOXBOW="NetFilter (Crossbow)"
|
---|
65 |
|
---|
66 | MOD_VBOXUSBMON=vboxusbmon
|
---|
67 | DESC_VBOXUSBMON="USBMonitor"
|
---|
68 |
|
---|
69 | MOD_VBOXUSB=vboxusb
|
---|
70 | DESC_VBOXUSB="USB"
|
---|
71 |
|
---|
72 | UPDATEBOOTARCHIVE=0
|
---|
73 | REMOTEINST=0
|
---|
74 | FATALOP=fatal
|
---|
75 | NULLOP=nulloutput
|
---|
76 | SILENTOP=silent
|
---|
77 | IPSOP=ips
|
---|
78 | ISSILENT=
|
---|
79 | ISIPS=
|
---|
80 |
|
---|
81 | infoprint()
|
---|
82 | {
|
---|
83 | if test "x$ISSILENT" != "x$SILENTOP"; then
|
---|
84 | echo 1>&2 "$1"
|
---|
85 | fi
|
---|
86 | }
|
---|
87 |
|
---|
88 | subprint()
|
---|
89 | {
|
---|
90 | if test "x$ISSILENT" != "x$SILENTOP"; then
|
---|
91 | echo 1>&2 " - $1"
|
---|
92 | fi
|
---|
93 | }
|
---|
94 |
|
---|
95 | warnprint()
|
---|
96 | {
|
---|
97 | if test "x$ISSILENT" != "x$SILENTOP"; then
|
---|
98 | echo 1>&2 " * Warning!! $1"
|
---|
99 | fi
|
---|
100 | }
|
---|
101 |
|
---|
102 | errorprint()
|
---|
103 | {
|
---|
104 | echo 1>&2 "## $1"
|
---|
105 | }
|
---|
106 |
|
---|
107 | helpprint()
|
---|
108 | {
|
---|
109 | echo 1>&2 "$1"
|
---|
110 | }
|
---|
111 |
|
---|
112 | printusage()
|
---|
113 | {
|
---|
114 | helpprint "VirtualBox Configuration Script"
|
---|
115 | helpprint "usage: $0 <operation> [options]"
|
---|
116 | helpprint
|
---|
117 | helpprint "<operation> must be one of the following:"
|
---|
118 | helpprint " --postinstall Perform full post installation procedure"
|
---|
119 | helpprint " --preremove Perform full pre remove procedure"
|
---|
120 | helpprint " --installdrivers Only install the drivers"
|
---|
121 | helpprint " --removedrivers Only remove the drivers"
|
---|
122 | helpprint " --setupdrivers Setup drivers, reloads existing drivers"
|
---|
123 | helpprint
|
---|
124 | helpprint "[options] are one or more of the following:"
|
---|
125 | helpprint " --silent Silent mode"
|
---|
126 | helpprint " --fatal Don't continue on failure (required for postinstall)"
|
---|
127 | helpprint " --ips This is an IPS package postinstall/preremove"
|
---|
128 | helpprint " --altkerndir Use /usr/kernel/drv as the driver directory"
|
---|
129 | helpprint
|
---|
130 | }
|
---|
131 |
|
---|
132 | # find_bin_path()
|
---|
133 | # !! failure is always fatal
|
---|
134 | find_bin_path()
|
---|
135 | {
|
---|
136 | if test -z "$1"; then
|
---|
137 | errorprint "missing argument to find_bin_path()"
|
---|
138 | exit 1
|
---|
139 | fi
|
---|
140 |
|
---|
141 | binfilename=`basename $1`
|
---|
142 | binfilepath=`which $binfilename 2> /dev/null`
|
---|
143 | if test -x "$binfilepath"; then
|
---|
144 | echo "$binfilepath"
|
---|
145 | return 0
|
---|
146 | else
|
---|
147 | errorprint "$1 missing or is not an executable"
|
---|
148 | exit 1
|
---|
149 | fi
|
---|
150 | }
|
---|
151 |
|
---|
152 | # find_bins()
|
---|
153 | # !! failure is always fatal
|
---|
154 | find_bins()
|
---|
155 | {
|
---|
156 | # Search only for binaries that might be in different locations
|
---|
157 | if test ! -x "$BIN_ID"; then
|
---|
158 | BIN_ID=`find_bin_path "$BIN_ID"`
|
---|
159 | fi
|
---|
160 |
|
---|
161 | if test ! -x "$BIN_ADDDRV"; then
|
---|
162 | BIN_ADDDRV=`find_bin_path "$BIN_ADDDRV"`
|
---|
163 | fi
|
---|
164 |
|
---|
165 | if test ! -x "$BIN_REMDRV"; then
|
---|
166 | BIN_REMDRV=`find_bin_path "$BIN_REMDRV"`
|
---|
167 | fi
|
---|
168 |
|
---|
169 | if test ! -x "$BIN_MODLOAD"; then
|
---|
170 | BIN_MODLOAD=`check_bin_path "$BIN_MODLOAD"`
|
---|
171 | fi
|
---|
172 |
|
---|
173 | if test ! -x "$BIN_MODUNLOAD"; then
|
---|
174 | BIN_MODUNLOAD=`find_bin_path "$BIN_MODUNLOAD"`
|
---|
175 | fi
|
---|
176 |
|
---|
177 | if test ! -x "$BIN_MODINFO"; then
|
---|
178 | BIN_MODINFO=`find_bin_path "$BIN_MODINFO"`
|
---|
179 | fi
|
---|
180 |
|
---|
181 | if test ! -x "$BIN_DEVFSADM"; then
|
---|
182 | BIN_DEVFSADM=`find_bin_path "$BIN_DEVFSADM"`
|
---|
183 | fi
|
---|
184 |
|
---|
185 | if test ! -x "$BIN_BOOTADM"; then
|
---|
186 | BIN_BOOTADM=`find_bin_path "$BIN_BOOTADM"`
|
---|
187 | fi
|
---|
188 |
|
---|
189 | if test ! -x "$BIN_SVCADM"; then
|
---|
190 | BIN_SVCADM=`find_bin_path "$BIN_SVCADM"`
|
---|
191 | fi
|
---|
192 |
|
---|
193 | if test ! -x "$BIN_SVCCFG"; then
|
---|
194 | BIN_SVCCFG=`find_bin_path "$BIN_SVCCFG"`
|
---|
195 | fi
|
---|
196 |
|
---|
197 | if test ! -x "$BIN_SVCS"; then
|
---|
198 | BIN_SVCS=`find_bin_path "$BIN_SVCS"`
|
---|
199 | fi
|
---|
200 |
|
---|
201 | if test ! -x "$BIN_IFCONFIG"; then
|
---|
202 | BIN_IFCONFIG=`find_bin_path "$BIN_IFCONFIG"`
|
---|
203 | fi
|
---|
204 |
|
---|
205 | if test ! -x "$BIN_PKILL"; then
|
---|
206 | BIN_PKILL=`find_bin_path "$BIN_PKILL"`
|
---|
207 | fi
|
---|
208 |
|
---|
209 | if test ! -x "$BIN_PGREP"; then
|
---|
210 | BIN_PGREP=`find_bin_path "$BIN_PGREP"`
|
---|
211 | fi
|
---|
212 |
|
---|
213 | if test ! -x "$BIN_IPADM"; then
|
---|
214 | BIN_IPADM=`find_bin_path "$BIN_IPADM"`
|
---|
215 | fi
|
---|
216 | }
|
---|
217 |
|
---|
218 | # check_root()
|
---|
219 | # !! failure is always fatal
|
---|
220 | check_root()
|
---|
221 | {
|
---|
222 | # Don't use "-u" option as some id binaries don't support it, instead
|
---|
223 | # rely on "uid=101(username) gid=10(groupname) groups=10(staff)" output
|
---|
224 | curuid=`$BIN_ID | cut -f 2 -d '=' | cut -f 1 -d '('`
|
---|
225 | if test "$curuid" -ne 0; then
|
---|
226 | errorprint "This script must be run with administrator privileges."
|
---|
227 | exit 1
|
---|
228 | fi
|
---|
229 | }
|
---|
230 |
|
---|
231 | # get_unofficial_sysinfo()
|
---|
232 | # cannot fail
|
---|
233 | get_unofficial_sysinfo()
|
---|
234 | {
|
---|
235 | HOST_OS_MAJORVERSION="11"
|
---|
236 | HOST_OS_MINORVERSION="151"
|
---|
237 | }
|
---|
238 |
|
---|
239 | # get_s11_4_or_newer_sysinfo()
|
---|
240 | # cannot fail
|
---|
241 | get_s11_4_or_newer_sysinfo()
|
---|
242 | {
|
---|
243 | # See check in plumb_net for why this is > 174. The alternative is we declare 11.4+ as S12 with
|
---|
244 | # a more accurate minor (build) version number. For now this is sufficient to workaround the ever
|
---|
245 | # changing version numbering policy.
|
---|
246 | HOST_OS_MAJORVERSION="11"
|
---|
247 | HOST_OS_MINORVERSION="175"
|
---|
248 | }
|
---|
249 |
|
---|
250 | # get_sysinfo()
|
---|
251 | # cannot fail
|
---|
252 | get_sysinfo()
|
---|
253 | {
|
---|
254 | STR_OSVER=`uname -v`
|
---|
255 | case "$STR_OSVER" in
|
---|
256 | # First check 'uname -v' and weed out the recognized, unofficial distros of Solaris
|
---|
257 | omnios*|oi_*|illumos*)
|
---|
258 | get_unofficial_sysinfo
|
---|
259 | return 0
|
---|
260 | ;;
|
---|
261 | # Quick escape workaround for Solaris 11.4+, changes the pkg FMRI (yet again). See BugDB #26494983.
|
---|
262 | 11.4.* | 11.5.*)
|
---|
263 | get_s11_4_or_newer_sysinfo
|
---|
264 | return 0
|
---|
265 | esac
|
---|
266 |
|
---|
267 | BIN_PKG=`which pkg 2> /dev/null`
|
---|
268 | if test -x "$BIN_PKG"; then
|
---|
269 | PKGFMRI=`$BIN_PKG $BASEDIR_PKGOPT contents -H -t set -a name=pkg.fmri -o pkg.fmri pkg:/system/kernel 2> /dev/null`
|
---|
270 | if test -z "$PKGFMRI"; then
|
---|
271 | # Perhaps this is old pkg without '-a' option and/or system/kernel is missing and it's part of 'entire'
|
---|
272 | # Try fallback.
|
---|
273 | PKGFMRI=`$BIN_PKG $BASEDIR_PKGOPT contents -H -t set -o pkg.fmri entire | head -1 2> /dev/null`
|
---|
274 | if test -z "$PKGFMRI"; then
|
---|
275 | # Perhaps entire is conflicting. Try using opensolaris/entire.
|
---|
276 | # Last fallback try.
|
---|
277 | PKGFMRI=`$BIN_PKG $BASEDIR_PKGOPT contents -H -t set -o pkg.fmri opensolaris.org/entire | head -1 2> /dev/null`
|
---|
278 | fi
|
---|
279 | fi
|
---|
280 | if test ! -z "$PKGFMRI"; then
|
---|
281 | # The format is "pkg://solaris/system/kernel@0.5.11,5.11-0.161:20110315T070332Z"
|
---|
282 | # or "pkg://solaris/system/kernel@5.12,5.11-5.12.0.0.0.4.1:20120908T030246Z"
|
---|
283 | # or "pkg://solaris/system/kernel@0.5.11,5.11-0.175.0.0.0.1.0:20111012T032837Z"
|
---|
284 | # or "pkg://solaris/system/kernel@5.12-5.12.0.0.0.9.1.3.0:20121012T032837Z" [1]
|
---|
285 | # [1]: The sed below doesn't handle this. It's instead parsed below in the PSARC/2012/240 case.
|
---|
286 | STR_KERN_MAJOR=`echo "$PKGFMRI" | sed 's/^.*\@//;s/\,.*//'`
|
---|
287 | if test ! -z "$STR_KERN_MAJOR"; then
|
---|
288 | # The format is "0.5.11" or "5.12"
|
---|
289 | # Let us just hardcode these for now, instead of trying to do things more generically. It's not
|
---|
290 | # worth trying to bring more order to chaos as it's clear that the version numbering is subject to breakage
|
---|
291 | # as it has been seen in the past.
|
---|
292 | if test "x$STR_KERN_MAJOR" = "x5.12"; then
|
---|
293 | HOST_OS_MAJORVERSION="12"
|
---|
294 | elif test "x$STR_KERN_MAJOR" = "x0.5.11" || test "x$STR_KERN_MAJOR" = "x5.11"; then
|
---|
295 | HOST_OS_MAJORVERSION="11"
|
---|
296 | else
|
---|
297 | # This could be the PSARC/2012/240 naming scheme for S12.
|
---|
298 | # The format is "pkg://solaris/system/kernel@5.12-5.12.0.0.0.9.1.3.0:20121012T032837Z"
|
---|
299 | # The "5.12" following the "@" is the nominal version which we ignore for now as it is
|
---|
300 | # not set by most pkg(5) tools...
|
---|
301 | # STR_KERN_MAJOR is now of the format "5.12-5.12.0.0.0.9.1.3.0:20121012T032837Z" with '9' representing
|
---|
302 | # the build number.
|
---|
303 | BRANCH_VERSION=$STR_KERN_MAJOR
|
---|
304 | HOST_OS_MAJORVERSION=`echo "$BRANCH_VERSION" | cut -f2 -d'-' | cut -f1,2 -d'.'`
|
---|
305 | if test "x$HOST_OS_MAJORVERSION" = "x5.12"; then
|
---|
306 | HOST_OS_MAJORVERSION="12"
|
---|
307 | HOST_OS_MINORVERSION=`echo "$BRANCH_VERSION" | cut -f2 -d'-' | cut -f6 -d'.'`
|
---|
308 | return 0
|
---|
309 | else
|
---|
310 | errorprint "Failed to parse the Solaris kernel major version."
|
---|
311 | exit 1
|
---|
312 | fi
|
---|
313 | fi
|
---|
314 |
|
---|
315 | # This applies only to S11 and S12 where the transitional "@5.12," component version is
|
---|
316 | # still part of the pkg(5) package FMRI. The regular S12 will follow the PSARC/2012/240 naming scheme above.
|
---|
317 | STR_KERN_MINOR=`echo "$PKGFMRI" | sed 's/^.*\@//;s/\:.*//;s/.*,//'`
|
---|
318 | if test ! -z "$STR_KERN_MINOR"; then
|
---|
319 | # The HOST_OS_MINORVERSION is represented as follows:
|
---|
320 | # For S12 it represents the build numbers. e.g. for 4 : "5.11-5.12.0.0.0.4.1"
|
---|
321 | # For S11 as the "nevada" version numbers. e.g. for 175: "5.11-0.161" or "5.11-0.175.0.0.0.1.0"
|
---|
322 | if test "$HOST_OS_MAJORVERSION" -eq 12; then
|
---|
323 | HOST_OS_MINORVERSION=`echo "$STR_KERN_MINOR" | cut -f2 -d'-' | cut -f6 -d'.'`
|
---|
324 | elif test "$HOST_OS_MAJORVERSION" -eq 11; then
|
---|
325 | HOST_OS_MINORVERSION=`echo "$STR_KERN_MINOR" | cut -f2 -d'-' | cut -f2 -d'.'`
|
---|
326 | else
|
---|
327 | errorprint "Solaris kernel major version $HOST_OS_MAJORVERSION not supported."
|
---|
328 | exit 1
|
---|
329 | fi
|
---|
330 | else
|
---|
331 | errorprint "Failed to parse the Solaris kernel minor version."
|
---|
332 | exit 1
|
---|
333 | fi
|
---|
334 | else
|
---|
335 | errorprint "Failed to parse the Solaris kernel package version."
|
---|
336 | exit 1
|
---|
337 | fi
|
---|
338 | else
|
---|
339 | errorprint "Failed to detect the Solaris kernel package FMRI."
|
---|
340 | exit 1
|
---|
341 | fi
|
---|
342 | else
|
---|
343 | HOST_OS_MAJORVERSION=`uname -r`
|
---|
344 | if test -z "$HOST_OS_MAJORVERSION" || test "x$HOST_OS_MAJORVERSION" != "x5.10"; then
|
---|
345 | # S11 without 'pkg'?? Something's wrong... bail.
|
---|
346 | errorprint "Solaris $HOST_OS_MAJORVERSION detected without executable $BIN_PKG !? I are confused."
|
---|
347 | exit 1
|
---|
348 | fi
|
---|
349 | HOST_OS_MAJORVERSION="10"
|
---|
350 | if test "$REMOTEINST" -eq 0; then
|
---|
351 | # Use uname to verify it's S10.
|
---|
352 | # Major version is S10, Minor version is no longer relevant (or used), use uname -v so it gets something
|
---|
353 | # like "Generic_blah" for purely cosmetic purposes
|
---|
354 | HOST_OS_MINORVERSION=`uname -v`
|
---|
355 | else
|
---|
356 | # Remote installs from S10 local.
|
---|
357 | BIN_PKGCHK=`which pkgchk 2> /dev/null`
|
---|
358 | if test ! -x "$BIN_PKGCHK"; then
|
---|
359 | errorprint "Failed to find an executable pkgchk binary $BIN_PKGCHK."
|
---|
360 | errorprint "Cannot determine Solaris version on remote target $PKG_INSTALL_ROOT"
|
---|
361 | exit 1
|
---|
362 | fi
|
---|
363 |
|
---|
364 | REMOTE_S10=`$BIN_PKGCHK -l -p /kernel/amd64/genunix $BASEDIR_PKGOPT 2> /dev/null | grep SUNWckr | tr -d ' \t'`
|
---|
365 | if test ! -z "$REMOTE_S10" && test "x$REMOTE_S10" = "xSUNWckr"; then
|
---|
366 | HOST_OS_MAJORVERSION="10"
|
---|
367 | HOST_OS_MINORVERSION=""
|
---|
368 | else
|
---|
369 | errorprint "Remote target $PKG_INSTALL_ROOT is not Solaris 10."
|
---|
370 | errorprint "Will not attempt to install to an unidentified remote target."
|
---|
371 | exit 1
|
---|
372 | fi
|
---|
373 | fi
|
---|
374 | fi
|
---|
375 | }
|
---|
376 |
|
---|
377 | # check_zone()
|
---|
378 | # !! failure is always fatal
|
---|
379 | check_zone()
|
---|
380 | {
|
---|
381 | currentzone=`zonename`
|
---|
382 | if test "x$currentzone" != "xglobal"; then
|
---|
383 | errorprint "This script must be run from the global zone."
|
---|
384 | exit 1
|
---|
385 | fi
|
---|
386 | }
|
---|
387 |
|
---|
388 | # check_isa()
|
---|
389 | # !! failure is always fatal
|
---|
390 | check_isa()
|
---|
391 | {
|
---|
392 | currentisa=`uname -i`
|
---|
393 | if test "x$currentisa" = "xi86xpv"; then
|
---|
394 | errorprint "VirtualBox cannot run under xVM Dom0! Fatal Error, Aborting installation!"
|
---|
395 | exit 1
|
---|
396 | fi
|
---|
397 | }
|
---|
398 |
|
---|
399 | # check_module_arch()
|
---|
400 | # !! failure is always fatal
|
---|
401 | check_module_arch()
|
---|
402 | {
|
---|
403 | cputype=`isainfo -k`
|
---|
404 | if test "x$cputype" != "xamd64" && test "x$cputype" != "xi386"; then
|
---|
405 | errorprint "VirtualBox works only on i386/amd64 hosts, not $cputype"
|
---|
406 | exit 1
|
---|
407 | fi
|
---|
408 | }
|
---|
409 |
|
---|
410 | # update_boot_archive()
|
---|
411 | # cannot fail
|
---|
412 | update_boot_archive()
|
---|
413 | {
|
---|
414 | infoprint "Updating the boot archive..."
|
---|
415 | if test "$REMOTEINST" -eq 0; then
|
---|
416 | $BIN_BOOTADM update-archive > /dev/null
|
---|
417 | else
|
---|
418 | $BIN_BOOTADM update-archive -R "$PKG_INSTALL_ROOT" > /dev/null
|
---|
419 | fi
|
---|
420 | UPDATEBOOTARCHIVE=0
|
---|
421 | }
|
---|
422 |
|
---|
423 |
|
---|
424 | # module_added(modname)
|
---|
425 | # returns 1 if added, 0 otherwise
|
---|
426 | module_added()
|
---|
427 | {
|
---|
428 | if test -z "$1"; then
|
---|
429 | errorprint "missing argument to module_added()"
|
---|
430 | exit 1
|
---|
431 | fi
|
---|
432 |
|
---|
433 | # Add a space at end of module name to make sure we have a perfect match to avoid
|
---|
434 | # any substring matches: e.g "vboxusb" & "vboxusbmon"
|
---|
435 | loadentry=`cat "$PKG_INSTALL_ROOT/etc/name_to_major" | grep "$1 "`
|
---|
436 | if test -z "$loadentry"; then
|
---|
437 | return 1
|
---|
438 | fi
|
---|
439 | return 0
|
---|
440 | }
|
---|
441 |
|
---|
442 | # module_loaded(modname)
|
---|
443 | # returns 1 if loaded, 0 otherwise
|
---|
444 | module_loaded()
|
---|
445 | {
|
---|
446 | if test -z "$1"; then
|
---|
447 | errorprint "missing argument to module_loaded()"
|
---|
448 | exit 1
|
---|
449 | fi
|
---|
450 |
|
---|
451 | modname=$1
|
---|
452 | # modinfo should now work properly since we prevent module autounloading.
|
---|
453 | loadentry=`$BIN_MODINFO | grep "$modname "`
|
---|
454 | if test -z "$loadentry"; then
|
---|
455 | return 1
|
---|
456 | fi
|
---|
457 | return 0
|
---|
458 | }
|
---|
459 |
|
---|
460 | # add_driver(modname, moddesc, fatal, nulloutput, [driverperm])
|
---|
461 | # failure: depends on "fatal"
|
---|
462 | add_driver()
|
---|
463 | {
|
---|
464 | if test -z "$1" || test -z "$2"; then
|
---|
465 | errorprint "missing argument to add_driver()"
|
---|
466 | exit 1
|
---|
467 | fi
|
---|
468 |
|
---|
469 | modname="$1"
|
---|
470 | moddesc="$2"
|
---|
471 | fatal="$3"
|
---|
472 | nullop="$4"
|
---|
473 | modperm="$5"
|
---|
474 |
|
---|
475 | if test -n "$modperm"; then
|
---|
476 | if test "x$nullop" = "x$NULLOP"; then
|
---|
477 | $BIN_ADDDRV $BASEDIR_OPT -m"$modperm" $modname >/dev/null 2>&1
|
---|
478 | else
|
---|
479 | $BIN_ADDDRV $BASEDIR_OPT -m"$modperm" $modname
|
---|
480 | fi
|
---|
481 | else
|
---|
482 | if test "x$nullop" = "x$NULLOP"; then
|
---|
483 | $BIN_ADDDRV $BASEDIR_OPT $modname >/dev/null 2>&1
|
---|
484 | else
|
---|
485 | $BIN_ADDDRV $BASEDIR_OPT $modname
|
---|
486 | fi
|
---|
487 | fi
|
---|
488 |
|
---|
489 | if test "$?" -ne 0; then
|
---|
490 | subprint "Adding: $moddesc module ...FAILED!"
|
---|
491 | if test "x$fatal" = "x$FATALOP"; then
|
---|
492 | exit 1
|
---|
493 | fi
|
---|
494 | return 1
|
---|
495 | fi
|
---|
496 | subprint "Added: $moddesc driver"
|
---|
497 | return 0
|
---|
498 | }
|
---|
499 |
|
---|
500 | # rem_driver(modname, moddesc, [fatal])
|
---|
501 | # failure: depends on [fatal]
|
---|
502 | rem_driver()
|
---|
503 | {
|
---|
504 | if test -z "$1" || test -z "$2"; then
|
---|
505 | errorprint "missing argument to rem_driver()"
|
---|
506 | exit 1
|
---|
507 | fi
|
---|
508 |
|
---|
509 | modname=$1
|
---|
510 | moddesc=$2
|
---|
511 | fatal=$3
|
---|
512 |
|
---|
513 | module_added $modname
|
---|
514 | if test "$?" -eq 0; then
|
---|
515 | UPDATEBOOTARCHIVE=1
|
---|
516 | if test "x$ISIPS" != "x$IPSOP"; then
|
---|
517 | $BIN_REMDRV $BASEDIR_OPT $modname
|
---|
518 | else
|
---|
519 | $BIN_REMDRV $BASEDIR_OPT $modname >/dev/null 2>&1
|
---|
520 | fi
|
---|
521 | # for remote installs, don't bother with return values of rem_drv
|
---|
522 | if test "$?" -eq 0 || test "$REMOTEINST" -eq 1; then
|
---|
523 | subprint "Removed: $moddesc driver"
|
---|
524 | return 0
|
---|
525 | else
|
---|
526 | subprint "Removing: $moddesc ...FAILED!"
|
---|
527 | if test "x$fatal" = "x$FATALOP"; then
|
---|
528 | exit 1
|
---|
529 | fi
|
---|
530 | return 1
|
---|
531 | fi
|
---|
532 | fi
|
---|
533 | }
|
---|
534 |
|
---|
535 | # unload_module(modname, moddesc, retry, [fatal])
|
---|
536 | # failure: fatal
|
---|
537 | unload_module()
|
---|
538 | {
|
---|
539 | if test -z "$1" || test -z "$2"; then
|
---|
540 | errorprint "missing argument to unload_module()"
|
---|
541 | exit 1
|
---|
542 | fi
|
---|
543 |
|
---|
544 | # No-OP for non-root installs
|
---|
545 | if test "$REMOTEINST" -eq 1; then
|
---|
546 | return 0
|
---|
547 | fi
|
---|
548 |
|
---|
549 | modname=$1
|
---|
550 | moddesc=$2
|
---|
551 | retry=$3
|
---|
552 | fatal=$4
|
---|
553 | modid=`$BIN_MODINFO | grep "$modname " | cut -f 1 -d ' ' `
|
---|
554 | if test -n "$modid"; then
|
---|
555 | $BIN_MODUNLOAD -i $modid
|
---|
556 | if test "$?" -eq 0; then
|
---|
557 | subprint "Unloaded: $moddesc module"
|
---|
558 | else
|
---|
559 | #
|
---|
560 | # Hack for vboxdrv. Delayed removing when VMM thread-context hooks are used.
|
---|
561 | # Our automated tests are probably too quick... Fix properly later.
|
---|
562 | #
|
---|
563 | result="$?"
|
---|
564 | if test "$retry" -eq 1; then
|
---|
565 | cmax=15
|
---|
566 | cslept=0
|
---|
567 | while test "$result" -ne 0;
|
---|
568 | do
|
---|
569 | subprint "Unloading: $moddesc module ...FAILED! Busy? Retrying in 3 seconds..."
|
---|
570 | sleep 3
|
---|
571 | cslept=`expr $cslept + 3`
|
---|
572 | if test "$cslept" -ge "$cmax"; then
|
---|
573 | break
|
---|
574 | fi
|
---|
575 | $BIN_MODUNLOAD -i $modid
|
---|
576 | result="$?"
|
---|
577 | done
|
---|
578 | fi
|
---|
579 |
|
---|
580 | if test "$result" -ne 0; then
|
---|
581 | subprint "Unloading: $moddesc module ...FAILED!"
|
---|
582 | if test "x$fatal" = "x$FATALOP"; then
|
---|
583 | exit 1
|
---|
584 | fi
|
---|
585 | else
|
---|
586 | subprint "Unloaded: $moddesc module"
|
---|
587 | fi
|
---|
588 | return 1
|
---|
589 | fi
|
---|
590 | fi
|
---|
591 | return 0
|
---|
592 | }
|
---|
593 |
|
---|
594 | # load_module(modname, moddesc, [fatal])
|
---|
595 | # pass "drv/modname" or "misc/vbi" etc.
|
---|
596 | # failure: fatal
|
---|
597 | load_module()
|
---|
598 | {
|
---|
599 | if test -z "$1" || test -z "$2"; then
|
---|
600 | errorprint "missing argument to load_module()"
|
---|
601 | exit 1
|
---|
602 | fi
|
---|
603 |
|
---|
604 | # No-OP for non-root installs
|
---|
605 | if test "$REMOTEINST" -eq 1; then
|
---|
606 | return 0
|
---|
607 | fi
|
---|
608 |
|
---|
609 | modname=$1
|
---|
610 | moddesc=$2
|
---|
611 | fatal=$3
|
---|
612 | $BIN_MODLOAD -p $modname
|
---|
613 | if test "$?" -eq 0; then
|
---|
614 | return 0
|
---|
615 | else
|
---|
616 | subprint "Loading: $moddesc module ...FAILED!"
|
---|
617 | if test "x$fatal" = "x$FATALOP"; then
|
---|
618 | exit 1
|
---|
619 | fi
|
---|
620 | return 1
|
---|
621 | fi
|
---|
622 | }
|
---|
623 |
|
---|
624 | load_vboxflt()
|
---|
625 | {
|
---|
626 | if test -f "$DIR_CONF/vboxflt.conf"; then
|
---|
627 | add_driver "$MOD_VBOXFLT" "$DESC_VBOXFLT" "$FATALOP"
|
---|
628 | load_module "drv/$MOD_VBOXFLT" "$DESC_VBOXFLT" "$FATALOP"
|
---|
629 | else
|
---|
630 | # For custom pkgs that optionally ship this module, let's not fail but just warn
|
---|
631 | warnprint "$DESC_VBOXFLT installation requested but not shipped in this package."
|
---|
632 | fi
|
---|
633 | }
|
---|
634 |
|
---|
635 | load_vboxbow()
|
---|
636 | {
|
---|
637 | if test -f "$DIR_CONF/vboxbow.conf"; then
|
---|
638 | add_driver "$MOD_VBOXBOW" "$DESC_VBOXBOW" "$FATALOP"
|
---|
639 | load_module "drv/$MOD_VBOXBOW" "$DESC_VBOXBOW" "$FATALOP"
|
---|
640 | else
|
---|
641 | # For custom pkgs that optionally ship this module, let's not fail but just warn
|
---|
642 | warnprint "$DESC_VBOXBOW installation requested but not shipped in this package."
|
---|
643 | fi
|
---|
644 | }
|
---|
645 |
|
---|
646 | # install_drivers()
|
---|
647 | # !! failure is always fatal
|
---|
648 | install_drivers()
|
---|
649 | {
|
---|
650 | if test -f "$DIR_CONF/vboxdrv.conf"; then
|
---|
651 | if test -n "_HARDENED_"; then
|
---|
652 | add_driver "$MOD_VBOXDRV" "$DESC_VBOXDRV" "$FATALOP" "not-$NULLOP" "'* 0600 root sys','vboxdrvu 0666 root sys'"
|
---|
653 | else
|
---|
654 | add_driver "$MOD_VBOXDRV" "$DESC_VBOXDRV" "$FATALOP" "not-$NULLOP" "'* 0666 root sys','vboxdrvu 0666 root sys'"
|
---|
655 | fi
|
---|
656 | load_module "drv/$MOD_VBOXDRV" "$DESC_VBOXDRV" "$FATALOP"
|
---|
657 | else
|
---|
658 | errorprint "Extreme error! Missing $DIR_CONF/vboxdrv.conf, aborting."
|
---|
659 | return 1
|
---|
660 | fi
|
---|
661 |
|
---|
662 | ## Add vboxdrv to devlink.tab (KEEP TABS!)
|
---|
663 | if test -f "$PKG_INSTALL_ROOT/etc/devlink.tab"; then
|
---|
664 | sed -e '/name=vboxdrv/d' -e '/name=vboxdrvu/d' "$PKG_INSTALL_ROOT/etc/devlink.tab" > "$PKG_INSTALL_ROOT/etc/devlink.vbox"
|
---|
665 | echo "type=ddi_pseudo;name=vboxdrv;minor=vboxdrv \D" >> "$PKG_INSTALL_ROOT/etc/devlink.vbox"
|
---|
666 | echo "type=ddi_pseudo;name=vboxdrv;minor=vboxdrvu \M0" >> "$PKG_INSTALL_ROOT/etc/devlink.vbox"
|
---|
667 | mv -f "$PKG_INSTALL_ROOT/etc/devlink.vbox" "$PKG_INSTALL_ROOT/etc/devlink.tab"
|
---|
668 | else
|
---|
669 | errorprint "Missing $PKG_INSTALL_ROOT/etc/devlink.tab, aborting install"
|
---|
670 | return 1
|
---|
671 | fi
|
---|
672 |
|
---|
673 | # Create the device link for non-remote installs (not really relevant any more)
|
---|
674 | if test "$REMOTEINST" -eq 0; then
|
---|
675 | /usr/sbin/devfsadm -i "$MOD_VBOXDRV"
|
---|
676 | if test "$?" -ne 0 || test ! -h "/dev/vboxdrv" || test ! -h "/dev/vboxdrvu" ; then
|
---|
677 | errorprint "Failed to create device link for $MOD_VBOXDRV."
|
---|
678 | exit 1
|
---|
679 | fi
|
---|
680 | fi
|
---|
681 |
|
---|
682 | # Load VBoxNetAdp
|
---|
683 | if test -f "$DIR_CONF/vboxnet.conf"; then
|
---|
684 | add_driver "$MOD_VBOXNET" "$DESC_VBOXNET" "$FATALOP"
|
---|
685 | load_module "drv/$MOD_VBOXNET" "$DESC_VBOXNET" "$FATALOP"
|
---|
686 | fi
|
---|
687 |
|
---|
688 | # If both vboxinst_vboxbow and vboxinst_vboxflt exist, bail.
|
---|
689 | if test -f "$PKG_INSTALL_ROOT/etc/vboxinst_vboxflt" && test -f "$PKG_INSTALL_ROOT/etc/vboxinst_vboxbow"; then
|
---|
690 | errorprint "Force-install files '$PKG_INSTALL_ROOT/etc/vboxinst_vboxflt' and '$PKG_INSTALL_ROOT/etc/vboxinst_vboxbow' both exist."
|
---|
691 | errorprint "Cannot load $DESC_VBOXFLT and $DESC_VBOXBOW drivers at the same time."
|
---|
692 | return 1
|
---|
693 | fi
|
---|
694 |
|
---|
695 | # If the force-install files exists, install blindly
|
---|
696 | if test -f "$PKG_INSTALL_ROOT/etc/vboxinst_vboxflt"; then
|
---|
697 | subprint "Detected: Force-load file $PKG_INSTALL_ROOT/etc/vboxinst_vboxflt."
|
---|
698 | load_vboxflt
|
---|
699 | elif test -f "$PKG_INSTALL_ROOT/etc/vboxinst_vboxbow"; then
|
---|
700 | subprint "Detected: Force-load file $PKG_INSTALL_ROOT/etc/vboxinst_vboxbow."
|
---|
701 | load_vboxbow
|
---|
702 | else
|
---|
703 | # If host is S10 or S11 (< snv_159) or vboxbow isn't shipped, then load vboxflt
|
---|
704 | if test "$HOST_OS_MAJORVERSION" -eq 10 \
|
---|
705 | || (test "$HOST_OS_MAJORVERSION" -eq 11 && test "$HOST_OS_MINORVERSION" -lt 159) \
|
---|
706 | || test ! -f "$DIR_CONF/vboxbow.conf"; then
|
---|
707 | load_vboxflt
|
---|
708 | else
|
---|
709 | # For S11 snv_159+ load vboxbow
|
---|
710 | load_vboxbow
|
---|
711 | fi
|
---|
712 | fi
|
---|
713 |
|
---|
714 | # Load VBoxUSBMon, VBoxUSB
|
---|
715 | try_vboxusb="no"
|
---|
716 | if test -f "$DIR_CONF/vboxusbmon.conf"; then
|
---|
717 | if test -f "$PKG_INSTALL_ROOT/etc/vboxinst_vboxusb"; then
|
---|
718 | subprint "Detected: Force-load file $PKG_INSTALL_ROOT/etc/vboxinst_vboxusb."
|
---|
719 | try_vboxusb="yes"
|
---|
720 | else
|
---|
721 | # For VirtualBox 3.1 the new USB code requires Nevada > 123 i.e. S12+ or S11 b124+
|
---|
722 | if test "$HOST_OS_MAJORVERSION" -gt 11 \
|
---|
723 | || (test "$HOST_OS_MAJORVERSION" -eq 11 && test "$HOST_OS_MINORVERSION" -gt 123); then
|
---|
724 | try_vboxusb="yes"
|
---|
725 | else
|
---|
726 | warnprint "Solaris 11 build 124 or higher required for USB support. Skipped installing USB support."
|
---|
727 | fi
|
---|
728 | fi
|
---|
729 | fi
|
---|
730 | if test "x$try_vboxusb" = "xyes"; then
|
---|
731 | # Add a group "vboxuser" (8-character limit) for USB access.
|
---|
732 | # All users which need host USB-passthrough support will have to be added to this group.
|
---|
733 | groupadd vboxuser >/dev/null 2>&1
|
---|
734 |
|
---|
735 | add_driver "$MOD_VBOXUSBMON" "$DESC_VBOXUSBMON" "$FATALOP" "not-$NULLOP" "'* 0666 root sys'"
|
---|
736 | load_module "drv/$MOD_VBOXUSBMON" "$DESC_VBOXUSBMON" "$FATALOP"
|
---|
737 |
|
---|
738 | chown root:vboxuser "/devices/pseudo/vboxusbmon@0:vboxusbmon"
|
---|
739 |
|
---|
740 | # Add vboxusbmon to devlink.tab
|
---|
741 | sed -e '/name=vboxusbmon/d' "$PKG_INSTALL_ROOT/etc/devlink.tab" > "$PKG_INSTALL_ROOT/etc/devlink.vbox"
|
---|
742 | echo "type=ddi_pseudo;name=vboxusbmon \D" >> "$PKG_INSTALL_ROOT/etc/devlink.vbox"
|
---|
743 | mv -f "$PKG_INSTALL_ROOT/etc/devlink.vbox" "$PKG_INSTALL_ROOT/etc/devlink.tab"
|
---|
744 |
|
---|
745 | # Create the device link for non-remote installs
|
---|
746 | if test "$REMOTEINST" -eq 0; then
|
---|
747 | /usr/sbin/devfsadm -i "$MOD_VBOXUSBMON"
|
---|
748 | if test "$?" -ne 0; then
|
---|
749 | errorprint "Failed to create device link for $MOD_VBOXUSBMON."
|
---|
750 | exit 1
|
---|
751 | fi
|
---|
752 | fi
|
---|
753 |
|
---|
754 | # Add vboxusb if present
|
---|
755 | # This driver is special, we need it in the boot-archive but since there is no
|
---|
756 | # USB device to attach to now (it's done at runtime) it will fail to attach so
|
---|
757 | # redirect attaching failure output to /dev/null
|
---|
758 | if test -f "$DIR_CONF/vboxusb.conf"; then
|
---|
759 | add_driver "$MOD_VBOXUSB" "$DESC_VBOXUSB" "$FATALOP" "$NULLOP"
|
---|
760 | load_module "drv/$MOD_VBOXUSB" "$DESC_VBOXUSB" "$FATALOP"
|
---|
761 | fi
|
---|
762 | fi
|
---|
763 |
|
---|
764 | return $?
|
---|
765 | }
|
---|
766 |
|
---|
767 | # remove_drivers([fatal])
|
---|
768 | # failure: depends on [fatal]
|
---|
769 | remove_drivers()
|
---|
770 | {
|
---|
771 | fatal=$1
|
---|
772 |
|
---|
773 | # Remove vboxdrv[u] from devlink.tab
|
---|
774 | if test -f "$PKG_INSTALL_ROOT/etc/devlink.tab"; then
|
---|
775 | devlinkfound=`cat "$PKG_INSTALL_ROOT/etc/devlink.tab" | grep vboxdrv`
|
---|
776 | if test -n "$devlinkfound"; then
|
---|
777 | sed -e '/name=vboxdrv/d' -e '/name=vboxdrvu/d' "$PKG_INSTALL_ROOT/etc/devlink.tab" > "$PKG_INSTALL_ROOT/etc/devlink.vbox"
|
---|
778 | mv -f "$PKG_INSTALL_ROOT/etc/devlink.vbox" "$PKG_INSTALL_ROOT/etc/devlink.tab"
|
---|
779 | fi
|
---|
780 |
|
---|
781 | # Remove vboxusbmon from devlink.tab
|
---|
782 | devlinkfound=`cat "$PKG_INSTALL_ROOT/etc/devlink.tab" | grep vboxusbmon`
|
---|
783 | if test -n "$devlinkfound"; then
|
---|
784 | sed -e '/name=vboxusbmon/d' "$PKG_INSTALL_ROOT/etc/devlink.tab" > "$PKG_INSTALL_ROOT/etc/devlink.vbox"
|
---|
785 | mv -f "$PKG_INSTALL_ROOT/etc/devlink.vbox" "$PKG_INSTALL_ROOT/etc/devlink.tab"
|
---|
786 | fi
|
---|
787 | fi
|
---|
788 |
|
---|
789 | unload_module "$MOD_VBOXUSB" "$DESC_VBOXUSB" 0 "$fatal"
|
---|
790 | rem_driver "$MOD_VBOXUSB" "$DESC_VBOXUSB" "$fatal"
|
---|
791 |
|
---|
792 | unload_module "$MOD_VBOXUSBMON" "$DESC_VBOXUSBMON" 0 "$fatal"
|
---|
793 | rem_driver "$MOD_VBOXUSBMON" "$DESC_VBOXUSBMON" "$fatal"
|
---|
794 |
|
---|
795 | unload_module "$MOD_VBOXFLT" "$DESC_VBOXFLT" 0 "$fatal"
|
---|
796 | rem_driver "$MOD_VBOXFLT" "$DESC_VBOXFLT" "$fatal"
|
---|
797 |
|
---|
798 | unload_module "$MOD_VBOXBOW" "$DESC_VBOXBOW" 0 "$fatal"
|
---|
799 | rem_driver "$MOD_VBOXBOW" "$DESC_VBOXBOW" "$fatal"
|
---|
800 |
|
---|
801 | unload_module "$MOD_VBOXNET" "$DESC_VBOXNET" 0 "$fatal"
|
---|
802 | rem_driver "$MOD_VBOXNET" "$DESC_VBOXNET" "$fatal"
|
---|
803 |
|
---|
804 | unload_module "$MOD_VBOXDRV" "$DESC_VBOXDRV" 1 "$fatal"
|
---|
805 | rem_driver "$MOD_VBOXDRV" "$DESC_VBOXDRV" "$fatal"
|
---|
806 |
|
---|
807 | # remove devlinks
|
---|
808 | if test -h "$PKG_INSTALL_ROOT/dev/vboxdrv" || test -f "$PKG_INSTALL_ROOT/dev/vboxdrv"; then
|
---|
809 | rm -f "$PKG_INSTALL_ROOT/dev/vboxdrv"
|
---|
810 | fi
|
---|
811 | if test -h "$PKG_INSTALL_ROOT/dev/vboxdrvu" || test -f "$PKG_INSTALL_ROOT/dev/vboxdrvu"; then
|
---|
812 | rm -f "$PKG_INSTALL_ROOT/dev/vboxdrvu"
|
---|
813 | fi
|
---|
814 | if test -h "$PKG_INSTALL_ROOT/dev/vboxusbmon" || test -f "$PKG_INSTALL_ROOT/dev/vboxusbmon"; then
|
---|
815 | rm -f "$PKG_INSTALL_ROOT/dev/vboxusbmon"
|
---|
816 | fi
|
---|
817 |
|
---|
818 | # unpatch nwam/dhcpagent fix
|
---|
819 | nwamfile="$PKG_INSTALL_ROOT/etc/nwam/llp"
|
---|
820 | nwambackupfile=$nwamfile.vbox
|
---|
821 | if test -f "$nwamfile"; then
|
---|
822 | sed -e '/vboxnet/d' $nwamfile > $nwambackupfile
|
---|
823 | mv -f $nwambackupfile $nwamfile
|
---|
824 | fi
|
---|
825 |
|
---|
826 | # remove netmask configuration
|
---|
827 | if test -h "$PKG_INSTALL_ROOT/etc/netmasks"; then
|
---|
828 | nmaskfile="$PKG_INSTALL_ROOT/etc/inet/netmasks"
|
---|
829 | else
|
---|
830 | nmaskfile="$PKG_INSTALL_ROOT/etc/netmasks"
|
---|
831 | fi
|
---|
832 | nmaskbackupfile=$nmaskfile.vbox
|
---|
833 | if test -f "$nmaskfile"; then
|
---|
834 | sed -e '/#VirtualBox_SectionStart/,/#VirtualBox_SectionEnd/d' $nmaskfile > $nmaskbackupfile
|
---|
835 | mv -f $nmaskbackupfile $nmaskfile
|
---|
836 | fi
|
---|
837 |
|
---|
838 | if test $UPDATEBOOTARCHIVE -eq 1; then
|
---|
839 | update_boot_archive
|
---|
840 | fi
|
---|
841 |
|
---|
842 | return 0
|
---|
843 | }
|
---|
844 |
|
---|
845 | # install_python_bindings(pythonbin)
|
---|
846 | # remarks: changes pwd
|
---|
847 | # failure: non fatal
|
---|
848 | install_python_bindings()
|
---|
849 | {
|
---|
850 | # The python binary might not be there, so just exit silently
|
---|
851 | if test -z "$1"; then
|
---|
852 | return 0
|
---|
853 | fi
|
---|
854 |
|
---|
855 | if test -z "$2"; then
|
---|
856 | errorprint "missing argument to install_python_bindings"
|
---|
857 | exit 1
|
---|
858 | fi
|
---|
859 |
|
---|
860 | pythonbin=$1
|
---|
861 | pythondesc=$2
|
---|
862 | if test -x "$pythonbin"; then
|
---|
863 | # check if python has working distutils
|
---|
864 | $pythonbin -c "from distutils.core import setup" > /dev/null 2>&1
|
---|
865 | if test "$?" -ne 0; then
|
---|
866 | subprint "Skipped: $pythondesc install is unusable"
|
---|
867 | return 0
|
---|
868 | fi
|
---|
869 |
|
---|
870 | VBOX_INSTALL_PATH="$DIR_VBOXBASE"
|
---|
871 | export VBOX_INSTALL_PATH
|
---|
872 | cd $DIR_VBOXBASE/sdk/installer
|
---|
873 | $pythonbin ./vboxapisetup.py install > /dev/null
|
---|
874 | if test "$?" -eq 0; then
|
---|
875 | subprint "Installed: Bindings for $pythondesc"
|
---|
876 | fi
|
---|
877 | return 0
|
---|
878 | fi
|
---|
879 | return 1
|
---|
880 | }
|
---|
881 |
|
---|
882 | # is_process_running(processname)
|
---|
883 | # returns 1 if the process is running, 0 otherwise
|
---|
884 | is_process_running()
|
---|
885 | {
|
---|
886 | if test -z "$1"; then
|
---|
887 | errorprint "missing argument to is_process_running()"
|
---|
888 | exit 1
|
---|
889 | fi
|
---|
890 |
|
---|
891 | procname="$1"
|
---|
892 | $BIN_PGREP "$procname" > /dev/null 2>&1
|
---|
893 | if test "$?" -eq 0; then
|
---|
894 | return 1
|
---|
895 | fi
|
---|
896 | return 0
|
---|
897 | }
|
---|
898 |
|
---|
899 |
|
---|
900 | # stop_process(processname)
|
---|
901 | # failure: depends on [fatal]
|
---|
902 | stop_process()
|
---|
903 | {
|
---|
904 | if test -z "$1"; then
|
---|
905 | errorprint "missing argument to stop_process()"
|
---|
906 | exit 1
|
---|
907 | fi
|
---|
908 |
|
---|
909 | procname="$1"
|
---|
910 | is_process_running "$procname"
|
---|
911 | if test "$?" -eq 1; then
|
---|
912 | $BIN_PKILL "$procname"
|
---|
913 | sleep 2
|
---|
914 | is_process_running "$procname"
|
---|
915 | if test "$?" -eq 1; then
|
---|
916 | subprint "Terminating: $procname ...FAILED!"
|
---|
917 | if test "x$fatal" = "x$FATALOP"; then
|
---|
918 | exit 1
|
---|
919 | fi
|
---|
920 | else
|
---|
921 | subprint "Terminated: $procname"
|
---|
922 | fi
|
---|
923 | fi
|
---|
924 | }
|
---|
925 |
|
---|
926 | # start_service(servicename, shortFMRI pretty printing, full FMRI, log-file path)
|
---|
927 | # failure: non-fatal
|
---|
928 | start_service()
|
---|
929 | {
|
---|
930 | if test -z "$1" || test -z "$2" || test -z "$3" || test -z "$4"; then
|
---|
931 | errorprint "missing argument to enable_service()"
|
---|
932 | exit 1
|
---|
933 | fi
|
---|
934 |
|
---|
935 | # Since S11 the way to import a manifest is via restarting manifest-import which is asynchronous and can
|
---|
936 | # take a while to complete, using disable/enable -s doesn't work either. So we restart it, and poll in
|
---|
937 | # 1 second intervals to see if our service has been successfully imported and timeout after 'cmax' seconds.
|
---|
938 | cmax=32
|
---|
939 | cslept=0
|
---|
940 | success=0
|
---|
941 |
|
---|
942 | $BIN_SVCS "$3" >/dev/null 2>&1
|
---|
943 | while test "$?" -ne 0;
|
---|
944 | do
|
---|
945 | sleep 1
|
---|
946 | cslept=`expr $cslept + 1`
|
---|
947 | if test "$cslept" -eq "$cmax"; then
|
---|
948 | success=1
|
---|
949 | break
|
---|
950 | fi
|
---|
951 | $BIN_SVCS "$3" >/dev/null 2>&1
|
---|
952 | done
|
---|
953 | if test "$success" -eq 0; then
|
---|
954 | $BIN_SVCADM enable -s "$3"
|
---|
955 | if test "$?" -eq 0; then
|
---|
956 | subprint "Enabled: $1"
|
---|
957 | return 0
|
---|
958 | else
|
---|
959 | warnprint "Enabling $1 ...FAILED."
|
---|
960 | warnprint "Refer $4 for details."
|
---|
961 | fi
|
---|
962 | else
|
---|
963 | warnprint "Importing $1 ...FAILED."
|
---|
964 | warnprint "Refer /var/svc/log/system-manifest-import:default.log for details."
|
---|
965 | fi
|
---|
966 | return 1
|
---|
967 | }
|
---|
968 |
|
---|
969 |
|
---|
970 | # stop_service(servicename, shortFMRI-suitable for grep, full FMRI)
|
---|
971 | # failure: non fatal
|
---|
972 | stop_service()
|
---|
973 | {
|
---|
974 | if test -z "$1" || test -z "$2" || test -z "$3"; then
|
---|
975 | errorprint "missing argument to stop_service()"
|
---|
976 | exit 1
|
---|
977 | fi
|
---|
978 | servicefound=`$BIN_SVCS -H "$2" 2>/dev/null | grep '^online'`
|
---|
979 | if test ! -z "$servicefound"; then
|
---|
980 | $BIN_SVCADM disable -s "$3"
|
---|
981 | # Don't delete the manifest, this is handled by the manifest class action
|
---|
982 | # $BIN_SVCCFG delete "$3"
|
---|
983 | if test "$?" -eq 0; then
|
---|
984 | subprint "Disabled: $1"
|
---|
985 | else
|
---|
986 | subprint "Disabling: $1 ...ERROR(S)."
|
---|
987 | fi
|
---|
988 | fi
|
---|
989 | }
|
---|
990 |
|
---|
991 |
|
---|
992 | # plumb vboxnet0 instance
|
---|
993 | # failure: non fatal
|
---|
994 | plumb_net()
|
---|
995 | {
|
---|
996 | # S11 175a renames vboxnet0 as 'netX', undo this and rename it back (S12+ or S11 b175+)
|
---|
997 | if test "$HOST_OS_MAJORVERSION" -gt 11 || (test "$HOST_OS_MAJORVERSION" -eq 11 && test "$HOST_OS_MINORVERSION" -gt 174); then
|
---|
998 | vanityname=`dladm show-phys -po link,device | grep vboxnet0 | cut -f1 -d':'`
|
---|
999 | if test "$?" -eq 0 && test ! -z "$vanityname" && test "x$vanityname" != "xvboxnet0"; then
|
---|
1000 | dladm rename-link "$vanityname" vboxnet0
|
---|
1001 | if test "$?" -ne 0; then
|
---|
1002 | errorprint "Failed to rename vanity interface ($vanityname) to vboxnet0"
|
---|
1003 | fi
|
---|
1004 | fi
|
---|
1005 | fi
|
---|
1006 |
|
---|
1007 | # use ipadm for Solaris 12 and newer
|
---|
1008 | if test "$HOST_OS_MAJORVERSION" -ge 12; then
|
---|
1009 | $BIN_IPADM create-ip vboxnet0
|
---|
1010 | if test "$?" -eq 0; then
|
---|
1011 | $BIN_IPADM create-addr -T static -a local="192.168.56.1/24" "vboxnet0/v4addr"
|
---|
1012 | if test "$?" -eq 0; then
|
---|
1013 | subprint "Configured: NetAdapter 'vboxnet0'"
|
---|
1014 | else
|
---|
1015 | warnprint "Failed to create local address for vboxnet0!"
|
---|
1016 | fi
|
---|
1017 | else
|
---|
1018 | warnprint "Failed to create IP instance for vboxnet0!"
|
---|
1019 | fi
|
---|
1020 | else
|
---|
1021 | $BIN_IFCONFIG vboxnet0 plumb
|
---|
1022 | $BIN_IFCONFIG vboxnet0 up
|
---|
1023 | if test "$?" -eq 0; then
|
---|
1024 | $BIN_IFCONFIG vboxnet0 192.168.56.1 netmask 255.255.255.0 up
|
---|
1025 |
|
---|
1026 | # /etc/netmasks is a symlink, older installers replaced this with
|
---|
1027 | # a copy of the actual file, repair that behaviour here.
|
---|
1028 | recreatelink=0
|
---|
1029 | if test -h "$PKG_INSTALL_ROOT/etc/netmasks"; then
|
---|
1030 | nmaskfile="$PKG_INSTALL_ROOT/etc/inet/netmasks"
|
---|
1031 | else
|
---|
1032 | nmaskfile="$PKG_INSTALL_ROOT/etc/netmasks"
|
---|
1033 | recreatelink=1
|
---|
1034 | fi
|
---|
1035 |
|
---|
1036 | # add the netmask to stay persistent across host reboots
|
---|
1037 | nmaskbackupfile=$nmaskfile.vbox
|
---|
1038 | if test -f $nmaskfile; then
|
---|
1039 | sed -e '/#VirtualBox_SectionStart/,/#VirtualBox_SectionEnd/d' $nmaskfile > $nmaskbackupfile
|
---|
1040 |
|
---|
1041 | if test "$recreatelink" -eq 1; then
|
---|
1042 | # Check after removing our settings if /etc/netmasks is identifcal to /etc/inet/netmasks
|
---|
1043 | anydiff=`diff $nmaskbackupfile "$PKG_INSTALL_ROOT/etc/inet/netmasks"`
|
---|
1044 | if test ! -z "$anydiff"; then
|
---|
1045 | # User may have some custom settings in /etc/netmasks, don't overwrite /etc/netmasks!
|
---|
1046 | recreatelink=2
|
---|
1047 | fi
|
---|
1048 | fi
|
---|
1049 |
|
---|
1050 | echo "#VirtualBox_SectionStart" >> $nmaskbackupfile
|
---|
1051 | inst=0
|
---|
1052 | networkn=56
|
---|
1053 | while test "$inst" -ne 1; do
|
---|
1054 | echo "192.168.$networkn.0 255.255.255.0" >> $nmaskbackupfile
|
---|
1055 | inst=`expr $inst + 1`
|
---|
1056 | networkn=`expr $networkn + 1`
|
---|
1057 | done
|
---|
1058 | echo "#VirtualBox_SectionEnd" >> $nmaskbackupfile
|
---|
1059 | mv -f $nmaskbackupfile $nmaskfile
|
---|
1060 |
|
---|
1061 | # Recreate /etc/netmasks as a link if necessary
|
---|
1062 | if test "$recreatelink" -eq 1; then
|
---|
1063 | cp -f "$PKG_INSTALL_ROOT/etc/netmasks" "$PKG_INSTALL_ROOT/etc/inet/netmasks"
|
---|
1064 | ln -sf ./inet/netmasks "$PKG_INSTALL_ROOT/etc/netmasks"
|
---|
1065 | elif test "$recreatelink" -eq 2; then
|
---|
1066 | warnprint "/etc/netmasks is a symlink (to /etc/inet/netmasks) that older"
|
---|
1067 | warnprint "VirtualBox installers incorrectly overwrote. Now the contents"
|
---|
1068 | warnprint "of /etc/netmasks and /etc/inet/netmasks differ, therefore "
|
---|
1069 | warnprint "VirtualBox will not attempt to overwrite /etc/netmasks as a"
|
---|
1070 | warnprint "symlink to /etc/inet/netmasks. Please resolve this manually"
|
---|
1071 | warnprint "by updating /etc/inet/netmasks and creating /etc/netmasks as a"
|
---|
1072 | warnprint "symlink to /etc/inet/netmasks"
|
---|
1073 | fi
|
---|
1074 | fi
|
---|
1075 | else
|
---|
1076 | # Should this be fatal?
|
---|
1077 | warnprint "Failed to bring up vboxnet0!"
|
---|
1078 | fi
|
---|
1079 | fi
|
---|
1080 | }
|
---|
1081 |
|
---|
1082 |
|
---|
1083 | # unplumb all vboxnet instances
|
---|
1084 | # failure: fatal
|
---|
1085 | unplumb_net()
|
---|
1086 | {
|
---|
1087 | inst=0
|
---|
1088 | # use ipadm for Solaris 12 and newer
|
---|
1089 | if test "$HOST_OS_MAJORVERSION" -ge 12; then
|
---|
1090 | while test "$inst" -ne $MOD_VBOXNET_INST; do
|
---|
1091 | vboxnetup=`$BIN_IPADM show-addr -p -o addrobj vboxnet$inst >/dev/null 2>&1`
|
---|
1092 | if test "$?" -eq 0; then
|
---|
1093 | $BIN_IPADM delete-addr vboxnet$inst/v4addr
|
---|
1094 | $BIN_IPADM delete-ip vboxnet$inst
|
---|
1095 | if test "$?" -ne 0; then
|
---|
1096 | errorprint "VirtualBox NetAdapter 'vboxnet$inst' couldn't be removed (probably in use)."
|
---|
1097 | if test "x$fatal" = "x$FATALOP"; then
|
---|
1098 | exit 1
|
---|
1099 | fi
|
---|
1100 | fi
|
---|
1101 | fi
|
---|
1102 |
|
---|
1103 | inst=`expr $inst + 1`
|
---|
1104 | done
|
---|
1105 | else
|
---|
1106 | inst=0
|
---|
1107 | while test "$inst" -ne $MOD_VBOXNET_INST; do
|
---|
1108 | vboxnetup=`$BIN_IFCONFIG vboxnet$inst >/dev/null 2>&1`
|
---|
1109 | if test "$?" -eq 0; then
|
---|
1110 | $BIN_IFCONFIG vboxnet$inst unplumb
|
---|
1111 | if test "$?" -ne 0; then
|
---|
1112 | errorprint "VirtualBox NetAdapter 'vboxnet$inst' couldn't be unplumbed (probably in use)."
|
---|
1113 | if test "x$fatal" = "x$FATALOP"; then
|
---|
1114 | exit 1
|
---|
1115 | fi
|
---|
1116 | fi
|
---|
1117 | fi
|
---|
1118 |
|
---|
1119 | # unplumb vboxnet0 ipv6
|
---|
1120 | vboxnetup=`$BIN_IFCONFIG vboxnet$inst inet6 >/dev/null 2>&1`
|
---|
1121 | if test "$?" -eq 0; then
|
---|
1122 | $BIN_IFCONFIG vboxnet$inst inet6 unplumb
|
---|
1123 | if test "$?" -ne 0; then
|
---|
1124 | errorprint "VirtualBox NetAdapter 'vboxnet$inst' IPv6 couldn't be unplumbed (probably in use)."
|
---|
1125 | if test "x$fatal" = "x$FATALOP"; then
|
---|
1126 | exit 1
|
---|
1127 | fi
|
---|
1128 | fi
|
---|
1129 | fi
|
---|
1130 |
|
---|
1131 | inst=`expr $inst + 1`
|
---|
1132 | done
|
---|
1133 | fi
|
---|
1134 | }
|
---|
1135 |
|
---|
1136 |
|
---|
1137 | # cleanup_install([fatal])
|
---|
1138 | # failure: depends on [fatal]
|
---|
1139 | cleanup_install()
|
---|
1140 | {
|
---|
1141 | fatal=$1
|
---|
1142 |
|
---|
1143 | # No-Op for remote installs
|
---|
1144 | if test "$REMOTEINST" -eq 1; then
|
---|
1145 | return 0
|
---|
1146 | fi
|
---|
1147 |
|
---|
1148 | # stop the services
|
---|
1149 | stop_service "Web service" "virtualbox/webservice" "svc:/application/virtualbox/webservice:default"
|
---|
1150 | stop_service "Balloon control service" "virtualbox/balloonctrl" "svc:/application/virtualbox/balloonctrl:default"
|
---|
1151 | stop_service "Autostart service" "virtualbox/autostart" "svc:/application/virtualbox/autostart:default"
|
---|
1152 | stop_service "Zone access service" "virtualbox/zoneaccess" "svc:/application/virtualbox/zoneaccess:default"
|
---|
1153 |
|
---|
1154 | # DEBUG x4600b: verify that the ZoneAccess process is really gone
|
---|
1155 | is_process_running "VBoxZoneAccess"
|
---|
1156 | if test "$?" -eq 1; then
|
---|
1157 | warnprint "VBoxZoneAccess is alive despite its service being dead. Killing..."
|
---|
1158 | stop_process "VBoxZoneAccess"
|
---|
1159 | fi
|
---|
1160 |
|
---|
1161 | # unplumb all vboxnet instances for non-remote installs
|
---|
1162 | unplumb_net
|
---|
1163 |
|
---|
1164 | # Stop our other daemons, non-fatal
|
---|
1165 | stop_process "VBoxNetDHCP"
|
---|
1166 | stop_process "VBoxNetNAT"
|
---|
1167 |
|
---|
1168 | # Stop VBoxSVC quickly using SIGUSR1
|
---|
1169 | procname="VBoxSVC"
|
---|
1170 | procpid=`ps -eo pid,fname | grep $procname | grep -v grep | awk '{ print $1 }'`
|
---|
1171 | if test ! -z "$procpid" && test "$procpid" -ge 0; then
|
---|
1172 | kill -USR1 $procpid
|
---|
1173 |
|
---|
1174 | # Sleep a while and check if VBoxSVC is still running, if so fail uninstallation.
|
---|
1175 | sleep 2
|
---|
1176 | is_process_running "VBoxSVC"
|
---|
1177 | if test "$?" -eq 1; then
|
---|
1178 | errorprint "Cannot uninstall VirtualBox while VBoxSVC (pid $procpid) is still running."
|
---|
1179 | errorprint "Please shutdown all VMs and VirtualBox frontends before uninstalling VirtualBox."
|
---|
1180 | exit 1
|
---|
1181 | fi
|
---|
1182 |
|
---|
1183 | # Some VMs might still be alive after VBoxSVC as they poll less frequently before killing themselves
|
---|
1184 | # Just check for VBoxHeadless & VirtualBox frontends for now.
|
---|
1185 | is_process_running "VBoxHeadless"
|
---|
1186 | if test "$?" -eq 1; then
|
---|
1187 | errorprint "Cannot uninstall VirtualBox while VBoxHeadless is still running."
|
---|
1188 | errorprint "Please shutdown all VMs and VirtualBox frontends before uninstalling VirtualBox."
|
---|
1189 | exit 1
|
---|
1190 | fi
|
---|
1191 |
|
---|
1192 | is_process_running "VirtualBox"
|
---|
1193 | if test "$?" -eq 1; then
|
---|
1194 | errorprint "Cannot uninstall VirtualBox while any VM is still running."
|
---|
1195 | errorprint "Please shutdown all VMs and VirtualBox frontends before uninstalling VirtualBox."
|
---|
1196 | exit 1
|
---|
1197 | fi
|
---|
1198 | fi
|
---|
1199 | }
|
---|
1200 |
|
---|
1201 |
|
---|
1202 | # postinstall()
|
---|
1203 | # !! failure is always fatal
|
---|
1204 | postinstall()
|
---|
1205 | {
|
---|
1206 | infoprint "Detected Solaris $HOST_OS_MAJORVERSION Version $HOST_OS_MINORVERSION"
|
---|
1207 |
|
---|
1208 | # Install the S10 legacy library links.
|
---|
1209 | # We do this early so that when we invoke services or other VirtualBox processes, the dependent libraries are resolved.
|
---|
1210 | if test -d "/opt/VirtualBox/legacy/"; then
|
---|
1211 | if test "$HOST_OS_MAJORVERSION" -eq 10; then
|
---|
1212 | for lib in `ls -1 /opt/VirtualBox/legacy/`; do
|
---|
1213 | /usr/sbin/installf -c none $PKGINST /opt/VirtualBox/$lib=legacy/$lib s
|
---|
1214 | done
|
---|
1215 | for lib in `ls -1 /opt/VirtualBox/amd64/legacy/`; do
|
---|
1216 | /usr/sbin/installf -c none $PKGINST /opt/VirtualBox/amd64/$lib=legacy/$lib s
|
---|
1217 | done
|
---|
1218 | fi
|
---|
1219 | fi
|
---|
1220 |
|
---|
1221 | infoprint "Loading VirtualBox kernel modules..."
|
---|
1222 | install_drivers
|
---|
1223 |
|
---|
1224 | if test "$?" -eq 0; then
|
---|
1225 | if test -f "$DIR_CONF/vboxnet.conf"; then
|
---|
1226 | # nwam/dhcpagent fix
|
---|
1227 | nwamfile="$PKG_INSTALL_ROOT/etc/nwam/llp"
|
---|
1228 | nwambackupfile=$nwamfile.vbox
|
---|
1229 | if test -f "$nwamfile"; then
|
---|
1230 | sed -e '/vboxnet/d' $nwamfile > $nwambackupfile
|
---|
1231 |
|
---|
1232 | # add all vboxnet instances as static to nwam
|
---|
1233 | inst=0
|
---|
1234 | networkn=56
|
---|
1235 | while test "$inst" -ne 1; do
|
---|
1236 | echo "vboxnet$inst static 192.168.$networkn.1" >> $nwambackupfile
|
---|
1237 | inst=`expr $inst + 1`
|
---|
1238 | networkn=`expr $networkn + 1`
|
---|
1239 | done
|
---|
1240 | mv -f $nwambackupfile $nwamfile
|
---|
1241 | fi
|
---|
1242 |
|
---|
1243 | # plumb and configure vboxnet0 for non-remote installs
|
---|
1244 | if test "$REMOTEINST" -eq 0; then
|
---|
1245 | plumb_net
|
---|
1246 | fi
|
---|
1247 | fi
|
---|
1248 |
|
---|
1249 | if test -f "$PKG_INSTALL_ROOT/var/svc/manifest/application/virtualbox/virtualbox-webservice.xml" \
|
---|
1250 | || test -f "$PKG_INSTALL_ROOT/var/svc/manifest/application/virtualbox/virtualbox-zoneaccess.xml" \
|
---|
1251 | || test -f "$PKG_INSTALL_ROOT/var/svc/manifest/application/virtualbox/virtualbox-balloonctrl.xml"\
|
---|
1252 | || test -f "$PKG_INSTALL_ROOT/var/svc/manifest/application/virtualbox/virtualbox-autostart.xml"; then
|
---|
1253 | infoprint "Configuring services..."
|
---|
1254 | if test "$REMOTEINST" -eq 1; then
|
---|
1255 | subprint "Skipped for targetted installs."
|
---|
1256 | else
|
---|
1257 | # Since S11 the way to import a manifest is via restarting manifest-import which is asynchronous and can
|
---|
1258 | # take a while to complete, using disable/enable -s doesn't work either. So we restart it, and poll in
|
---|
1259 | # 1 second intervals to see if our service has been successfully imported and timeout after 'cmax' seconds.
|
---|
1260 | $BIN_SVCADM restart svc:system/manifest-import:default
|
---|
1261 |
|
---|
1262 | # Start ZoneAccess service, other services are disabled by default.
|
---|
1263 | start_service "Zone access service" "virtualbox/zoneaccess" "svc:/application/virtualbox/zoneaccess:default" \
|
---|
1264 | "/var/svc/log/application-virtualbox-zoneaccess:default.log"
|
---|
1265 | fi
|
---|
1266 | fi
|
---|
1267 |
|
---|
1268 | # Update mime and desktop databases to get the right menu entries
|
---|
1269 | # and icons. There is still some delay until the GUI picks it up,
|
---|
1270 | # but that cannot be helped.
|
---|
1271 | if test -d "$PKG_INSTALL_ROOT/usr/share/icons"; then
|
---|
1272 | infoprint "Installing MIME types and icons..."
|
---|
1273 | if test "$REMOTEINST" -eq 0; then
|
---|
1274 | /usr/bin/update-mime-database /usr/share/mime >/dev/null 2>&1
|
---|
1275 | /usr/bin/update-desktop-database -q 2>/dev/null
|
---|
1276 | else
|
---|
1277 | subprint "Skipped for targetted installs."
|
---|
1278 | fi
|
---|
1279 | fi
|
---|
1280 |
|
---|
1281 | # Install python bindings for non-remote installs
|
---|
1282 | if test "$REMOTEINST" -eq 0; then
|
---|
1283 | if test -f "$DIR_VBOXBASE/sdk/installer/vboxapisetup.py" || test -h "$DIR_VBOXBASE/sdk/installer/vboxapisetup.py"; then
|
---|
1284 | PYTHONBIN=`which python 2> /dev/null`
|
---|
1285 | if test -f "$PYTHONBIN" || test -h "$PYTHONBIN"; then
|
---|
1286 | infoprint "Installing Python bindings..."
|
---|
1287 |
|
---|
1288 | INSTALLEDIT=1
|
---|
1289 | PYTHONBIN=`which python2.4 2>/dev/null`
|
---|
1290 | install_python_bindings "$PYTHONBIN" "Python 2.4"
|
---|
1291 | if test "$?" -eq 0; then
|
---|
1292 | INSTALLEDIT=0
|
---|
1293 | fi
|
---|
1294 | PYTHONBIN=`which python2.5 2>/dev/null`
|
---|
1295 | install_python_bindings "$PYTHONBIN" "Python 2.5"
|
---|
1296 | if test "$?" -eq 0; then
|
---|
1297 | INSTALLEDIT=0
|
---|
1298 | fi
|
---|
1299 | PYTHONBIN=`which python2.6 2>/dev/null`
|
---|
1300 | install_python_bindings "$PYTHONBIN" "Python 2.6"
|
---|
1301 | if test "$?" -eq 0; then
|
---|
1302 | INSTALLEDIT=0
|
---|
1303 | fi
|
---|
1304 | PYTHONBIN=`which python2.7 2>/dev/null`
|
---|
1305 | install_python_bindings "$PYTHONBIN" "Python 2.7"
|
---|
1306 | if test "$?" -eq 0; then
|
---|
1307 | INSTALLEDIT=0
|
---|
1308 | fi
|
---|
1309 |
|
---|
1310 | # remove files installed by Python build
|
---|
1311 | rm -rf $DIR_VBOXBASE/sdk/installer/build
|
---|
1312 |
|
---|
1313 | if test "$INSTALLEDIT" -ne 0; then
|
---|
1314 | warnprint "No suitable Python version found. Required Python 2.4, 2.5, 2.6 or 2.7"
|
---|
1315 | warnprint "Skipped installing the Python bindings."
|
---|
1316 | fi
|
---|
1317 | else
|
---|
1318 | warnprint "Python not found, skipped installed Python bindings."
|
---|
1319 | fi
|
---|
1320 | fi
|
---|
1321 | else
|
---|
1322 | warnprint "Skipped installing Python bindings. Run, as root, 'vboxapisetup.py install' manually from the booted system."
|
---|
1323 | fi
|
---|
1324 |
|
---|
1325 | update_boot_archive
|
---|
1326 |
|
---|
1327 | return 0
|
---|
1328 | else
|
---|
1329 | errorprint "Failed to install drivers"
|
---|
1330 | exit 666
|
---|
1331 | fi
|
---|
1332 | return 1
|
---|
1333 | }
|
---|
1334 |
|
---|
1335 | # preremove([fatal])
|
---|
1336 | # failure: depends on [fatal]
|
---|
1337 | preremove()
|
---|
1338 | {
|
---|
1339 | fatal=$1
|
---|
1340 |
|
---|
1341 | cleanup_install "$fatal"
|
---|
1342 |
|
---|
1343 | remove_drivers "$fatal"
|
---|
1344 | if test "$?" -eq 0; then
|
---|
1345 | return 0;
|
---|
1346 | fi
|
---|
1347 | return 1
|
---|
1348 | }
|
---|
1349 |
|
---|
1350 |
|
---|
1351 | # And it begins...
|
---|
1352 | if test "x${PKG_INSTALL_ROOT:=/}" != "x/"; then
|
---|
1353 | BASEDIR_OPT="-b $PKG_INSTALL_ROOT"
|
---|
1354 | BASEDIR_PKGOPT="-R $PKG_INSTALL_ROOT"
|
---|
1355 | REMOTEINST=1
|
---|
1356 | fi
|
---|
1357 | find_bins
|
---|
1358 | check_root
|
---|
1359 | check_isa
|
---|
1360 | check_zone
|
---|
1361 | get_sysinfo
|
---|
1362 |
|
---|
1363 |
|
---|
1364 | # Get command line options
|
---|
1365 | while test $# -gt 0;
|
---|
1366 | do
|
---|
1367 | case "$1" in
|
---|
1368 | --postinstall | --preremove | --installdrivers | --removedrivers | --setupdrivers)
|
---|
1369 | drvop="$1"
|
---|
1370 | ;;
|
---|
1371 | --fatal)
|
---|
1372 | fatal="$FATALOP"
|
---|
1373 | ;;
|
---|
1374 | --silent)
|
---|
1375 | ISSILENT="$SILENTOP"
|
---|
1376 | ;;
|
---|
1377 | --ips)
|
---|
1378 | ISIPS="$IPSOP"
|
---|
1379 | ;;
|
---|
1380 | --altkerndir)
|
---|
1381 | # Use alternate kernel driver config folder (dev only)
|
---|
1382 | DIR_CONF="/usr/kernel/drv"
|
---|
1383 | ;;
|
---|
1384 | --sh-trace) # forwarded pkgadd -v
|
---|
1385 | set -x
|
---|
1386 | ;;
|
---|
1387 | --help)
|
---|
1388 | printusage
|
---|
1389 | exit 1
|
---|
1390 | ;;
|
---|
1391 | *)
|
---|
1392 | # Take a hard line on invalid options.
|
---|
1393 | errorprint "Invalid command line option: \"$1\""
|
---|
1394 | exit 1;
|
---|
1395 | ;;
|
---|
1396 | esac
|
---|
1397 | shift
|
---|
1398 | done
|
---|
1399 |
|
---|
1400 | case "$drvop" in
|
---|
1401 | --postinstall)
|
---|
1402 | check_module_arch
|
---|
1403 | postinstall
|
---|
1404 | ;;
|
---|
1405 | --preremove)
|
---|
1406 | preremove "$fatal"
|
---|
1407 | ;;
|
---|
1408 | --installdrivers)
|
---|
1409 | check_module_arch
|
---|
1410 | install_drivers
|
---|
1411 | ;;
|
---|
1412 | --removedrivers)
|
---|
1413 | remove_drivers "$fatal"
|
---|
1414 | ;;
|
---|
1415 | --setupdrivers)
|
---|
1416 | remove_drivers "$fatal"
|
---|
1417 | infoprint "Installing VirtualBox drivers:"
|
---|
1418 | install_drivers
|
---|
1419 | ;;
|
---|
1420 | *)
|
---|
1421 | printusage
|
---|
1422 | exit 1
|
---|
1423 | esac
|
---|
1424 |
|
---|
1425 | exit "$?"
|
---|
1426 |
|
---|