VirtualBox

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

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

Additions/solaris: Support 64-bit only Xorg binary releases.

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