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