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