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 | uncompress -f "$1/VBoxClient.Z" > /dev/null 2>&1
|
---|
23 | uncompress -f "$1/VBoxService.Z" > /dev/null 2>&1
|
---|
24 | uncompress -f "$1/VBoxControl.Z" > /dev/null 2>&1
|
---|
25 | uncompress -f "$1/vboxvideo_drv_13.so.Z" > /dev/null 2>&1
|
---|
26 | uncompress -f "$1/vboxvideo_drv_14.so.Z" > /dev/null 2>&1
|
---|
27 | uncompress -f "$1/vboxvideo_drv_71.so.Z" > /dev/null 2>&1
|
---|
28 | uncompress -f "$1/vboxmouse_drv_14.so.Z" > /dev/null 2>&1
|
---|
29 | uncompress -f "$1/vboxmouse_drv_70.so.Z" > /dev/null 2>&1
|
---|
30 | uncompress -f "$1/vboxmouse_drv_71.so.Z" > /dev/null 2>&1
|
---|
31 | }
|
---|
32 |
|
---|
33 | vboxadditions_path="/opt/VirtualBoxAdditions"
|
---|
34 | vboxadditions64_path=$vboxadditions_path/amd64
|
---|
35 | solaris64dir="amd64"
|
---|
36 |
|
---|
37 | # uncompress if necessary
|
---|
38 | if test -f "$vboxadditions_path/VBoxClient.Z" || test -f "$vboxadditions64_path/VBoxClient.Z"; then
|
---|
39 | echo "Uncompressing files..."
|
---|
40 | if test -f "$vboxadditions_path/VBoxClient.Z"; then
|
---|
41 | uncompress_files "$vboxadditions_path"
|
---|
42 | fi
|
---|
43 | if test -f "$vboxadditions64_path/VBoxClient.Z"; then
|
---|
44 | uncompress_files "$vboxadditions64_path"
|
---|
45 | fi
|
---|
46 | fi
|
---|
47 |
|
---|
48 | # vboxguest.sh would've been installed, we just need to call it.
|
---|
49 | echo "Configuring VirtualBox guest kernel module..."
|
---|
50 | $vboxadditions_path/vboxguest.sh restart silentunload
|
---|
51 |
|
---|
52 | sed -e '
|
---|
53 | /name=vboxguest/d' /etc/devlink.tab > /etc/devlink.vbox
|
---|
54 | echo "type=ddi_pseudo;name=vboxguest \D" >> /etc/devlink.vbox
|
---|
55 | mv -f /etc/devlink.vbox /etc/devlink.tab
|
---|
56 |
|
---|
57 | # create the device link
|
---|
58 | /usr/sbin/devfsadm -i vboxguest
|
---|
59 | sync
|
---|
60 |
|
---|
61 | # get what ISA the guest is running
|
---|
62 | cputype=`isainfo -k`
|
---|
63 | isadir=""
|
---|
64 | if test "$cputype" = "amd64"; then
|
---|
65 | isadir="amd64"
|
---|
66 | fi
|
---|
67 |
|
---|
68 | # create links
|
---|
69 | echo "Creating links..."
|
---|
70 | /usr/sbin/installf -c none $PKGINST /dev/vboxguest=../devices/pci@0,0/pci80ee,cafe@4:vboxguest s
|
---|
71 | /usr/sbin/installf -c none $PKGINST /usr/bin/VBoxClient=$vboxadditions_path/VBox.sh s
|
---|
72 | /usr/sbin/installf -c none $PKGINST /usr/bin/VBoxService=$vboxadditions_path/VBox.sh s
|
---|
73 | /usr/sbin/installf -c none $PKGINST /usr/bin/VBoxControl=$vboxadditions_path/VBox.sh s
|
---|
74 | /usr/sbin/installf -c none $PKGINST /usr/bin/VBoxRandR=$vboxadditions_path/VBoxRandR.sh s
|
---|
75 |
|
---|
76 | # Install Xorg components to the required places
|
---|
77 | xorgversion_long=`/usr/X11/bin/Xorg -version 2>&1 | grep "X Window System Version"`
|
---|
78 | xorgversion=`/usr/bin/expr "${xorgversion_long}" : 'X Window System Version \([^ ]*\)'`
|
---|
79 |
|
---|
80 | vboxmouse_src=""
|
---|
81 | vboxvideo_src=""
|
---|
82 |
|
---|
83 | case "$xorgversion" in
|
---|
84 | 1.3.* )
|
---|
85 | vboxmouse_src="vboxmouse_drv_71.so"
|
---|
86 | vboxvideo_src="vboxvideo_drv_13.so"
|
---|
87 | ;;
|
---|
88 | 1.4.* )
|
---|
89 | vboxmouse_src="vboxmouse_drv_14.so"
|
---|
90 | vboxvideo_src="vboxvideo_drv_14.so"
|
---|
91 | ;;
|
---|
92 | 7.1.* | *7.2.* )
|
---|
93 | vboxmouse_src="vboxmouse_drv_71.so"
|
---|
94 | vboxvideo_src="vboxvideo_drv_71.so"
|
---|
95 | ;;
|
---|
96 | 6.9.* | 7.0.* )
|
---|
97 | vboxmouse_src="vboxmouse_drv_70.so"
|
---|
98 | vboxvideo_src="vboxvideo_drv_70.so"
|
---|
99 | ;;
|
---|
100 | esac
|
---|
101 |
|
---|
102 | retval=0
|
---|
103 | if test -z "$vboxmouse_src"; then
|
---|
104 | echo "*** Unknown version of the X Window System installed."
|
---|
105 | echo "*** Failed to install the VirtualBox X Window System drivers."
|
---|
106 |
|
---|
107 | # Exit as partially failed installation
|
---|
108 | retval=2
|
---|
109 | else
|
---|
110 | echo "Configuring Xorg..."
|
---|
111 |
|
---|
112 | # 32-bit x11 drivers
|
---|
113 | if test -f "$vboxadditions_path/$vboxmouse_src"; then
|
---|
114 | vboxmouse_dest="/usr/X11/lib/modules/input/vboxmouse_drv.so"
|
---|
115 | vboxvideo_dest="/usr/X11/lib/modules/drivers/vboxvideo_drv.so"
|
---|
116 | /usr/sbin/installf -c none $PKGINST "$vboxmouse_dest" f
|
---|
117 | /usr/sbin/installf -c none $PKGINST "$vboxvideo_dest" f
|
---|
118 | cp "$vboxadditions_path/$vboxmouse_src" "$vboxmouse_dest"
|
---|
119 | cp "$vboxadditions_path/$vboxvideo_src" "$vboxvideo_dest"
|
---|
120 |
|
---|
121 | # Removing redundent files
|
---|
122 | /usr/sbin/removef $PKGINST $vboxadditions_path/vboxmouse_drv_* 1>/dev/null 2>/dev/null
|
---|
123 | /usr/sbin/removef $PKGINST $vboxadditions_path/vboxvideo_drv_* 1>/dev/null 2>/dev/null
|
---|
124 | rm -f $vboxadditions_path/vboxmouse_drv_*
|
---|
125 | rm -f $vboxadditions_path/vboxvideo_drv_*
|
---|
126 | fi
|
---|
127 |
|
---|
128 | # 64-bit x11 drivers
|
---|
129 | if test -f "$vboxadditions64_path/$vboxmouse_src"; then
|
---|
130 | vboxmouse_dest="/usr/X11/lib/modules/input/$solaris64dir/vboxmouse_drv.so"
|
---|
131 | vboxvideo_dest="/usr/X11/lib/modules/drivers/$solaris64dir/vboxvideo_drv.so"
|
---|
132 | /usr/sbin/installf -c none $PKGINST "$vboxmouse_dest" f
|
---|
133 | /usr/sbin/installf -c none $PKGINST "$vboxvideo_dest" f
|
---|
134 | cp "$vboxadditions64_path/$vboxmouse_src" "$vboxmouse_dest"
|
---|
135 | cp "$vboxadditions64_path/$vboxvideo_src" "$vboxvideo_dest"
|
---|
136 |
|
---|
137 | # Removing redundent files
|
---|
138 | /usr/sbin/removef $PKGINST $vboxadditions64_path/vboxmouse_drv_* 1>/dev/null 2>/dev/null
|
---|
139 | /usr/sbin/removef $PKGINST $vboxadditions64_path/vboxvideo_drv_* 1>/dev/null 2>/dev/null
|
---|
140 | rm -f $vboxadditions64_path/vboxmouse_drv_*
|
---|
141 | rm -f $vboxadditions64_path/vboxvideo_drv_*
|
---|
142 | fi
|
---|
143 |
|
---|
144 | # Some distros like Indiana have no xorg.conf, deal with this
|
---|
145 | if test ! -f '/etc/X11/xorg.conf' && test ! -f '/etc/X11/.xorg.conf'; then
|
---|
146 | mv -f $vboxadditions_path/solaris_xorg.conf /etc/X11/.xorg.conf
|
---|
147 | fi
|
---|
148 |
|
---|
149 | $vboxadditions_path/x11config.pl
|
---|
150 | fi
|
---|
151 |
|
---|
152 |
|
---|
153 | # Setup our VBoxClient
|
---|
154 | echo "Configuring client..."
|
---|
155 | vboxclient_src=$vboxadditions_path
|
---|
156 | vboxclient_dest="/usr/dt/config/Xsession.d"
|
---|
157 | if test -d "$vboxclient_dest"; then
|
---|
158 | /usr/sbin/installf -c none $PKGINST "$vboxclient_dest/1099.vboxclient" f
|
---|
159 | cp "$vboxclient_src/1099.vboxclient" "$vboxclient_dest/1099.vboxclient"
|
---|
160 | chmod a+rx "$vboxclient_dest/1099.vboxclient"
|
---|
161 | elif test -d "/usr/share/gnome/autostart"; then
|
---|
162 | vboxclient_dest="/usr/share/gnome/autostart"
|
---|
163 | /usr/sbin/installf -c none $PKGINST "$vboxclient_dest/vboxclient.desktop" f
|
---|
164 | cp "$vboxclient_src/vboxclient.desktop" "$vboxclient_dest/vboxclient.desktop"
|
---|
165 | else
|
---|
166 | echo "*** Failed to configure client!! Couldn't find autostart directory."
|
---|
167 | retval=2
|
---|
168 | fi
|
---|
169 |
|
---|
170 |
|
---|
171 | # Remove redundant files
|
---|
172 | /usr/sbin/removef $PKGINST $vboxadditions_path/etc/devlink.tab 1>/dev/null
|
---|
173 | /usr/sbin/removef $PKGINST $vboxadditions_path/etc 1>/dev/null
|
---|
174 | rm -rf $vboxadditions_path/etc
|
---|
175 |
|
---|
176 | # Finalize
|
---|
177 | /usr/sbin/removef -f $PKGINST
|
---|
178 | /usr/sbin/installf -f $PKGINST
|
---|
179 |
|
---|
180 |
|
---|
181 | # Setup our VBoxService SMF service
|
---|
182 | echo "Configuring service..."
|
---|
183 |
|
---|
184 | /usr/sbin/svccfg import /var/svc/manifest/system/virtualbox/vboxservice.xml
|
---|
185 | /usr/sbin/svcadm enable svc:/system/virtualbox/vboxservice
|
---|
186 |
|
---|
187 | /usr/sbin/devfsadm -i vboxguest
|
---|
188 |
|
---|
189 | echo "Done."
|
---|
190 | if test $retval -eq 0; then
|
---|
191 | echo "Please re-login to activate the X11 guest additions."
|
---|
192 | echo "If you have just un-installed the previous guest additions a REBOOT is required."
|
---|
193 | fi
|
---|
194 | exit $retval
|
---|
195 |
|
---|