VirtualBox

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

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

Solaris/Additions: Xorg 1.7 support.

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id
File size: 14.1 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
114 sync
115fi
116
117
118# check if Xorg exists
119if test -f "/usr/X11/bin/Xorg"; then
120 xorgbin="/usr/X11/bin/Xorg"
121else
122 xorgbin=""
123 retval=0
124fi
125
126# create links
127echo "Creating links..."
128if test "$currentzone" = "global"; then
129 /usr/sbin/installf -c none $PKGINST /dev/vboxguest=../devices/pci@0,0/pci80ee,cafe@4:vboxguest s
130fi
131if test ! -z "$xorgbin"; then
132 /usr/sbin/installf -c none $PKGINST /usr/bin/VBoxClient=$vboxadditions_path/VBox.sh s
133 /usr/sbin/installf -c none $PKGINST /usr/bin/VBoxRandR=$vboxadditions_path/VBoxRandR.sh s
134 /usr/sbin/installf -c none $PKGINST /usr/bin/VBoxClient-all=$vboxadditions_path/1099.vboxclient s
135fi
136/usr/sbin/installf -c none $PKGINST /usr/bin/VBoxControl=$vboxadditions_path/VBox.sh s
137/usr/sbin/installf -c none $PKGINST /usr/bin/VBoxService=$vboxadditions_path/VBox.sh s
138
139
140# Install Xorg components to the required places
141if test ! -z "$xorgbin"; then
142 xorgversion_long=`/usr/X11/bin/Xorg -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=`/usr/X11/bin/Xorg -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 "Configuring Xorg..."
192
193 # 32-bit x11 drivers
194 if test -f "$vboxadditions_path/$vboxmouse_src"; then
195 vboxmouse_dest="/usr/X11/lib/modules/input/vboxmouse_drv.so"
196 vboxvideo_dest="/usr/X11/lib/modules/drivers/vboxvideo_drv.so"
197 /usr/sbin/installf -c none $PKGINST "$vboxmouse_dest" f
198 /usr/sbin/installf -c none $PKGINST "$vboxvideo_dest" f
199 cp "$vboxadditions_path/$vboxmouse_src" "$vboxmouse_dest"
200 cp "$vboxadditions_path/$vboxvideo_src" "$vboxvideo_dest"
201
202 # Removing redundent names from pkg and files from disk
203 /usr/sbin/removef $PKGINST $vboxadditions_path/vboxmouse_drv_* 1>/dev/null
204 /usr/sbin/removef $PKGINST $vboxadditions_path/vboxvideo_drv_* 1>/dev/null
205 rm -f $vboxadditions_path/vboxmouse_drv_*
206 rm -f $vboxadditions_path/vboxvideo_drv_*
207 fi
208
209 # 64-bit x11 drivers
210 if test -f "$vboxadditions64_path/$vboxmouse_src"; then
211 vboxmouse_dest="/usr/X11/lib/modules/input/$solaris64dir/vboxmouse_drv.so"
212 vboxvideo_dest="/usr/X11/lib/modules/drivers/$solaris64dir/vboxvideo_drv.so"
213 /usr/sbin/installf -c none $PKGINST "$vboxmouse_dest" f
214 /usr/sbin/installf -c none $PKGINST "$vboxvideo_dest" f
215 cp "$vboxadditions64_path/$vboxmouse_src" "$vboxmouse_dest"
216 cp "$vboxadditions64_path/$vboxvideo_src" "$vboxvideo_dest"
217
218 # Removing redundent names from pkg and files from disk
219 /usr/sbin/removef $PKGINST $vboxadditions64_path/vboxmouse_drv_* 1>/dev/null
220 /usr/sbin/removef $PKGINST $vboxadditions64_path/vboxvideo_drv_* 1>/dev/null
221 rm -f $vboxadditions64_path/vboxmouse_drv_*
222 rm -f $vboxadditions64_path/vboxvideo_drv_*
223 fi
224
225 # Some distros like Indiana have no xorg.conf, deal with this
226 if test ! -f '/etc/X11/xorg.conf' && test ! -f '/etc/X11/.xorg.conf'; then
227
228 # Xorg 1.3.x+ should use the modeline less Xorg confs while older should
229 # use ones with all the video modelines in place. Argh.
230 xorgconf_file="solaris_xorg_modeless.conf"
231 xorgconf_unfit="solaris_xorg.conf"
232 case "$xorgversion" in
233 7.1.* | 7.2.* | 6.9.* | 7.0.* )
234 xorgconf_file="solaris_xorg.conf"
235 xorgconf_unfit="solaris_xorg_modeless.conf"
236 ;;
237 esac
238
239 /usr/sbin/removef $PKGINST $vboxadditions_path/$xorgconf_file 1>/dev/null
240 mv -f $vboxadditions_path/$xorgconf_file /etc/X11/.xorg.conf
241
242 /usr/sbin/removef $PKGINST $vboxadditions_path/$xorgconf_unfit 1>/dev/null
243 rm -f $vboxadditions_path/$xorgconf_unfit
244 fi
245 case "$xorgversion" in
246 7.1.* | 7.2.* | 6.9.* | 7.0.* | 1.3.* )
247 $vboxadditions_path/x11config.pl
248 ;;
249 1.5.* | 1.6.* | 1.7.* )
250 $vboxadditions_path/x11config15sol.pl
251 ;;
252 esac
253 fi
254
255
256 # Setup our VBoxClient
257 echo "Configuring client..."
258 vboxclient_src=$vboxadditions_path
259 vboxclient_dest="/usr/dt/config/Xsession.d"
260 if test -d "$vboxclient_dest"; then
261 /usr/sbin/installf -c none $PKGINST "$vboxclient_dest/1099.vboxclient" f
262 cp "$vboxclient_src/1099.vboxclient" "$vboxclient_dest/1099.vboxclient"
263 chmod a+rx "$vboxclient_dest/1099.vboxclient"
264 elif test -d "/usr/share/gnome/autostart"; then
265 vboxclient_dest="/usr/share/gnome/autostart"
266 /usr/sbin/installf -c none $PKGINST "$vboxclient_dest/vboxclient.desktop" f
267 cp "$vboxclient_src/vboxclient.desktop" "$vboxclient_dest/vboxclient.desktop"
268 else
269 echo "*** Failed to configure client!! Couldn't find autostart directory."
270 retval=2
271 fi
272else
273 echo "(*) Xorg not found, skipped configuring Xorg guest additions."
274fi
275
276
277# Shared Folder kernel module (different for S10 & Nevada)
278osverstr=`uname -r`
279vboxfsmod="vboxfs"
280vboxfsunused="vboxfs_s10"
281if test "$osverstr" = "5.10"; then
282 vboxfsmod="vboxfs_s10"
283 vboxfsunused="vboxfs"
284fi
285
286# Move the appropriate module to kernel/fs & remove the unused module name from pkg and file from disk
287# 64-bit shared folder module
288if test -f "$vboxadditions64_path/$vboxfsmod"; then
289 /usr/sbin/installf -c none $PKGINST "/usr/kernel/fs/$solaris64dir/vboxfs" f
290 mv -f $vboxadditions64_path/$vboxfsmod /usr/kernel/fs/$solaris64dir/vboxfs
291 /usr/sbin/removef $PKGINST $vboxadditions64_path/$vboxfsmod 1>/dev/null
292 /usr/sbin/removef $PKGINST $vboxadditions64_path/$vboxfsunused 1>/dev/null
293 rm -f $vboxadditions64_path/$vboxfsunused
294fi
295
296# 32-bit shared folder module
297if test -f "$vboxadditions_path/$vboxfsmod"; then
298 /usr/sbin/installf -c none $PKGINST "/usr/kernel/fs/vboxfs" f
299 mv -f $vboxadditions_path/$vboxfsmod /usr/kernel/fs/vboxfs
300 /usr/sbin/removef $PKGINST $vboxadditions_path/$vboxfsmod 1>/dev/null
301 /usr/sbin/removef $PKGINST $vboxadditions_path/$vboxfsunused 1>/dev/null
302 rm -f $vboxadditions_path/$vboxfsunused
303fi
304
305# install openGL extensions for Xorg
306if test ! -z "$xorgbin"; then
307 # 32-bit crogl opengl library replacement
308 if test -f "/usr/lib/VBoxOGL.so"; then
309 cp -f /usr/X11/lib/mesa/libGL.so.1 /usr/X11/lib/mesa/libGL_original_.so.1
310 ln -sf /usr/lib/VBoxOGL.so /usr/X11/lib/mesa/libGL.so.1
311 fi
312
313 # 64-bit crogl opengl library replacement
314 if test -f "/usr/lib/amd64/VBoxOGL.so"; then
315 cp -f /usr/X11/lib/mesa/amd64/libGL.so.1 /usr/X11/lib/mesa/amd64/libGL_original_.so.1
316 ln -sf /usr/lib/amd64/VBoxOGL.so /usr/X11/lib/mesa/amd64/libGL.so.1
317 fi
318fi
319
320# Finalize
321/usr/sbin/removef -f $PKGINST
322/usr/sbin/installf -f $PKGINST
323
324
325if test "$currentzone" = "global"; then
326 # Setup our VBoxService SMF service
327 echo "Configuring service..."
328
329 /usr/sbin/svccfg import /var/svc/manifest/system/virtualbox/vboxservice.xml
330 /usr/sbin/svcadm enable svc:/system/virtualbox/vboxservice
331
332 /usr/sbin/devfsadm -i vboxguest
333
334 # Update boot archive
335 BOOTADMBIN=/sbin/bootadm
336 if test -x "$BOOTADMBIN"; then
337 if test -h "/dev/vboxguest"; then
338 echo "Updating boot archive..."
339 $BOOTADMBIN update-archive > /dev/null
340 else
341 echo "## Guest kernel module doesn't seem to be up. Skipped explicit boot-archive update."
342 fi
343 else
344 echo "## $BOOTADMBIN not found/executable. Skipped explicit boot-archive update."
345 fi
346fi
347
348
349echo "Done."
350if test $retval -eq 0; then
351 if test ! -z "$xorgbin"; then
352 echo "Please re-login to activate the X11 guest additions."
353 fi
354 echo "If you have just un-installed the previous guest additions a REBOOT is required."
355fi
356exit $retval
357
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