VirtualBox

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

Last change on this file since 60682 was 59023, checked in by vboxsync, 9 years ago

bugref:8153: vboxvideo: ABI issues / software rendering on Linux guest: do set-up of our OpenGL library during Additions installation later, as we can only test whether pass-through is enabled after the kernel module has been loaded.

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 15.2 KB
Line 
1#!/bin/sh
2# $Id: postinstall.sh 59023 2015-12-07 13:03:12Z vboxsync $
3## @file
4# VirtualBox postinstall script for Solaris Guest Additions.
5#
6
7#
8# Copyright (C) 2008-2013 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# The contents of this file may alternatively be used under the terms
19# of the Common Development and Distribution License Version 1.0
20# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
21# VirtualBox OSE distribution, in which case the provisions of the
22# CDDL are applicable instead of those of the GPL.
23#
24# You may elect to license modified versions of this file under the
25# terms and conditions of either the GPL or the CDDL or both.
26#
27
28# LC_ALL should take precedence over LC_* and LANG but whatever...
29LC_ALL=C
30export LC_ALL
31
32LANG=C
33export LANG
34
35# uncompress(directory, file)
36# Updates package metadata and uncompresses the file.
37uncompress_file()
38{
39 if test -z "$1" || test -z "$2"; then
40 echo "missing argument to uncompress_file()"
41 return 1
42 fi
43
44 # Remove compressed path from the pkg
45 /usr/sbin/removef $PKGINST "$1/$2.Z" 1>/dev/null
46
47 # Add uncompressed path to the pkg
48 /usr/sbin/installf -c none $PKGINST "$1/$2" f
49
50 # Uncompress the file (removes compressed file when done)
51 uncompress -f "$1/$2.Z" > /dev/null 2>&1
52}
53
54# uncompress_files(directory_with_*.Z_files)
55uncompress_files()
56{
57 for i in "${1}/"*.Z; do
58 uncompress_file "${1}" "`basename \"${i}\" .Z`"
59 done
60}
61
62solaris64dir="amd64"
63solaris32dir="i386"
64vboxadditions_path="$BASEDIR/opt/VirtualBoxAdditions"
65vboxadditions32_path=$vboxadditions_path/$solaris32dir
66vboxadditions64_path=$vboxadditions_path/$solaris64dir
67
68# get the current zone
69currentzone=`zonename`
70# get what ISA the guest is running
71cputype=`isainfo -k`
72if test "$cputype" = "amd64"; then
73 isadir=$solaris64dir
74else
75 isadir=""
76fi
77
78vboxadditionsisa_path=$vboxadditions_path/$isadir
79
80
81# uncompress if necessary
82if test -f "$vboxadditions32_path/VBoxClient.Z" || test -f "$vboxadditions64_path/VBoxClient.Z"; then
83 echo "Uncompressing files..."
84 if test -f "$vboxadditions32_path/VBoxClient.Z"; then
85 uncompress_files "$vboxadditions32_path"
86 fi
87 if test -f "$vboxadditions64_path/VBoxClient.Z"; then
88 uncompress_files "$vboxadditions64_path"
89 fi
90fi
91
92
93if test "$currentzone" = "global"; then
94 # vboxguest.sh would've been installed, we just need to call it.
95 echo "Configuring VirtualBox guest kernel module..."
96 # stop all previous modules (vboxguest, vboxfs) and start only starts vboxguest
97 $vboxadditions_path/vboxguest.sh stopall silentunload
98 $vboxadditions_path/vboxguest.sh start
99
100 sed -e '/name=vboxguest/d' /etc/devlink.tab > /etc/devlink.vbox
101 echo "type=ddi_pseudo;name=vboxguest \D" >> /etc/devlink.vbox
102 mv -f /etc/devlink.vbox /etc/devlink.tab
103
104 # create the device link
105 /usr/sbin/devfsadm -i vboxguest
106fi
107
108
109# check if X.Org exists (snv_130 and higher have /usr/X11/* as /usr/*)
110if test -f "/usr/bin/Xorg"; then
111 xorgbin="/usr/bin/Xorg"
112elif test -f "/usr/X11/bin/Xorg"; then
113 xorgbin="/usr/X11/bin/Xorg"
114else
115 xorgbin=""
116 retval=0
117fi
118
119# create links
120echo "Creating links..."
121if test "$currentzone" = "global"; then
122 /usr/sbin/installf -c none $PKGINST /dev/vboxguest=../devices/pci@0,0/pci80ee,cafe@4:vboxguest s
123 /usr/sbin/installf -c none $PKGINST /dev/vboxms=../devices/pseudo/vboxms@0:vboxms s
124fi
125
126# Install Xorg components to the required places
127if test ! -z "$xorgbin"; then
128 xorgversion_long=`$xorgbin -version 2>&1 | grep "X Window System Version"`
129 xorgversion=`/usr/bin/expr "${xorgversion_long}" : 'X Window System Version \([^ ]*\)'`
130 if test -z "$xorgversion_long"; then
131 xorgversion_long=`$xorgbin -version 2>&1 | grep "X.Org X Server"`
132 xorgversion=`/usr/bin/expr "${xorgversion_long}" : 'X.Org X Server \([^ ]*\)'`
133 fi
134
135 # "X.Y.Z" - strip off all numerics after the 2nd '.' character, e.g. "1.11.3" -> "1.11"
136 # Then the next sed, strips of all '.' characters, "1.11" -> "111".
137 fileversion=`echo $xorgversion | sed "s/\.[0-9]*//2" | sed "s/\.//"`
138 vboxvideo_src="vboxvideo_drv_$fileversion.so"
139
140 # Handle exceptions now where the X.org version does not exactly match the file-version.
141 case "$xorgversion" in
142 1.5.99 )
143 vboxvideo_src="vboxvideo_drv_16.so"
144 ;;
145 7.2.* )
146 vboxvideo_src="vboxvideo_drv_71.so"
147 ;;
148 6.9.* )
149 vboxvideo_src="vboxvideo_drv_70.so"
150 ;;
151 esac
152
153 retval=0
154 if test -z "$vboxvideo_src"; then
155 echo "*** Unknown version of the X Window System installed."
156 echo "*** Failed to install the VirtualBox X Window System drivers."
157
158 # Exit as partially failed installation
159 retval=2
160 elif test ! -f "$vboxadditions32_path/$vboxvideo_src" && test ! -f "$vboxadditions64_path/$vboxvideo_src"; then
161 echo "*** $vboxadditions32_path/$vboxvideo_src or $vboxadditions64_path/$vboxvideo_src not found!"
162 echo "*** X.org $xorgversion not supported by this package!"
163 echo "*** Failed to install the VirtualBox X.org drivers."
164
165 # Exit as partially failed installation
166 retval=2
167 else
168 echo "Installing video driver for X.Org $xorgversion..."
169
170 # Determine destination paths (snv_130 and above use "/usr/lib/xorg", older use "/usr/X11/lib"
171 vboxvideo32_dest_base="/usr/lib/xorg/modules/drivers"
172 if test ! -d $vboxvideo32_dest_base; then
173 vboxvideo32_dest_base="/usr/X11/lib/modules/drivers"
174 fi
175
176 vboxvideo64_dest_base=$vboxvideo32_dest_base/$solaris64dir
177
178 # snv_163 drops 32-bit support completely, and uses 32-bit locations for the 64-bit stuff. Ugly.
179 # We try to detect this by looking at bitness of "vesa_drv.so", and adjust our destination paths accordingly.
180 # We do not rely on using Xorg -version's ABI output because some builds (snv_162 iirc) have 64-bit ABI with
181 # 32-bit file locations.
182 if test -f "$vboxvideo32_dest_base/vesa_drv.so"; then
183 bitsize=`file "$vboxvideo32_dest_base/vesa_drv.so" | grep -i "32-bit"`
184 skip32="no"
185 else
186 echo "* Warning vesa_drv.so missing. Assuming Xorg ABI is 64-bit..."
187 fi
188
189 if test -z "$bitsize"; then
190 skip32="yes"
191 vboxvideo64_dest_base=$vboxvideo32_dest_base
192 fi
193
194 # Make sure destination path exists
195 if test ! -d $vboxvideo64_dest_base; then
196 echo "*** Missing destination paths for video module. Aborting."
197 echo "*** Failed to install the VirtualBox X Window System driver."
198
199 # Exit as partially failed installation
200 retval=2
201 else
202 # 32-bit x11 drivers
203 if test "$skip32" = "no" && test -f "$vboxadditions32_path/$vboxvideo_src"; then
204 vboxvideo_dest="$vboxvideo32_dest_base/vboxvideo_drv.so"
205 /usr/sbin/installf -c none $PKGINST "$vboxvideo_dest" f
206 cp "$vboxadditions32_path/$vboxvideo_src" "$vboxvideo_dest"
207
208 # Removing redundant names from pkg and files from disk
209 /usr/sbin/removef $PKGINST $vboxadditions32_path/vboxvideo_drv_* 1>/dev/null
210 rm -f $vboxadditions32_path/vboxvideo_drv_*
211 fi
212
213 # 64-bit x11 drivers
214 if test -f "$vboxadditions64_path/$vboxvideo_src"; then
215 vboxvideo_dest="$vboxvideo64_dest_base/vboxvideo_drv.so"
216 /usr/sbin/installf -c none $PKGINST "$vboxvideo_dest" f
217 cp "$vboxadditions64_path/$vboxvideo_src" "$vboxvideo_dest"
218
219 # Removing redundant names from pkg and files from disk
220 /usr/sbin/removef $PKGINST $vboxadditions64_path/vboxvideo_drv_* 1>/dev/null
221 rm -f $vboxadditions64_path/vboxvideo_drv_*
222 fi
223
224 # Some distros like Indiana have no xorg.conf, deal with this
225 if test ! -f '/etc/X11/xorg.conf' && test ! -f '/etc/X11/.xorg.conf'; then
226
227 # Xorg 1.3.x+ should use the modeline less Xorg confs while older should
228 # use ones with all the video modelines in place. Argh.
229 xorgconf_file="solaris_xorg_modeless.conf"
230 xorgconf_unfit="solaris_xorg.conf"
231 case "$xorgversion" in
232 7.1.* | 7.2.* | 6.9.* | 7.0.* )
233 xorgconf_file="solaris_xorg.conf"
234 xorgconf_unfit="solaris_xorg_modeless.conf"
235 ;;
236 esac
237
238 /usr/sbin/removef $PKGINST $vboxadditions_path/$xorgconf_file 1>/dev/null
239 mv -f $vboxadditions_path/$xorgconf_file /etc/X11/.xorg.conf
240
241 /usr/sbin/removef $PKGINST $vboxadditions_path/$xorgconf_unfit 1>/dev/null
242 rm -f $vboxadditions_path/$xorgconf_unfit
243 fi
244
245 # Check for VirtualBox graphics card
246 # S10u10's prtconf doesn't support the '-d' option, so let's use -v even though it's slower.
247 is_vboxgraphics=`prtconf -v | grep -i pci80ee,beef`
248 if test "$?" -eq 0; then
249 drivername="vboxvideo"
250 else
251 # Check for VMware graphics card
252 is_vmwaregraphics=`prtconf -v | grep -i pci15ad,405`
253 if test "$?" -eq 0; then
254 echo "Configuring X.Org to use VMware SVGA graphics driver..."
255 drivername="vmware"
256 fi
257 fi
258
259 # Adjust xorg.conf with video driver sections if a supported graphics card is found
260 if test ! -z "$drivername"; then
261 $vboxadditions_path/x11config15sol.pl "$drivername"
262 else
263 # No supported graphics card found, do nothing.
264 echo "## No supported graphics card found. Skipped configuring of X.org drivers."
265 fi
266 fi
267 fi
268
269
270 # Setup our VBoxClient
271 echo "Configuring client..."
272 vboxclient_src=$vboxadditions_path
273 vboxclient_dest="/usr/share/gnome/autostart"
274 clientinstalled=0
275 if test -d "$vboxclient_dest"; then
276 /usr/sbin/installf -c none $PKGINST $vboxclient_dest/vboxclient.desktop=$vboxadditions_path/vboxclient.desktop s
277 clientinstalled=1
278 fi
279 vboxclient_dest="/usr/dt/config/Xsession.d"
280 if test -d "$vboxclient_dest"; then
281 /usr/sbin/installf -c none $PKGINST $vboxclient_dest/1099.vboxclient=$vboxadditions_path/1099.vboxclient s
282 clientinstalled=1
283 fi
284
285 # Try other autostart locations if none of the above ones work
286 if test $clientinstalled -eq 0; then
287 vboxclient_dest="/etc/xdg/autostart"
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 else
292 echo "*** Failed to configure client, couldn't find any autostart directory!"
293 # Exit as partially failed installation
294 retval=2
295 fi
296 fi
297else
298 echo "(*) X.Org not found, skipped configuring X.Org guest additions."
299fi
300
301
302# Shared Folder kernel module (different for S10 & Nevada)
303osverstr=`uname -r`
304vboxfsmod="vboxfs"
305vboxfsunused="vboxfs_s10"
306if test "$osverstr" = "5.10"; then
307 vboxfsmod="vboxfs_s10"
308 vboxfsunused="vboxfs"
309fi
310
311# Move the appropriate module to kernel/fs & remove the unused module name from pkg and file from disk
312# 64-bit shared folder module
313if test -f "$vboxadditions64_path/$vboxfsmod"; then
314 echo "Installing 64-bit shared folders module..."
315 /usr/sbin/installf -c none $PKGINST "/usr/kernel/fs/$solaris64dir/vboxfs" f
316 mv -f $vboxadditions64_path/$vboxfsmod /usr/kernel/fs/$solaris64dir/vboxfs
317 /usr/sbin/removef $PKGINST $vboxadditions64_path/$vboxfsmod 1>/dev/null
318 /usr/sbin/removef $PKGINST $vboxadditions64_path/$vboxfsunused 1>/dev/null
319 rm -f $vboxadditions64_path/$vboxfsunused
320fi
321
322# 32-bit shared folder module
323if test -f "$vboxadditions32_path/$vboxfsmod"; then
324 echo "Installing 32-bit shared folders module..."
325 /usr/sbin/installf -c none $PKGINST "/usr/kernel/fs/vboxfs" f
326 mv -f $vboxadditions32_path/$vboxfsmod /usr/kernel/fs/vboxfs
327 /usr/sbin/removef $PKGINST $vboxadditions32_path/$vboxfsmod 1>/dev/null
328 /usr/sbin/removef $PKGINST $vboxadditions32_path/$vboxfsunused 1>/dev/null
329 rm -f $vboxadditions32_path/$vboxfsunused
330fi
331
332# Add a group "vboxsf" for Shared Folders access
333# All users which want to access the auto-mounted Shared Folders have to
334# be added to this group.
335groupadd vboxsf >/dev/null 2>&1
336
337# Move the pointer integration module to kernel/drv & remove the unused module name from pkg and file from disk
338
339# Finalize
340/usr/sbin/removef -f $PKGINST
341/usr/sbin/installf -f $PKGINST
342
343
344if test "$currentzone" = "global"; then
345 /usr/sbin/devfsadm -i vboxguest
346
347 # Setup VBoxService and vboxmslnk and start the services automatically
348 echo "Configuring services (this might take a while)..."
349 cmax=32
350 cslept=0
351 success=0
352 sync
353
354 # Since S11 the way to import a manifest is via restarting manifest-import which is asynchronous and can
355 # take a while to complete, using disable/enable -s doesn't work either. So we restart it, and poll in
356 # 1 second intervals to see if our service has been successfully imported and timeout after 'cmax' seconds.
357 /usr/sbin/svcadm restart svc:system/manifest-import:default
358 /usr/bin/svcs virtualbox/vboxservice virtualbox/vboxmslnk >/dev/null 2>&1
359 while test "$?" -ne 0;
360 do
361 sleep 1
362 cslept=`expr $cslept + 1`
363 if test "$cslept" -eq "$cmax"; then
364 success=1
365 break
366 fi
367 /usr/bin/svcs virtualbox/vboxservice virtualbox/vboxmslnk >/dev/null 2>&1
368 done
369 if test "$success" -eq 0; then
370 echo "Enabling services..."
371 /usr/sbin/svcadm enable -s virtualbox/vboxservice
372 /usr/sbin/svcadm enable -s virtualbox/vboxmslnk
373 else
374 echo "## Service import failed."
375 echo "## See /var/svc/log/system-manifest-import:default.log for details."
376 # Exit as partially failed installation
377 retval=2
378 fi
379
380 # Update boot archive
381 BOOTADMBIN=/sbin/bootadm
382 if test -x "$BOOTADMBIN"; then
383 if test -h "/dev/vboxguest"; then
384 echo "Updating boot archive..."
385 $BOOTADMBIN update-archive > /dev/null
386 else
387 echo "## Guest kernel module doesn't seem to be up. Skipped explicit boot-archive update."
388 fi
389 else
390 echo "## $BOOTADMBIN not found/executable. Skipped explicit boot-archive update."
391 fi
392fi
393
394# Set up our OpenGL pass-through library.
395ln -sf $vboxadditions_path/vbox_vendor_select /lib/opengl/ogl_select
396test "$currentzone" = "global" && /lib/svc/method/ogl-select start
397
398echo "Done."
399if test $retval -eq 0; then
400 if test ! -z "$xorgbin"; then
401 echo "Please re-login to activate the X11 guest additions."
402 fi
403 echo "If you have just un-installed the previous guest additions a REBOOT is required."
404fi
405exit $retval
406
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