VirtualBox

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

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

Additions/Solaris: try xdg autostart folder for VBoxClient if others are not found.

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