VirtualBox

source: vbox/trunk/src/VBox/Additions/solaris/Installer/postinstall.sh@ 25712

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

Solaris/Additions: full root packaging.

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id
File size: 15.0 KB
Line 
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
20uncompress_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_17.so.Z" 1>/dev/null
31 /usr/sbin/removef $PKGINST "$1/vboxvideo_drv_71.so.Z" 1>/dev/null
32 /usr/sbin/removef $PKGINST "$1/vboxmouse_drv_14.so.Z" 1>/dev/null
33 /usr/sbin/removef $PKGINST "$1/vboxmouse_drv_15.so.Z" 1>/dev/null
34 /usr/sbin/removef $PKGINST "$1/vboxmouse_drv_16.so.Z" 1>/dev/null
35 /usr/sbin/removef $PKGINST "$1/vboxmouse_drv_17.so.Z" 1>/dev/null
36 /usr/sbin/removef $PKGINST "$1/vboxmouse_drv_70.so.Z" 1>/dev/null
37 /usr/sbin/removef $PKGINST "$1/vboxmouse_drv_71.so.Z" 1>/dev/null
38
39 # Add uncompressed names to the pkg
40 /usr/sbin/installf -c none $PKGINST "$1/VBoxClient" f
41 /usr/sbin/installf -c none $PKGINST "$1/VBoxService" f
42 /usr/sbin/installf -c none $PKGINST "$1/VBoxControl" f
43 /usr/sbin/installf -c none $PKGINST "$1/vboxvideo_drv_13.so" f
44 /usr/sbin/installf -c none $PKGINST "$1/vboxvideo_drv_14.so" f
45 /usr/sbin/installf -c none $PKGINST "$1/vboxvideo_drv_15.so" f
46 /usr/sbin/installf -c none $PKGINST "$1/vboxvideo_drv_16.so" f
47 /usr/sbin/installf -c none $PKGINST "$1/vboxvideo_drv_17.so" f
48 /usr/sbin/installf -c none $PKGINST "$1/vboxvideo_drv_71.so" f
49 /usr/sbin/installf -c none $PKGINST "$1/vboxmouse_drv_14.so" f
50 /usr/sbin/installf -c none $PKGINST "$1/vboxmouse_drv_15.so" f
51 /usr/sbin/installf -c none $PKGINST "$1/vboxmouse_drv_16.so" f
52 /usr/sbin/installf -c none $PKGINST "$1/vboxmouse_drv_17.so" f
53 /usr/sbin/installf -c none $PKGINST "$1/vboxmouse_drv_70.so" f
54 /usr/sbin/installf -c none $PKGINST "$1/vboxmouse_drv_71.so" f
55
56 # Overwrite compressed with uncompressed file
57 uncompress -f "$1/VBoxClient.Z" > /dev/null 2>&1
58 uncompress -f "$1/VBoxService.Z" > /dev/null 2>&1
59 uncompress -f "$1/VBoxControl.Z" > /dev/null 2>&1
60 uncompress -f "$1/vboxvideo_drv_13.so.Z" > /dev/null 2>&1
61 uncompress -f "$1/vboxvideo_drv_14.so.Z" > /dev/null 2>&1
62 uncompress -f "$1/vboxvideo_drv_15.so.Z" > /dev/null 2>&1
63 uncompress -f "$1/vboxvideo_drv_16.so.Z" > /dev/null 2>&1
64 uncompress -f "$1/vboxvideo_drv_17.so.Z" > /dev/null 2>&1
65 uncompress -f "$1/vboxvideo_drv_71.so.Z" > /dev/null 2>&1
66 uncompress -f "$1/vboxmouse_drv_14.so.Z" > /dev/null 2>&1
67 uncompress -f "$1/vboxmouse_drv_15.so.Z" > /dev/null 2>&1
68 uncompress -f "$1/vboxmouse_drv_16.so.Z" > /dev/null 2>&1
69 uncompress -f "$1/vboxmouse_drv_17.so.Z" > /dev/null 2>&1
70 uncompress -f "$1/vboxmouse_drv_70.so.Z" > /dev/null 2>&1
71 uncompress -f "$1/vboxmouse_drv_71.so.Z" > /dev/null 2>&1
72}
73
74solaris64dir="amd64"
75vboxadditions_path="$BASEDIR/opt/VirtualBoxAdditions"
76vboxadditions64_path=$vboxadditions_path/$solaris64dir
77
78# get the current zone
79currentzone=`zonename`
80# get what ISA the guest is running
81cputype=`isainfo -k`
82if test "$cputype" = "amd64"; then
83 isadir=$solaris64dir
84else
85 isadir=""
86fi
87
88vboxadditionsisa_path=$vboxadditions_path/$isadir
89
90
91# uncompress if necessary
92if test -f "$vboxadditions_path/VBoxClient.Z" || test -f "$vboxadditions64_path/VBoxClient.Z"; then
93 echo "Uncompressing files..."
94 if test -f "$vboxadditions_path/VBoxClient.Z"; then
95 uncompress_files "$vboxadditions_path"
96 fi
97 if test -f "$vboxadditions64_path/VBoxClient.Z"; then
98 uncompress_files "$vboxadditions64_path"
99 fi
100fi
101
102
103if test "$currentzone" = "global"; then
104 # vboxguest.sh would've been installed, we just need to call it.
105 echo "Configuring VirtualBox guest kernel module..."
106 $vboxadditions_path/vboxguest.sh restartall silentunload
107
108 sed -e '/name=vboxguest/d' /etc/devlink.tab > /etc/devlink.vbox
109 echo "type=ddi_pseudo;name=vboxguest \D" >> /etc/devlink.vbox
110 mv -f /etc/devlink.vbox /etc/devlink.tab
111
112 # create the device link
113 /usr/sbin/devfsadm -i vboxguest
114fi
115
116
117# check if X.Org exists (snv_130 and higher have /usr/X11/* as /usr/*)
118if test -f "/usr/bin/Xorg"; then
119 xorgbin="/usr/bin/Xorg"
120elif test -f "/usr/X11/bin/Xorg"; then
121 xorgbin="/usr/X11/bin/Xorg"
122else
123 xorgbin=""
124 retval=0
125fi
126
127# create links
128echo "Creating links..."
129if test "$currentzone" = "global"; then
130 /usr/sbin/installf -c none $PKGINST /dev/vboxguest=../devices/pci@0,0/pci80ee,cafe@4:vboxguest s
131fi
132
133# Install Xorg components to the required places
134if test ! -z "$xorgbin"; then
135 xorgversion_long=`$xorgbin -version 2>&1 | grep "X Window System Version"`
136 xorgversion=`/usr/bin/expr "${xorgversion_long}" : 'X Window System Version \([^ ]*\)'`
137 if test -z "$xorgversion_long"; then
138 xorgversion_long=`$xorgbin -version 2>&1 | grep "X.Org X Server"`
139 xorgversion=`/usr/bin/expr "${xorgversion_long}" : 'X.Org X Server \([^ ]*\)'`
140 fi
141
142 vboxmouse_src=""
143 vboxvideo_src=""
144
145 case "$xorgversion" in
146 1.3.* )
147 vboxmouse_src="vboxmouse_drv_71.so"
148 vboxvideo_src="vboxvideo_drv_13.so"
149 ;;
150 1.4.* )
151 vboxmouse_src="vboxmouse_drv_14.so"
152 vboxvideo_src="vboxvideo_drv_14.so"
153 ;;
154 1.5.99 | 1.6.* )
155 vboxmouse_src="vboxmouse_drv_16.so"
156 vboxvideo_src="vboxvideo_drv_16.so"
157 ;;
158 1.5.* )
159 vboxmouse_src="vboxmouse_drv_15.so"
160 vboxvideo_src="vboxvideo_drv_15.so"
161 ;;
162 1.7.*)
163 vboxmouse_src="vboxmouse_drv_17.so"
164 vboxvideo_src="vboxvideo_drv_17.so"
165 ;;
166 7.1.* | *7.2.* )
167 vboxmouse_src="vboxmouse_drv_71.so"
168 vboxvideo_src="vboxvideo_drv_71.so"
169 ;;
170 6.9.* | 7.0.* )
171 vboxmouse_src="vboxmouse_drv_70.so"
172 vboxvideo_src="vboxvideo_drv_70.so"
173 ;;
174 esac
175
176 retval=0
177 if test -z "$vboxmouse_src"; then
178 echo "*** Unknown version of the X Window System installed."
179 echo "*** Failed to install the VirtualBox X Window System drivers."
180
181 # Exit as partially failed installation
182 retval=2
183 else
184 echo "Installing mouse and video drivers for X.Org $xorgversion..."
185
186 # Determine destination paths (snv_130 and above use "/usr/lib/xorg", older use "/usr/X11/lib"
187 vboxmouse_dest_base="/usr/lib/xorg/modules/input"
188 if test ! -d $vboxmouse_dest_base; then
189 vboxmouse_dest_base="/usr/X11/lib/modules/input"
190 fi
191 vboxvideo_dest_base="/usr/lib/xorg/modules/drivers"
192 if test ! -d $vboxvideo_dest_base; then
193 vboxvideo_dest_base="/usr/X11/lib/modules/drivers"
194 fi
195
196 vboxmouse64_dest_base=$vboxmouse_dest_base/$solaris64dir
197 vboxvideo64_dest_base=$vboxvideo_dest_base/$solaris64dir
198
199 # Make sure destination path exists
200 if test ! -d $vboxmouse_dest_base || test ! -d $vboxvideo_dest_base || test ! -d $vboxmouse64_dest_base || test ! -d $vboxvideo64_dest_base; then
201 echo "*** Missing destination paths for mouse or video modules. Aborting."
202 echo "*** Failed to install the VirtualBox X Window System drivers."
203
204 # Exit as partially failed installation
205 retval=2
206 else
207 # 32-bit x11 drivers
208 if test -f "$vboxadditions_path/$vboxmouse_src"; then
209 vboxmouse_dest="$vboxmouse_dest_base/vboxmouse_drv.so"
210 vboxvideo_dest="$vboxvideo_dest_base/vboxvideo_drv.so"
211 /usr/sbin/installf -c none $PKGINST "$vboxmouse_dest" f
212 /usr/sbin/installf -c none $PKGINST "$vboxvideo_dest" f
213 cp "$vboxadditions_path/$vboxmouse_src" "$vboxmouse_dest"
214 cp "$vboxadditions_path/$vboxvideo_src" "$vboxvideo_dest"
215
216 # Removing redundent names from pkg and files from disk
217 /usr/sbin/removef $PKGINST $vboxadditions_path/vboxmouse_drv_* 1>/dev/null
218 /usr/sbin/removef $PKGINST $vboxadditions_path/vboxvideo_drv_* 1>/dev/null
219 rm -f $vboxadditions_path/vboxmouse_drv_*
220 rm -f $vboxadditions_path/vboxvideo_drv_*
221 fi
222
223 # 64-bit x11 drivers
224 if test -f "$vboxadditions64_path/$vboxmouse_src"; then
225 vboxmouse_dest="$vboxmouse64_dest_base/vboxmouse_drv.so"
226 vboxvideo_dest="$vboxvideo64_dest_base/vboxvideo_drv.so"
227 /usr/sbin/installf -c none $PKGINST "$vboxmouse_dest" f
228 /usr/sbin/installf -c none $PKGINST "$vboxvideo_dest" f
229 cp "$vboxadditions64_path/$vboxmouse_src" "$vboxmouse_dest"
230 cp "$vboxadditions64_path/$vboxvideo_src" "$vboxvideo_dest"
231
232 # Removing redundent names from pkg and files from disk
233 /usr/sbin/removef $PKGINST $vboxadditions64_path/vboxmouse_drv_* 1>/dev/null
234 /usr/sbin/removef $PKGINST $vboxadditions64_path/vboxvideo_drv_* 1>/dev/null
235 rm -f $vboxadditions64_path/vboxmouse_drv_*
236 rm -f $vboxadditions64_path/vboxvideo_drv_*
237 fi
238
239 # Some distros like Indiana have no xorg.conf, deal with this
240 if test ! -f '/etc/X11/xorg.conf' && test ! -f '/etc/X11/.xorg.conf'; then
241
242 # Xorg 1.3.x+ should use the modeline less Xorg confs while older should
243 # use ones with all the video modelines in place. Argh.
244 xorgconf_file="solaris_xorg_modeless.conf"
245 xorgconf_unfit="solaris_xorg.conf"
246 case "$xorgversion" in
247 7.1.* | 7.2.* | 6.9.* | 7.0.* )
248 xorgconf_file="solaris_xorg.conf"
249 xorgconf_unfit="solaris_xorg_modeless.conf"
250 ;;
251 esac
252
253 /usr/sbin/removef $PKGINST $vboxadditions_path/$xorgconf_file 1>/dev/null
254 mv -f $vboxadditions_path/$xorgconf_file /etc/X11/.xorg.conf
255
256 /usr/sbin/removef $PKGINST $vboxadditions_path/$xorgconf_unfit 1>/dev/null
257 rm -f $vboxadditions_path/$xorgconf_unfit
258 fi
259 case "$xorgversion" in
260 7.1.* | 7.2.* | 6.9.* | 7.0.* | 1.3.* )
261 $vboxadditions_path/x11config.pl
262 ;;
263 1.5.* | 1.6.* | 1.7.* )
264 $vboxadditions_path/x11config15sol.pl
265 ;;
266 esac
267 fi
268 fi
269
270
271 # Setup our VBoxClient
272 echo "Configuring client..."
273 vboxclient_src=$vboxadditions_path
274 vboxclient_dest="/usr/share/gnome/autostart"
275 clientinstalled=0
276 if test -d "$vboxclient_dest"; then
277 /usr/sbin/installf -c none $PKGINST $vboxclient_dest/vboxclient.desktop=$vboxadditions_path/vboxclient.desktop s
278 clientinstalled=1
279 fi
280 vboxclient_dest="/usr/dt/config/Xsession.d"
281 if test -d "$vboxclient_dest"; then
282 /usr/sbin/installf -c none $PKGINST $vboxclient_dest/1099.vboxclient=$vboxadditions_path/1099.vboxclient s
283 clientinstalled=1
284 fi
285 if test $clientinstalled -eq 0; then
286 echo "*** Failed to configure client, couldn't find any autostart directory!"
287 # Exit as partially failed installation
288 retval=2
289 fi
290else
291 echo "(*) X.Org not found, skipped configuring X.Org guest additions."
292fi
293
294
295# Shared Folder kernel module (different for S10 & Nevada)
296osverstr=`uname -r`
297vboxfsmod="vboxfs"
298vboxfsunused="vboxfs_s10"
299if test "$osverstr" = "5.10"; then
300 vboxfsmod="vboxfs_s10"
301 vboxfsunused="vboxfs"
302fi
303
304# Move the appropriate module to kernel/fs & remove the unused module name from pkg and file from disk
305# 64-bit shared folder module
306if test -f "$vboxadditions64_path/$vboxfsmod"; then
307 /usr/sbin/installf -c none $PKGINST "/usr/kernel/fs/$solaris64dir/vboxfs" f
308 mv -f $vboxadditions64_path/$vboxfsmod /usr/kernel/fs/$solaris64dir/vboxfs
309 /usr/sbin/removef $PKGINST $vboxadditions64_path/$vboxfsmod 1>/dev/null
310 /usr/sbin/removef $PKGINST $vboxadditions64_path/$vboxfsunused 1>/dev/null
311 rm -f $vboxadditions64_path/$vboxfsunused
312fi
313
314# 32-bit shared folder module
315if test -f "$vboxadditions_path/$vboxfsmod"; then
316 /usr/sbin/installf -c none $PKGINST "/usr/kernel/fs/vboxfs" f
317 mv -f $vboxadditions_path/$vboxfsmod /usr/kernel/fs/vboxfs
318 /usr/sbin/removef $PKGINST $vboxadditions_path/$vboxfsmod 1>/dev/null
319 /usr/sbin/removef $PKGINST $vboxadditions_path/$vboxfsunused 1>/dev/null
320 rm -f $vboxadditions_path/$vboxfsunused
321fi
322
323# install openGL extensions for X.Org
324if test ! -z "$xorgbin"; then
325 # 32-bit crogl opengl library replacement
326 if test -f "/usr/lib/VBoxOGL.so"; then
327 cp -f /usr/X11/lib/mesa/libGL.so.1 /usr/X11/lib/mesa/libGL_original_.so.1
328 ln -sf /usr/lib/VBoxOGL.so /usr/X11/lib/mesa/libGL.so.1
329 fi
330
331 # 64-bit crogl opengl library replacement
332 if test -f "/usr/lib/amd64/VBoxOGL.so"; then
333 cp -f /usr/X11/lib/mesa/amd64/libGL.so.1 /usr/X11/lib/mesa/amd64/libGL_original_.so.1
334 ln -sf /usr/lib/amd64/VBoxOGL.so /usr/X11/lib/mesa/amd64/libGL.so.1
335 fi
336fi
337
338# Finalize
339/usr/sbin/removef -f $PKGINST
340/usr/sbin/installf -f $PKGINST
341
342
343if test "$currentzone" = "global"; then
344 # Setup our VBoxService SMF service
345 echo "Configuring service..."
346
347 /usr/sbin/svccfg import /var/svc/manifest/system/virtualbox/vboxservice.xml
348 /usr/sbin/svcadm enable svc:/system/virtualbox/vboxservice
349
350 /usr/sbin/devfsadm -i vboxguest
351
352 # Update boot archive
353 BOOTADMBIN=/sbin/bootadm
354 if test -x "$BOOTADMBIN"; then
355 if test -h "/dev/vboxguest"; then
356 echo "Updating boot archive..."
357 $BOOTADMBIN update-archive > /dev/null
358 else
359 echo "## Guest kernel module doesn't seem to be up. Skipped explicit boot-archive update."
360 fi
361 else
362 echo "## $BOOTADMBIN not found/executable. Skipped explicit boot-archive update."
363 fi
364fi
365
366
367echo "Done."
368if test $retval -eq 0; then
369 if test ! -z "$xorgbin"; then
370 echo "Please re-login to activate the X11 guest additions."
371 fi
372 echo "If you have just un-installed the previous guest additions a REBOOT is required."
373fi
374exit $retval
375
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette