1 | #!/bin/sh
|
---|
2 | ## @file
|
---|
3 | # Sun VirtualBox
|
---|
4 | # VirtualBox postinstall script for Solaris.
|
---|
5 | #
|
---|
6 |
|
---|
7 | #
|
---|
8 | # Copyright (C) 2007-2009 Sun Microsystems, Inc.
|
---|
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 | # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
19 | # Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
20 | # additional information or have any questions.
|
---|
21 | #
|
---|
22 |
|
---|
23 | install_python_bindings()
|
---|
24 | {
|
---|
25 | PYTHONBIN=$1
|
---|
26 | if test -x "$PYTHONBIN"; then
|
---|
27 | VBOX_INSTALL_PATH=/opt/VirtualBox
|
---|
28 | export VBOX_INSTALL_PATH
|
---|
29 | cd /opt/VirtualBox/sdk/installer
|
---|
30 | $PYTHONBIN ./vboxapisetup.py install > /dev/null
|
---|
31 | return 0
|
---|
32 | fi
|
---|
33 | return 1
|
---|
34 | }
|
---|
35 |
|
---|
36 | # Check for xVM/Xen
|
---|
37 | currentisa=`uname -i`
|
---|
38 | if test "$currentisa" = "i86xpv"; then
|
---|
39 | echo "## VirtualBox cannot run under xVM Dom0! Fatal Error, Aborting installation!"
|
---|
40 | exit 2
|
---|
41 | fi
|
---|
42 |
|
---|
43 | osversion=`uname -r`
|
---|
44 | currentzone=`zonename`
|
---|
45 | if test "$currentzone" = "global"; then
|
---|
46 | echo "Loading VirtualBox kernel modules..."
|
---|
47 | /opt/VirtualBox/vboxdrv.sh stopall silentunload checkarch
|
---|
48 | rc=$?
|
---|
49 | if test "$rc" -eq 0; then
|
---|
50 | /opt/VirtualBox/vboxdrv.sh start
|
---|
51 | rc=$?
|
---|
52 |
|
---|
53 | # VBoxDrv loaded successfully, proceed with the rest...
|
---|
54 | if test "$rc" -eq 0; then
|
---|
55 | # Load VBoxNetAdapter vboxnet
|
---|
56 | if test -f /platform/i86pc/kernel/drv/vboxnet.conf; then
|
---|
57 | /opt/VirtualBox/vboxdrv.sh netstart
|
---|
58 | rc=$?
|
---|
59 |
|
---|
60 | # nwam/dhcpagent fix
|
---|
61 | nwamfile=/etc/nwam/llp
|
---|
62 | nwambackupfile=$nwamfile.vbox
|
---|
63 | if test "$rc" -eq 0 && test -f "$nwamfile"; then
|
---|
64 | sed -e '/vboxnet/d' $nwamfile > $nwambackupfile
|
---|
65 | echo "vboxnet0 static 192.168.56.1" >> $nwambackupfile
|
---|
66 | mv -f $nwambackupfile $nwamfile
|
---|
67 | fi
|
---|
68 | fi
|
---|
69 |
|
---|
70 | # Load VBoxNetFilter vboxflt
|
---|
71 | if test -f /platform/i86pc/kernel/drv/vboxflt.conf; then
|
---|
72 | /opt/VirtualBox/vboxdrv.sh fltstart
|
---|
73 | rc=$?
|
---|
74 | fi
|
---|
75 |
|
---|
76 | # Load VBoxUSBMon vboxusbmon (do NOT load for Solaris 10)
|
---|
77 | if test -f /platform/i86pc/kernel/drv/vboxusbmon.conf && test "$osversion" != "5.10"; then
|
---|
78 | /opt/VirtualBox/vboxdrv.sh usbstart
|
---|
79 | rc=$?
|
---|
80 | if test "$rc" -eq 0; then
|
---|
81 | # Add vboxusbmon to the devlink.tab
|
---|
82 | sed -e '/name=vboxusbmon/d' /etc/devlink.tab > /etc/devlink.vbox
|
---|
83 | echo "type=ddi_pseudo;name=vboxusbmon \D" >> /etc/devlink.vbox
|
---|
84 | mv -f /etc/devlink.vbox /etc/devlink.tab
|
---|
85 | fi
|
---|
86 | fi
|
---|
87 | fi
|
---|
88 | fi
|
---|
89 |
|
---|
90 | # Fail on any errors while unloading previous modules because it makes it very hard to
|
---|
91 | # track problems when older vboxdrv is hanging about in memory and add_drv of the new
|
---|
92 | # one suceeds and it appears as though the new one is being used.
|
---|
93 | if test "$rc" -ne 0; then
|
---|
94 | echo "## Loading failed. Aborting installation."
|
---|
95 | exit 2
|
---|
96 | fi
|
---|
97 |
|
---|
98 | echo "Configuring services and drivers..."
|
---|
99 |
|
---|
100 | # Web service
|
---|
101 | if test -f /var/svc/manifest/application/virtualbox/virtualbox-webservice.xml; then
|
---|
102 | /usr/sbin/svccfg import /var/svc/manifest/application/virtualbox/virtualbox-webservice.xml
|
---|
103 | /usr/sbin/svcadm disable -s svc:/application/virtualbox/webservice:default
|
---|
104 | fi
|
---|
105 |
|
---|
106 | # Add vboxdrv to the devlink.tab
|
---|
107 | sed -e '/name=vboxdrv/d' /etc/devlink.tab > /etc/devlink.vbox
|
---|
108 | echo "type=ddi_pseudo;name=vboxdrv \D" >> /etc/devlink.vbox
|
---|
109 | mv -f /etc/devlink.vbox /etc/devlink.tab
|
---|
110 |
|
---|
111 | # Create the device link
|
---|
112 | /usr/sbin/devfsadm -i vboxdrv
|
---|
113 |
|
---|
114 | # Don't create link for Solaris 10
|
---|
115 | if test -f /platform/i86pc/kernel/drv/vboxusbmon.conf && test "$osversion" != "5.10"; then
|
---|
116 | /usr/sbin/devfsadm -i vboxusbmon
|
---|
117 | fi
|
---|
118 | sync
|
---|
119 |
|
---|
120 | # We need to touch the desktop link in order to add it to the menu right away
|
---|
121 | if test -f "/usr/share/applications/virtualbox.desktop"; then
|
---|
122 | touch /usr/share/applications/virtualbox.desktop
|
---|
123 | fi
|
---|
124 |
|
---|
125 | # Zone access service
|
---|
126 | if test -f /var/svc/manifest/application/virtualbox/virtualbox-zoneaccess.xml; then
|
---|
127 | /usr/sbin/svccfg import /var/svc/manifest/application/virtualbox/virtualbox-zoneaccess.xml
|
---|
128 | /usr/sbin/svcadm enable -s svc:/application/virtualbox/zoneaccess
|
---|
129 | fi
|
---|
130 |
|
---|
131 | # Install python bindings
|
---|
132 | if test -f "/opt/VirtualBox/sdk/installer/vboxapisetup.py" || test -h "/opt/VirtualBox/sdk/installer/vboxapisetup.py"; then
|
---|
133 | PYTHONBIN=`which python`
|
---|
134 | if test -f "$PYTHONBIN" || test -h "$PYTHONBIN"; then
|
---|
135 | echo "Installing Python bindings..."
|
---|
136 |
|
---|
137 | INSTALLEDIT=1
|
---|
138 | PYTHONBIN=`which python2.4`
|
---|
139 | install_python_bindings "$PYTHONBIN"
|
---|
140 | if test "$?" -eq 0; then
|
---|
141 | INSTALLEDIT=0
|
---|
142 | fi
|
---|
143 | PYTHONBIN=`which python2.5`
|
---|
144 | install_python_bindings "$PYTHONBIN"
|
---|
145 | if test "$?" -eq 0; then
|
---|
146 | INSTALLEDIT=0
|
---|
147 | fi
|
---|
148 | PYTHONBIN=`which python2.6`
|
---|
149 | install_python_bindings "$PYTHONBIN"
|
---|
150 | if test "$?" -eq 0; then
|
---|
151 | INSTALLEDIT=0
|
---|
152 | fi
|
---|
153 |
|
---|
154 | # remove files installed by Python build
|
---|
155 | rm -rf /opt/VirtualBox/sdk/installer/build
|
---|
156 |
|
---|
157 | if test "$INSTALLEDIT" -ne 0; then
|
---|
158 | echo "** No suitable Python version found. Requires Python 2.4, 2.5 or 2.6."
|
---|
159 | fi
|
---|
160 | else
|
---|
161 | echo "** WARNING! Python not found, skipped installed Python bindings."
|
---|
162 | echo " Manually run '/opt/VirtualBox/sdk/installer/vboxapisetup.py install'"
|
---|
163 | echo " to install the bindings when python is available."
|
---|
164 | fi
|
---|
165 | fi
|
---|
166 |
|
---|
167 | # Update boot archive
|
---|
168 | BOOTADMBIN=/sbin/bootadm
|
---|
169 | if test -x "$BOOTADMBIN"; then
|
---|
170 | echo "Updating boot archive..."
|
---|
171 | $BOOTADMBIN update-archive > /dev/null
|
---|
172 | else
|
---|
173 | echo "## $BOOTADMBIN not found/executable. Skipped explicit boot-archive update."
|
---|
174 | fi
|
---|
175 | fi
|
---|
176 |
|
---|
177 | /usr/sbin/installf -f $PKGINST
|
---|
178 |
|
---|
179 | echo "Done."
|
---|
180 |
|
---|
181 | # return 20 = requires reboot, 2 = partial failure, 0 = success
|
---|
182 | exit 0
|
---|
183 |
|
---|