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