1 | #!/bin/sh
|
---|
2 | # Sun VirtualBox
|
---|
3 | # VirtualBox postinstall script for Solaris.
|
---|
4 | #
|
---|
5 | # Copyright (C) 2008-2009 Sun Microsystems, Inc.
|
---|
6 | #
|
---|
7 | # This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
8 | # available from http://www.virtualbox.org. This file is free software;
|
---|
9 | # you can redistribute it and/or modify it under the terms of the GNU
|
---|
10 | # General Public License (GPL) as published by the Free Software
|
---|
11 | # Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
12 | # VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
13 | # hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
14 | #
|
---|
15 | # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
16 | # Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
17 | # additional information or have any questions.
|
---|
18 | #
|
---|
19 |
|
---|
20 | uncompress_files()
|
---|
21 | {
|
---|
22 | # Remove compressed names from the pkg
|
---|
23 | /usr/sbin/removef $PKGINST "$1/VBoxClient.Z" 1>/dev/null
|
---|
24 | /usr/sbin/removef $PKGINST "$1/VBoxService.Z" 1>/dev/null
|
---|
25 | /usr/sbin/removef $PKGINST "$1/VBoxControl.Z" 1>/dev/null
|
---|
26 | /usr/sbin/removef $PKGINST "$1/vboxvideo_drv_13.so.Z" 1>/dev/null
|
---|
27 | /usr/sbin/removef $PKGINST "$1/vboxvideo_drv_14.so.Z" 1>/dev/null
|
---|
28 | /usr/sbin/removef $PKGINST "$1/vboxvideo_drv_15.so.Z" 1>/dev/null
|
---|
29 | /usr/sbin/removef $PKGINST "$1/vboxvideo_drv_16.so.Z" 1>/dev/null
|
---|
30 | /usr/sbin/removef $PKGINST "$1/vboxvideo_drv_71.so.Z" 1>/dev/null
|
---|
31 | /usr/sbin/removef $PKGINST "$1/vboxmouse_drv_14.so.Z" 1>/dev/null
|
---|
32 | /usr/sbin/removef $PKGINST "$1/vboxmouse_drv_15.so.Z" 1>/dev/null
|
---|
33 | /usr/sbin/removef $PKGINST "$1/vboxmouse_drv_16.so.Z" 1>/dev/null
|
---|
34 | /usr/sbin/removef $PKGINST "$1/vboxmouse_drv_70.so.Z" 1>/dev/null
|
---|
35 | /usr/sbin/removef $PKGINST "$1/vboxmouse_drv_71.so.Z" 1>/dev/null
|
---|
36 |
|
---|
37 | # Add uncompressed names to the pkg
|
---|
38 | /usr/sbin/installf -c none $PKGINST "$1/VBoxClient" f
|
---|
39 | /usr/sbin/installf -c none $PKGINST "$1/VBoxService" f
|
---|
40 | /usr/sbin/installf -c none $PKGINST "$1/VBoxControl" f
|
---|
41 | /usr/sbin/installf -c none $PKGINST "$1/vboxvideo_drv_13.so" f
|
---|
42 | /usr/sbin/installf -c none $PKGINST "$1/vboxvideo_drv_14.so" f
|
---|
43 | /usr/sbin/installf -c none $PKGINST "$1/vboxvideo_drv_15.so" f
|
---|
44 | /usr/sbin/installf -c none $PKGINST "$1/vboxvideo_drv_16.so" f
|
---|
45 | /usr/sbin/installf -c none $PKGINST "$1/vboxvideo_drv_71.so" f
|
---|
46 | /usr/sbin/installf -c none $PKGINST "$1/vboxmouse_drv_14.so" f
|
---|
47 | /usr/sbin/installf -c none $PKGINST "$1/vboxmouse_drv_15.so" f
|
---|
48 | /usr/sbin/installf -c none $PKGINST "$1/vboxmouse_drv_16.so" f
|
---|
49 | /usr/sbin/installf -c none $PKGINST "$1/vboxmouse_drv_70.so" f
|
---|
50 | /usr/sbin/installf -c none $PKGINST "$1/vboxmouse_drv_71.so" f
|
---|
51 |
|
---|
52 | # Overwrite compressed with uncompressed file
|
---|
53 | uncompress -f "$1/VBoxClient.Z" > /dev/null 2>&1
|
---|
54 | uncompress -f "$1/VBoxService.Z" > /dev/null 2>&1
|
---|
55 | uncompress -f "$1/VBoxControl.Z" > /dev/null 2>&1
|
---|
56 | uncompress -f "$1/vboxvideo_drv_13.so.Z" > /dev/null 2>&1
|
---|
57 | uncompress -f "$1/vboxvideo_drv_14.so.Z" > /dev/null 2>&1
|
---|
58 | uncompress -f "$1/vboxvideo_drv_15.so.Z" > /dev/null 2>&1
|
---|
59 | uncompress -f "$1/vboxvideo_drv_16.so.Z" > /dev/null 2>&1
|
---|
60 | uncompress -f "$1/vboxvideo_drv_71.so.Z" > /dev/null 2>&1
|
---|
61 | uncompress -f "$1/vboxmouse_drv_14.so.Z" > /dev/null 2>&1
|
---|
62 | uncompress -f "$1/vboxmouse_drv_15.so.Z" > /dev/null 2>&1
|
---|
63 | uncompress -f "$1/vboxmouse_drv_16.so.Z" > /dev/null 2>&1
|
---|
64 | uncompress -f "$1/vboxmouse_drv_70.so.Z" > /dev/null 2>&1
|
---|
65 | uncompress -f "$1/vboxmouse_drv_71.so.Z" > /dev/null 2>&1
|
---|
66 | }
|
---|
67 |
|
---|
68 | solaris64dir="amd64"
|
---|
69 | vboxadditions_path="$BASEDIR/opt/VirtualBoxAdditions"
|
---|
70 | vboxadditions64_path=$vboxadditions_path/$solaris64dir
|
---|
71 |
|
---|
72 | # get the current zone
|
---|
73 | currentzone=`zonename`
|
---|
74 | # get what ISA the guest is running
|
---|
75 | cputype=`isainfo -k`
|
---|
76 | if test "$cputype" = "amd64"; then
|
---|
77 | isadir=$solaris64dir
|
---|
78 | else
|
---|
79 | isadir=""
|
---|
80 | fi
|
---|
81 |
|
---|
82 | vboxadditionsisa_path=$vboxadditions_path/$isadir
|
---|
83 |
|
---|
84 |
|
---|
85 | # uncompress if necessary
|
---|
86 | if test -f "$vboxadditions_path/VBoxClient.Z" || test -f "$vboxadditions64_path/VBoxClient.Z"; then
|
---|
87 | echo "Uncompressing files..."
|
---|
88 | if test -f "$vboxadditions_path/VBoxClient.Z"; then
|
---|
89 | uncompress_files "$vboxadditions_path"
|
---|
90 | fi
|
---|
91 | if test -f "$vboxadditions64_path/VBoxClient.Z"; then
|
---|
92 | uncompress_files "$vboxadditions64_path"
|
---|
93 | fi
|
---|
94 | fi
|
---|
95 |
|
---|
96 |
|
---|
97 | if test "$currentzone" = "global"; then
|
---|
98 | # vboxguest.sh would've been installed, we just need to call it.
|
---|
99 | echo "Configuring VirtualBox guest kernel module..."
|
---|
100 | $vboxadditions_path/vboxguest.sh restartall silentunload
|
---|
101 |
|
---|
102 | sed -e '/name=vboxguest/d' /etc/devlink.tab > /etc/devlink.vbox
|
---|
103 | echo "type=ddi_pseudo;name=vboxguest \D" >> /etc/devlink.vbox
|
---|
104 | mv -f /etc/devlink.vbox /etc/devlink.tab
|
---|
105 |
|
---|
106 | # create the device link
|
---|
107 | /usr/sbin/devfsadm -i vboxguest
|
---|
108 | sync
|
---|
109 | fi
|
---|
110 |
|
---|
111 |
|
---|
112 | # check if Xorg exists
|
---|
113 | if test -f "/usr/X11/bin/Xorg"; then
|
---|
114 | xorgbin="/usr/X11/bin/Xorg"
|
---|
115 | else
|
---|
116 | xorgbin=""
|
---|
117 | retval=0
|
---|
118 | fi
|
---|
119 |
|
---|
120 | # create links
|
---|
121 | echo "Creating links..."
|
---|
122 | if test "$currentzone" = "global"; then
|
---|
123 | /usr/sbin/installf -c none $PKGINST /dev/vboxguest=../devices/pci@0,0/pci80ee,cafe@4:vboxguest s
|
---|
124 | fi
|
---|
125 | if test ! -z "$xorgbin"; then
|
---|
126 | /usr/sbin/installf -c none $PKGINST /usr/bin/VBoxClient=$vboxadditions_path/VBox.sh s
|
---|
127 | /usr/sbin/installf -c none $PKGINST /usr/bin/VBoxRandR=$vboxadditions_path/VBoxRandR.sh s
|
---|
128 | /usr/sbin/installf -c none $PKGINST /usr/bin/VBoxClient-all=$vboxadditions_path/1099.vboxclient s
|
---|
129 | fi
|
---|
130 | /usr/sbin/installf -c none $PKGINST /usr/bin/VBoxControl=$vboxadditions_path/VBox.sh s
|
---|
131 | /usr/sbin/installf -c none $PKGINST /usr/bin/VBoxService=$vboxadditions_path/VBox.sh s
|
---|
132 |
|
---|
133 |
|
---|
134 | # Install Xorg components to the required places
|
---|
135 | if test ! -z "$xorgbin"; then
|
---|
136 | xorgversion_long=`/usr/X11/bin/Xorg -version 2>&1 | grep "X Window System Version"`
|
---|
137 | xorgversion=`/usr/bin/expr "${xorgversion_long}" : 'X Window System Version \([^ ]*\)'`
|
---|
138 | if test -z "$xorgversion_long"; then
|
---|
139 | xorgversion_long=`/usr/X11/bin/Xorg -version 2>&1 | grep "X.Org X Server"`
|
---|
140 | xorgversion=`/usr/bin/expr "${xorgversion_long}" : 'X.Org X Server \([^ ]*\)'`
|
---|
141 | fi
|
---|
142 |
|
---|
143 | vboxmouse_src=""
|
---|
144 | vboxvideo_src=""
|
---|
145 |
|
---|
146 | case "$xorgversion" in
|
---|
147 | 1.3.* )
|
---|
148 | vboxmouse_src="vboxmouse_drv_71.so"
|
---|
149 | vboxvideo_src="vboxvideo_drv_13.so"
|
---|
150 | ;;
|
---|
151 | 1.4.* )
|
---|
152 | vboxmouse_src="vboxmouse_drv_14.so"
|
---|
153 | vboxvideo_src="vboxvideo_drv_14.so"
|
---|
154 | ;;
|
---|
155 | 1.5.99 | 1.6.* )
|
---|
156 | vboxmouse_src="vboxmouse_drv_16.so"
|
---|
157 | vboxvideo_src="vboxvideo_drv_16.so"
|
---|
158 | ;;
|
---|
159 | 1.5.* )
|
---|
160 | vboxmouse_src="vboxmouse_drv_15.so"
|
---|
161 | vboxvideo_src="vboxvideo_drv_15.so"
|
---|
162 | ;;
|
---|
163 | 7.1.* | *7.2.* )
|
---|
164 | vboxmouse_src="vboxmouse_drv_71.so"
|
---|
165 | vboxvideo_src="vboxvideo_drv_71.so"
|
---|
166 | ;;
|
---|
167 | 6.9.* | 7.0.* )
|
---|
168 | vboxmouse_src="vboxmouse_drv_70.so"
|
---|
169 | vboxvideo_src="vboxvideo_drv_70.so"
|
---|
170 | ;;
|
---|
171 | esac
|
---|
172 |
|
---|
173 | retval=0
|
---|
174 | if test -z "$vboxmouse_src"; then
|
---|
175 | echo "*** Unknown version of the X Window System installed."
|
---|
176 | echo "*** Failed to install the VirtualBox X Window System drivers."
|
---|
177 |
|
---|
178 | # Exit as partially failed installation
|
---|
179 | retval=2
|
---|
180 | else
|
---|
181 | echo "Configuring Xorg..."
|
---|
182 |
|
---|
183 | # 32-bit x11 drivers
|
---|
184 | if test -f "$vboxadditions_path/$vboxmouse_src"; then
|
---|
185 | vboxmouse_dest="/usr/X11/lib/modules/input/vboxmouse_drv.so"
|
---|
186 | vboxvideo_dest="/usr/X11/lib/modules/drivers/vboxvideo_drv.so"
|
---|
187 | /usr/sbin/installf -c none $PKGINST "$vboxmouse_dest" f
|
---|
188 | /usr/sbin/installf -c none $PKGINST "$vboxvideo_dest" f
|
---|
189 | cp "$vboxadditions_path/$vboxmouse_src" "$vboxmouse_dest"
|
---|
190 | cp "$vboxadditions_path/$vboxvideo_src" "$vboxvideo_dest"
|
---|
191 |
|
---|
192 | # Removing redundent names from pkg and files from disk
|
---|
193 | /usr/sbin/removef $PKGINST $vboxadditions_path/vboxmouse_drv_* 1>/dev/null
|
---|
194 | /usr/sbin/removef $PKGINST $vboxadditions_path/vboxvideo_drv_* 1>/dev/null
|
---|
195 | rm -f $vboxadditions_path/vboxmouse_drv_*
|
---|
196 | rm -f $vboxadditions_path/vboxvideo_drv_*
|
---|
197 | fi
|
---|
198 |
|
---|
199 | # 64-bit x11 drivers
|
---|
200 | if test -f "$vboxadditions64_path/$vboxmouse_src"; then
|
---|
201 | vboxmouse_dest="/usr/X11/lib/modules/input/$solaris64dir/vboxmouse_drv.so"
|
---|
202 | vboxvideo_dest="/usr/X11/lib/modules/drivers/$solaris64dir/vboxvideo_drv.so"
|
---|
203 | /usr/sbin/installf -c none $PKGINST "$vboxmouse_dest" f
|
---|
204 | /usr/sbin/installf -c none $PKGINST "$vboxvideo_dest" f
|
---|
205 | cp "$vboxadditions64_path/$vboxmouse_src" "$vboxmouse_dest"
|
---|
206 | cp "$vboxadditions64_path/$vboxvideo_src" "$vboxvideo_dest"
|
---|
207 |
|
---|
208 | # Removing redundent names from pkg and files from disk
|
---|
209 | /usr/sbin/removef $PKGINST $vboxadditions64_path/vboxmouse_drv_* 1>/dev/null
|
---|
210 | /usr/sbin/removef $PKGINST $vboxadditions64_path/vboxvideo_drv_* 1>/dev/null
|
---|
211 | rm -f $vboxadditions64_path/vboxmouse_drv_*
|
---|
212 | rm -f $vboxadditions64_path/vboxvideo_drv_*
|
---|
213 | fi
|
---|
214 |
|
---|
215 | # Some distros like Indiana have no xorg.conf, deal with this
|
---|
216 | if test ! -f '/etc/X11/xorg.conf' && test ! -f '/etc/X11/.xorg.conf'; then
|
---|
217 |
|
---|
218 | # Xorg 1.3.x+ should use the modeline less Xorg confs while older should
|
---|
219 | # use ones with all the video modelines in place. Argh.
|
---|
220 | xorgconf_file="solaris_xorg_modeless.conf"
|
---|
221 | xorgconf_unfit="solaris_xorg.conf"
|
---|
222 | case "$xorgversion" in
|
---|
223 | 7.1.* | 7.2.* | 6.9.* | 7.0.* )
|
---|
224 | xorgconf_file="solaris_xorg.conf"
|
---|
225 | xorgconf_unfit="solaris_xorg_modeless.conf"
|
---|
226 | ;;
|
---|
227 | esac
|
---|
228 |
|
---|
229 | /usr/sbin/removef $PKGINST $vboxadditions_path/$xorgconf_file 1>/dev/null
|
---|
230 | mv -f $vboxadditions_path/$xorgconf_file /etc/X11/.xorg.conf
|
---|
231 |
|
---|
232 | /usr/sbin/removef $PKGINST $vboxadditions_path/$xorgconf_unfit 1>/dev/null
|
---|
233 | rm -f $vboxadditions_path/$xorgconf_unfit
|
---|
234 | fi
|
---|
235 | case "$xorgversion" in
|
---|
236 | 7.1.* | 7.2.* | 6.9.* | 7.0.* | 1.3.* )
|
---|
237 | $vboxadditions_path/x11config.pl
|
---|
238 | ;;
|
---|
239 | 1.5.* | 1.6.* )
|
---|
240 | $vboxadditions_path/x11config15sol.pl
|
---|
241 | ;;
|
---|
242 | esac
|
---|
243 | fi
|
---|
244 |
|
---|
245 |
|
---|
246 | # Setup our VBoxClient
|
---|
247 | echo "Configuring client..."
|
---|
248 | vboxclient_src=$vboxadditions_path
|
---|
249 | vboxclient_dest="/usr/dt/config/Xsession.d"
|
---|
250 | if test -d "$vboxclient_dest"; then
|
---|
251 | /usr/sbin/installf -c none $PKGINST "$vboxclient_dest/1099.vboxclient" f
|
---|
252 | cp "$vboxclient_src/1099.vboxclient" "$vboxclient_dest/1099.vboxclient"
|
---|
253 | chmod a+rx "$vboxclient_dest/1099.vboxclient"
|
---|
254 | elif test -d "/usr/share/gnome/autostart"; then
|
---|
255 | vboxclient_dest="/usr/share/gnome/autostart"
|
---|
256 | /usr/sbin/installf -c none $PKGINST "$vboxclient_dest/vboxclient.desktop" f
|
---|
257 | cp "$vboxclient_src/vboxclient.desktop" "$vboxclient_dest/vboxclient.desktop"
|
---|
258 | else
|
---|
259 | echo "*** Failed to configure client!! Couldn't find autostart directory."
|
---|
260 | retval=2
|
---|
261 | fi
|
---|
262 | else
|
---|
263 | echo "(*) Xorg not found, skipped configuring Xorg guest additions."
|
---|
264 | fi
|
---|
265 |
|
---|
266 |
|
---|
267 | # Shared Folder kernel module (different for S10 & Nevada)
|
---|
268 | osverstr=`uname -r`
|
---|
269 | vboxfsmod="vboxfs"
|
---|
270 | vboxfsunused="vboxfs_s10"
|
---|
271 | if test "$osverstr" = "5.10"; then
|
---|
272 | vboxfsmod="vboxfs_s10"
|
---|
273 | vboxfsunused="vboxfs"
|
---|
274 | fi
|
---|
275 |
|
---|
276 | # Move the appropriate module to kernel/fs & remove the unused module name from pkg and file from disk
|
---|
277 | # 64-bit shared folder module
|
---|
278 | if test -f "$vboxadditions64_path/$vboxfsmod"; then
|
---|
279 | /usr/sbin/installf -c none $PKGINST "/usr/kernel/fs/$solaris64dir/vboxfs" f
|
---|
280 | mv -f $vboxadditions64_path/$vboxfsmod /usr/kernel/fs/$solaris64dir/vboxfs
|
---|
281 | /usr/sbin/removef $PKGINST $vboxadditions64_path/$vboxfsmod 1>/dev/null
|
---|
282 | /usr/sbin/removef $PKGINST $vboxadditions64_path/$vboxfsunused 1>/dev/null
|
---|
283 | rm -f $vboxadditions64_path/$vboxfsunused
|
---|
284 | fi
|
---|
285 |
|
---|
286 | # 32-bit shared folder module
|
---|
287 | if test -f "$vboxadditions_path/$vboxfsmod"; then
|
---|
288 | /usr/sbin/installf -c none $PKGINST "/usr/kernel/fs/vboxfs" f
|
---|
289 | mv -f $vboxadditions_path/$vboxfsmod /usr/kernel/fs/vboxfs
|
---|
290 | /usr/sbin/removef $PKGINST $vboxadditions_path/$vboxfsmod 1>/dev/null
|
---|
291 | /usr/sbin/removef $PKGINST $vboxadditions_path/$vboxfsunused 1>/dev/null
|
---|
292 | rm -f $vboxadditions_path/$vboxfsunused
|
---|
293 | fi
|
---|
294 |
|
---|
295 | # install openGL extensions for Xorg
|
---|
296 | if test ! -z "$xorgbin"; then
|
---|
297 | # 32-bit crogl opengl library replacement
|
---|
298 | if test -f "/usr/lib/VBoxOGL.so"; then
|
---|
299 | cp -f /usr/X11/lib/mesa/libGL.so.1 /usr/X11/lib/mesa/libGL_original_.so.1
|
---|
300 | ln -sf /usr/lib/VBoxOGL.so /usr/X11/lib/mesa/libGL.so.1
|
---|
301 | fi
|
---|
302 |
|
---|
303 | # 64-bit crogl opengl library replacement
|
---|
304 | if test -f "/usr/lib/amd64/VBoxOGL.so"; then
|
---|
305 | cp -f /usr/X11/lib/mesa/amd64/libGL.so.1 /usr/X11/lib/mesa/amd64/libGL_original_.so.1
|
---|
306 | ln -sf /usr/lib/amd64/VBoxOGL.so /usr/X11/lib/mesa/amd64/libGL.so.1
|
---|
307 | fi
|
---|
308 | fi
|
---|
309 |
|
---|
310 | # Finalize
|
---|
311 | /usr/sbin/removef -f $PKGINST
|
---|
312 | /usr/sbin/installf -f $PKGINST
|
---|
313 |
|
---|
314 |
|
---|
315 | if test "$currentzone" = "global"; then
|
---|
316 | # Setup our VBoxService SMF service
|
---|
317 | echo "Configuring service..."
|
---|
318 |
|
---|
319 | /usr/sbin/svccfg import /var/svc/manifest/system/virtualbox/vboxservice.xml
|
---|
320 | /usr/sbin/svcadm enable svc:/system/virtualbox/vboxservice
|
---|
321 |
|
---|
322 | /usr/sbin/devfsadm -i vboxguest
|
---|
323 |
|
---|
324 | # Update boot archive
|
---|
325 | BOOTADMBIN=/sbin/bootadm
|
---|
326 | if test -x "$BOOTADMBIN"; then
|
---|
327 | if test -h "/dev/vboxguest"; then
|
---|
328 | echo "Updating boot archive..."
|
---|
329 | $BOOTADMBIN update-archive > /dev/null
|
---|
330 | else
|
---|
331 | echo "## Guest kernel module doesn't seem to be up. Skipped explicit boot-archive update."
|
---|
332 | fi
|
---|
333 | else
|
---|
334 | echo "## $BOOTADMBIN not found/executable. Skipped explicit boot-archive update."
|
---|
335 | fi
|
---|
336 | fi
|
---|
337 |
|
---|
338 |
|
---|
339 | echo "Done."
|
---|
340 | if test $retval -eq 0; then
|
---|
341 | if test ! -z "$xorgbin"; then
|
---|
342 | echo "Please re-login to activate the X11 guest additions."
|
---|
343 | fi
|
---|
344 | echo "If you have just un-installed the previous guest additions a REBOOT is required."
|
---|
345 | fi
|
---|
346 | exit $retval
|
---|
347 |
|
---|