VirtualBox

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

Last change on this file since 18657 was 18657, checked in by vboxsync, 16 years ago

Solaris/Additions: typo.

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id
File size: 11.9 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_71.so.Z" 1>/dev/null
31 /usr/sbin/removef $PKGINST "$1/vboxmouse_drv_14.so.Z" 1>/dev/null
32 /usr/sbin/removef $PKGINST "$1/vboxmouse_drv_15.so.Z" 1>/dev/null
33 /usr/sbin/removef $PKGINST "$1/vboxmouse_drv_16.so.Z" 1>/dev/null
34 /usr/sbin/removef $PKGINST "$1/vboxmouse_drv_70.so.Z" 1>/dev/null
35 /usr/sbin/removef $PKGINST "$1/vboxmouse_drv_71.so.Z" 1>/dev/null
36
37 # Add uncompressed names to the pkg
38 /usr/sbin/installf -c none $PKGINST "$1/VBoxClient" f
39 /usr/sbin/installf -c none $PKGINST "$1/VBoxService" f
40 /usr/sbin/installf -c none $PKGINST "$1/VBoxControl" f
41 /usr/sbin/installf -c none $PKGINST "$1/vboxvideo_drv_13.so" f
42 /usr/sbin/installf -c none $PKGINST "$1/vboxvideo_drv_14.so" f
43 /usr/sbin/installf -c none $PKGINST "$1/vboxvideo_drv_15.so" f
44 /usr/sbin/installf -c none $PKGINST "$1/vboxvideo_drv_16.so" f
45 /usr/sbin/installf -c none $PKGINST "$1/vboxvideo_drv_71.so" f
46 /usr/sbin/installf -c none $PKGINST "$1/vboxmouse_drv_14.so" f
47 /usr/sbin/installf -c none $PKGINST "$1/vboxmouse_drv_15.so" f
48 /usr/sbin/installf -c none $PKGINST "$1/vboxmouse_drv_16.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_71.so.Z" > /dev/null 2>&1
61 uncompress -f "$1/vboxmouse_drv_14.so.Z" > /dev/null 2>&1
62 uncompress -f "$1/vboxmouse_drv_15.so.Z" > /dev/null 2>&1
63 uncompress -f "$1/vboxmouse_drv_16.so.Z" > /dev/null 2>&1
64 uncompress -f "$1/vboxmouse_drv_70.so.Z" > /dev/null 2>&1
65 uncompress -f "$1/vboxmouse_drv_71.so.Z" > /dev/null 2>&1
66}
67
68solaris64dir="amd64"
69vboxadditions_path="/opt/VirtualBoxAdditions"
70vboxadditions64_path=$vboxadditions_path/$solaris64dir
71
72# get what ISA the guest is running
73cputype=`isainfo -k`
74if test "$cputype" = "amd64"; then
75 isadir=$solaris64dir
76else
77 isadir=""
78fi
79vboxadditionsisa_path=$vboxadditions_path/$isadir
80
81
82# uncompress if necessary
83if test -f "$vboxadditions_path/VBoxClient.Z" || test -f "$vboxadditions64_path/VBoxClient.Z"; then
84 echo "Uncompressing files..."
85 if test -f "$vboxadditions_path/VBoxClient.Z"; then
86 uncompress_files "$vboxadditions_path"
87 fi
88 if test -f "$vboxadditions64_path/VBoxClient.Z"; then
89 uncompress_files "$vboxadditions64_path"
90 fi
91fi
92
93# vboxguest.sh would've been installed, we just need to call it.
94echo "Configuring VirtualBox guest kernel module..."
95$vboxadditions_path/vboxguest.sh restartall silentunload
96
97sed -e '
98/name=vboxguest/d' /etc/devlink.tab > /etc/devlink.vbox
99echo "type=ddi_pseudo;name=vboxguest \D" >> /etc/devlink.vbox
100mv -f /etc/devlink.vbox /etc/devlink.tab
101
102# create the device link
103/usr/sbin/devfsadm -i vboxguest
104sync
105
106# create links
107echo "Creating links..."
108/usr/sbin/installf -c none $PKGINST /dev/vboxguest=../devices/pci@0,0/pci80ee,cafe@4:vboxguest s
109/usr/sbin/installf -c none $PKGINST /usr/bin/VBoxClient=$vboxadditions_path/VBox.sh s
110/usr/sbin/installf -c none $PKGINST /usr/bin/VBoxService=$vboxadditions_path/VBox.sh s
111/usr/sbin/installf -c none $PKGINST /usr/bin/VBoxControl=$vboxadditions_path/VBox.sh s
112/usr/sbin/installf -c none $PKGINST /usr/bin/VBoxRandR=$vboxadditions_path/VBoxRandR.sh s
113/usr/sbin/installf -c none $PKGINST /usr/bin/VBoxClient-all=$vboxadditions_path/1099.vboxclient s
114
115# Install Xorg components to the required places
116xorgversion_long=`/usr/X11/bin/Xorg -version 2>&1 | grep "X Window System Version"`
117xorgversion=`/usr/bin/expr "${xorgversion_long}" : 'X Window System Version \([^ ]*\)'`
118if test -z "$xorgversion_long"; then
119 xorgversion_long=`/usr/X11/bin/Xorg -version 2>&1 | grep "X.Org X Server"`
120 xorgversion=`/usr/bin/expr "${xorgversion_long}" : 'X.Org X Server \([^ ]*\)'`
121fi
122
123vboxmouse_src=""
124vboxvideo_src=""
125
126case "$xorgversion" in
127 1.3.* )
128 vboxmouse_src="vboxmouse_drv_71.so"
129 vboxvideo_src="vboxvideo_drv_13.so"
130 ;;
131 1.4.* )
132 vboxmouse_src="vboxmouse_drv_14.so"
133 vboxvideo_src="vboxvideo_drv_14.so"
134 ;;
135 1.5.99 | 1.6.* )
136 vboxmouse_src="vboxmouse_drv_16.so"
137 vboxvideo_src="vboxvideo_drv_16.so"
138 ;;
139 1.5.* )
140 vboxmouse_src="vboxmouse_drv_15.so"
141 vboxvideo_src="vboxvideo_drv_15.so"
142 ;;
143 7.1.* | *7.2.* )
144 vboxmouse_src="vboxmouse_drv_71.so"
145 vboxvideo_src="vboxvideo_drv_71.so"
146 ;;
147 6.9.* | 7.0.* )
148 vboxmouse_src="vboxmouse_drv_70.so"
149 vboxvideo_src="vboxvideo_drv_70.so"
150 ;;
151esac
152
153retval=0
154if test -z "$vboxmouse_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
160else
161 echo "Configuring Xorg..."
162
163 # 32-bit x11 drivers
164 if test -f "$vboxadditions_path/$vboxmouse_src"; then
165 vboxmouse_dest="/usr/X11/lib/modules/input/vboxmouse_drv.so"
166 vboxvideo_dest="/usr/X11/lib/modules/drivers/vboxvideo_drv.so"
167 /usr/sbin/installf -c none $PKGINST "$vboxmouse_dest" f
168 /usr/sbin/installf -c none $PKGINST "$vboxvideo_dest" f
169 cp "$vboxadditions_path/$vboxmouse_src" "$vboxmouse_dest"
170 cp "$vboxadditions_path/$vboxvideo_src" "$vboxvideo_dest"
171
172 # Removing redundent names from pkg and files from disk
173 /usr/sbin/removef $PKGINST $vboxadditions_path/vboxmouse_drv_* 1>/dev/null
174 /usr/sbin/removef $PKGINST $vboxadditions_path/vboxvideo_drv_* 1>/dev/null
175 rm -f $vboxadditions_path/vboxmouse_drv_*
176 rm -f $vboxadditions_path/vboxvideo_drv_*
177 fi
178
179 # 64-bit x11 drivers
180 if test -f "$vboxadditions64_path/$vboxmouse_src"; then
181 vboxmouse_dest="/usr/X11/lib/modules/input/$solaris64dir/vboxmouse_drv.so"
182 vboxvideo_dest="/usr/X11/lib/modules/drivers/$solaris64dir/vboxvideo_drv.so"
183 /usr/sbin/installf -c none $PKGINST "$vboxmouse_dest" f
184 /usr/sbin/installf -c none $PKGINST "$vboxvideo_dest" f
185 cp "$vboxadditions64_path/$vboxmouse_src" "$vboxmouse_dest"
186 cp "$vboxadditions64_path/$vboxvideo_src" "$vboxvideo_dest"
187
188 # Removing redundent names from pkg and files from disk
189 /usr/sbin/removef $PKGINST $vboxadditions64_path/vboxmouse_drv_* 1>/dev/null
190 /usr/sbin/removef $PKGINST $vboxadditions64_path/vboxvideo_drv_* 1>/dev/null
191 rm -f $vboxadditions64_path/vboxmouse_drv_*
192 rm -f $vboxadditions64_path/vboxvideo_drv_*
193 fi
194
195 # Some distros like Indiana have no xorg.conf, deal with this
196 if test ! -f '/etc/X11/xorg.conf' && test ! -f '/etc/X11/.xorg.conf'; then
197
198 # Xorg 1.3.x+ should use the modeline less Xorg confs while older should
199 # use ones with all the video modelines in place. Argh.
200 xorgconf_file="solaris_xorg_modeless.conf"
201 xorgconf_unfit="solaris_xorg.conf"
202 case "$xorgversion" in
203 7.1.* | 7.2.* | 6.9.* | 7.0.* )
204 xorgconf_file="solaris_xorg.conf"
205 xorgconf_unfit="solaris_xorg_modeless.conf"
206 ;;
207 esac
208
209 /usr/sbin/removef $PKGINST $vboxadditions_path/$xorgconf_file 1>/dev/null
210 mv -f $vboxadditions_path/$xorgconf_file /etc/X11/.xorg.conf
211
212 /usr/sbin/removef $PKGINST $vboxadditions_path/$xorgconf_unfit 1>/dev/null
213 rm -f $vboxadditions_path/$xorgconf_unfit
214 fi
215
216 $vboxadditions_path/x11config.pl
217fi
218
219
220# Setup our VBoxClient
221echo "Configuring client..."
222vboxclient_src=$vboxadditions_path
223vboxclient_dest="/usr/dt/config/Xsession.d"
224if test -d "$vboxclient_dest"; then
225 /usr/sbin/installf -c none $PKGINST "$vboxclient_dest/1099.vboxclient" f
226 cp "$vboxclient_src/1099.vboxclient" "$vboxclient_dest/1099.vboxclient"
227 chmod a+rx "$vboxclient_dest/1099.vboxclient"
228elif test -d "/usr/share/gnome/autostart"; then
229 vboxclient_dest="/usr/share/gnome/autostart"
230 /usr/sbin/installf -c none $PKGINST "$vboxclient_dest/vboxclient.desktop" f
231 cp "$vboxclient_src/vboxclient.desktop" "$vboxclient_dest/vboxclient.desktop"
232else
233 echo "*** Failed to configure client!! Couldn't find autostart directory."
234 retval=2
235fi
236
237# Shared Folder kernel module (different for S10 & Nevada)
238osverstr=`uname -r`
239vboxfsmod="vboxfs"
240vboxfsunused="vboxfs_s10"
241if test "$osverstr" = "5.10"; then
242 vboxfsmod="vboxfs_s10"
243 vboxfsunused="vboxfs"
244fi
245
246# Move the appropriate module to kernel/fs & remove the unused module name from pkg and file from disk
247# 64-bit shared folder module
248if test -f "$vboxadditions64_path/$vboxfsmod"; then
249 /usr/sbin/installf -c none $PKGINST "/usr/kernel/fs/$solaris64dir/vboxfs" f
250 mv -f $vboxadditions64_path/$vboxfsmod /usr/kernel/fs/$solaris64dir/vboxfs
251 /usr/sbin/removef $PKGINST $vboxadditions64_path/$vboxfsmod 1>/dev/null
252 /usr/sbin/removef $PKGINST $vboxadditions64_path/$vboxfsunused 1>/dev/null
253 rm -f $vboxadditions64_path/$vboxfsunused
254fi
255
256# 32-bit shared folder module
257if test -f "$vboxadditions_path/$vboxfsmod"; then
258 /usr/sbin/installf -c none $PKGINST "/usr/kernel/fs/vboxfs" f
259 mv -f $vboxadditions_path/$vboxfsmod /usr/kernel/fs/vboxfs
260 /usr/sbin/removef $PKGINST $vboxadditions_path/$vboxfsmod 1>/dev/null
261 /usr/sbin/removef $PKGINST $vboxadditions_path/$vboxfsunused 1>/dev/null
262 rm -f $vboxadditions_path/$vboxfsunused
263fi
264
265
266# 32-bit crogl opengl library replacement
267if test -f "/usr/lib/VBoxOGL.so"; then
268 cp -f /usr/X11/lib/mesa/libGL.so.1 /usr/X11/lib/mesa/libGL_original_.so.1
269 ln -sf /usr/lib/VBoxOGL.so /usr/X11/lib/mesa/libGL.so.1
270fi
271
272# 64-bit crogl opengl library replacement
273if test -f "/usr/lib/amd64/VBoxOGL.so"; then
274 cp -f /usr/X11/lib/mesa/amd64/libGL.so.1 /usr/X11/lib/mesa/amd64/libGL_original_.so.1
275 ln -sf /usr/lib/amd64/VBoxOGL.so /usr/X11/lib/mesa/amd64/libGL.so.1
276fi
277
278# Finalize
279/usr/sbin/removef -f $PKGINST
280/usr/sbin/installf -f $PKGINST
281
282
283# Setup our VBoxService SMF service
284echo "Configuring service..."
285
286/usr/sbin/svccfg import /var/svc/manifest/system/virtualbox/vboxservice.xml
287/usr/sbin/svcadm enable svc:/system/virtualbox/vboxservice
288
289/usr/sbin/devfsadm -i vboxguest
290
291echo "Done."
292if test $retval -eq 0; then
293 echo "Please re-login to activate the X11 guest additions."
294 echo "If you have just un-installed the previous guest additions a REBOOT is required."
295fi
296exit $retval
297
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