1 | #!/bin/sh
|
---|
2 | # Sun xVM VirtualBox
|
---|
3 | # VirtualBox postinstall script for Solaris.
|
---|
4 | #
|
---|
5 | # Copyright (C) 2008 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 |
|
---|
20 | uncompress_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 |
|
---|
68 | vboxadditions_path="/opt/VirtualBoxAdditions"
|
---|
69 | vboxadditions64_path=$vboxadditions_path/amd64
|
---|
70 | solaris64dir="amd64"
|
---|
71 |
|
---|
72 | # uncompress if necessary
|
---|
73 | if test -f "$vboxadditions_path/VBoxClient.Z" || test -f "$vboxadditions64_path/VBoxClient.Z"; then
|
---|
74 | echo "Uncompressing files..."
|
---|
75 | if test -f "$vboxadditions_path/VBoxClient.Z"; then
|
---|
76 | uncompress_files "$vboxadditions_path"
|
---|
77 | fi
|
---|
78 | if test -f "$vboxadditions64_path/VBoxClient.Z"; then
|
---|
79 | uncompress_files "$vboxadditions64_path"
|
---|
80 | fi
|
---|
81 | fi
|
---|
82 |
|
---|
83 | # vboxguest.sh would've been installed, we just need to call it.
|
---|
84 | echo "Configuring VirtualBox guest kernel module..."
|
---|
85 | $vboxadditions_path/vboxguest.sh restartall silentunload
|
---|
86 |
|
---|
87 | sed -e '
|
---|
88 | /name=vboxguest/d' /etc/devlink.tab > /etc/devlink.vbox
|
---|
89 | echo "type=ddi_pseudo;name=vboxguest \D" >> /etc/devlink.vbox
|
---|
90 | mv -f /etc/devlink.vbox /etc/devlink.tab
|
---|
91 |
|
---|
92 | # create the device link
|
---|
93 | /usr/sbin/devfsadm -i vboxguest
|
---|
94 | sync
|
---|
95 |
|
---|
96 | # get what ISA the guest is running
|
---|
97 | cputype=`isainfo -k`
|
---|
98 | isadir=""
|
---|
99 | if test "$cputype" = "amd64"; then
|
---|
100 | isadir="amd64"
|
---|
101 | fi
|
---|
102 |
|
---|
103 | # create links
|
---|
104 | echo "Creating links..."
|
---|
105 | /usr/sbin/installf -c none $PKGINST /dev/vboxguest=../devices/pci@0,0/pci80ee,cafe@4:vboxguest s
|
---|
106 | /usr/sbin/installf -c none $PKGINST /usr/bin/VBoxClient=$vboxadditions_path/VBox.sh s
|
---|
107 | /usr/sbin/installf -c none $PKGINST /usr/bin/VBoxService=$vboxadditions_path/VBox.sh s
|
---|
108 | /usr/sbin/installf -c none $PKGINST /usr/bin/VBoxControl=$vboxadditions_path/VBox.sh s
|
---|
109 | /usr/sbin/installf -c none $PKGINST /usr/bin/VBoxRandR=$vboxadditions_path/VBoxRandR.sh s
|
---|
110 |
|
---|
111 | # Install Xorg components to the required places
|
---|
112 | xorgversion_long=`/usr/X11/bin/Xorg -version 2>&1 | grep "X Window System Version"`
|
---|
113 | xorgversion=`/usr/bin/expr "${xorgversion_long}" : 'X Window System Version \([^ ]*\)'`
|
---|
114 | if test -z "$xorgversion_long"; then
|
---|
115 | xorgversion_long=`/usr/X11/bin/Xorg -version 2>&1 | grep "X.Org X Server"`
|
---|
116 | xorgversion=`/usr/bin/expr "${xorgversion_long}" : 'X.Org X Server \([^ ]*\)'`
|
---|
117 | fi
|
---|
118 |
|
---|
119 | vboxmouse_src=""
|
---|
120 | vboxvideo_src=""
|
---|
121 |
|
---|
122 | case "$xorgversion" in
|
---|
123 | 1.3.* )
|
---|
124 | vboxmouse_src="vboxmouse_drv_71.so"
|
---|
125 | vboxvideo_src="vboxvideo_drv_13.so"
|
---|
126 | ;;
|
---|
127 | 1.4.* )
|
---|
128 | vboxmouse_src="vboxmouse_drv_14.so"
|
---|
129 | vboxvideo_src="vboxvideo_drv_14.so"
|
---|
130 | ;;
|
---|
131 | 1.5.99 | 1.6.* )
|
---|
132 | vboxmouse_src="vboxmouse_drv_16.so"
|
---|
133 | vboxvideo_src="vboxvideo_drv_16.so"
|
---|
134 | ;;
|
---|
135 | 1.5.* )
|
---|
136 | vboxmouse_src="vboxmouse_drv_15.so"
|
---|
137 | vboxvideo_src="vboxvideo_drv_15.so"
|
---|
138 | ;;
|
---|
139 | 7.1.* | *7.2.* )
|
---|
140 | vboxmouse_src="vboxmouse_drv_71.so"
|
---|
141 | vboxvideo_src="vboxvideo_drv_71.so"
|
---|
142 | ;;
|
---|
143 | 6.9.* | 7.0.* )
|
---|
144 | vboxmouse_src="vboxmouse_drv_70.so"
|
---|
145 | vboxvideo_src="vboxvideo_drv_70.so"
|
---|
146 | ;;
|
---|
147 | esac
|
---|
148 |
|
---|
149 | retval=0
|
---|
150 | if test -z "$vboxmouse_src"; then
|
---|
151 | echo "*** Unknown version of the X Window System installed."
|
---|
152 | echo "*** Failed to install the VirtualBox X Window System drivers."
|
---|
153 |
|
---|
154 | # Exit as partially failed installation
|
---|
155 | retval=2
|
---|
156 | else
|
---|
157 | echo "Configuring Xorg..."
|
---|
158 |
|
---|
159 | # 32-bit x11 drivers
|
---|
160 | if test -f "$vboxadditions_path/$vboxmouse_src"; then
|
---|
161 | vboxmouse_dest="/usr/X11/lib/modules/input/vboxmouse_drv.so"
|
---|
162 | vboxvideo_dest="/usr/X11/lib/modules/drivers/vboxvideo_drv.so"
|
---|
163 | /usr/sbin/installf -c none $PKGINST "$vboxmouse_dest" f
|
---|
164 | /usr/sbin/installf -c none $PKGINST "$vboxvideo_dest" f
|
---|
165 | cp "$vboxadditions_path/$vboxmouse_src" "$vboxmouse_dest"
|
---|
166 | cp "$vboxadditions_path/$vboxvideo_src" "$vboxvideo_dest"
|
---|
167 |
|
---|
168 | # Removing redundent names from pkg and files from disk
|
---|
169 | /usr/sbin/removef $PKGINST $vboxadditions_path/vboxmouse_drv_* 1>/dev/null
|
---|
170 | /usr/sbin/removef $PKGINST $vboxadditions_path/vboxvideo_drv_* 1>/dev/null
|
---|
171 | rm -f $vboxadditions_path/vboxmouse_drv_*
|
---|
172 | rm -f $vboxadditions_path/vboxvideo_drv_*
|
---|
173 | fi
|
---|
174 |
|
---|
175 | # 64-bit x11 drivers
|
---|
176 | if test -f "$vboxadditions64_path/$vboxmouse_src"; then
|
---|
177 | vboxmouse_dest="/usr/X11/lib/modules/input/$solaris64dir/vboxmouse_drv.so"
|
---|
178 | vboxvideo_dest="/usr/X11/lib/modules/drivers/$solaris64dir/vboxvideo_drv.so"
|
---|
179 | /usr/sbin/installf -c none $PKGINST "$vboxmouse_dest" f
|
---|
180 | /usr/sbin/installf -c none $PKGINST "$vboxvideo_dest" f
|
---|
181 | cp "$vboxadditions64_path/$vboxmouse_src" "$vboxmouse_dest"
|
---|
182 | cp "$vboxadditions64_path/$vboxvideo_src" "$vboxvideo_dest"
|
---|
183 |
|
---|
184 | # Removing redundent names from pkg and files from disk
|
---|
185 | /usr/sbin/removef $PKGINST $vboxadditions64_path/vboxmouse_drv_* 1>/dev/null
|
---|
186 | /usr/sbin/removef $PKGINST $vboxadditions64_path/vboxvideo_drv_* 1>/dev/null
|
---|
187 | rm -f $vboxadditions64_path/vboxmouse_drv_*
|
---|
188 | rm -f $vboxadditions64_path/vboxvideo_drv_*
|
---|
189 | fi
|
---|
190 |
|
---|
191 | # Some distros like Indiana have no xorg.conf, deal with this
|
---|
192 | if test ! -f '/etc/X11/xorg.conf' && test ! -f '/etc/X11/.xorg.conf'; then
|
---|
193 | /usr/sbin/removef $PKGINST $vboxadditions_path/solarix_xorg.conf 1>/dev/null
|
---|
194 | mv -f $vboxadditions_path/solaris_xorg.conf /etc/X11/.xorg.conf
|
---|
195 | fi
|
---|
196 |
|
---|
197 | $vboxadditions_path/x11config.pl
|
---|
198 | fi
|
---|
199 |
|
---|
200 |
|
---|
201 | # Setup our VBoxClient
|
---|
202 | echo "Configuring client..."
|
---|
203 | vboxclient_src=$vboxadditions_path
|
---|
204 | vboxclient_dest="/usr/dt/config/Xsession.d"
|
---|
205 | if test -d "$vboxclient_dest"; then
|
---|
206 | /usr/sbin/installf -c none $PKGINST "$vboxclient_dest/1099.vboxclient" f
|
---|
207 | cp "$vboxclient_src/1099.vboxclient" "$vboxclient_dest/1099.vboxclient"
|
---|
208 | chmod a+rx "$vboxclient_dest/1099.vboxclient"
|
---|
209 | elif test -d "/usr/share/gnome/autostart"; then
|
---|
210 | vboxclient_dest="/usr/share/gnome/autostart"
|
---|
211 | /usr/sbin/installf -c none $PKGINST "$vboxclient_dest/vboxclient.desktop" f
|
---|
212 | cp "$vboxclient_src/vboxclient.desktop" "$vboxclient_dest/vboxclient.desktop"
|
---|
213 | else
|
---|
214 | echo "*** Failed to configure client!! Couldn't find autostart directory."
|
---|
215 | retval=2
|
---|
216 | fi
|
---|
217 |
|
---|
218 | # Finalize
|
---|
219 | /usr/sbin/removef -f $PKGINST
|
---|
220 | /usr/sbin/installf -f $PKGINST
|
---|
221 |
|
---|
222 |
|
---|
223 | # Setup our VBoxService SMF service
|
---|
224 | echo "Configuring service..."
|
---|
225 |
|
---|
226 | /usr/sbin/svccfg import /var/svc/manifest/system/virtualbox/vboxservice.xml
|
---|
227 | /usr/sbin/svcadm enable svc:/system/virtualbox/vboxservice
|
---|
228 |
|
---|
229 | /usr/sbin/devfsadm -i vboxguest
|
---|
230 |
|
---|
231 | echo "Done."
|
---|
232 | if test $retval -eq 0; then
|
---|
233 | echo "Please re-login to activate the X11 guest additions."
|
---|
234 | echo "If you have just un-installed the previous guest additions a REBOOT is required."
|
---|
235 | fi
|
---|
236 | exit $retval
|
---|
237 |
|
---|