VirtualBox

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

Last change on this file since 35650 was 33656, checked in by vboxsync, 14 years ago

*: rebrand Sun (L)GPL disclaimers

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