VirtualBox

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

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

Additions/Solaris: Added Xorg 1.9 and 1.8 support.

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