1 | #!/bin/sh
|
---|
2 | ## @file
|
---|
3 | # Sun xVM VirtualBox
|
---|
4 | # VirtualBox postinstall script for Solaris.
|
---|
5 | #
|
---|
6 |
|
---|
7 | #
|
---|
8 | # Copyright (C) 2007-2008 Sun Microsystems, Inc.
|
---|
9 | #
|
---|
10 | # This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
11 | # available from http://www.virtualbox.org. This file is free software;
|
---|
12 | # you can redistribute it and/or modify it under the terms of the GNU
|
---|
13 | # General Public License (GPL) as published by the Free Software
|
---|
14 | # Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
15 | # VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
16 | # hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 | #
|
---|
18 | # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
19 | # Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
20 | # additional information or have any questions.
|
---|
21 | #
|
---|
22 |
|
---|
23 | # Check for xVM/Xen
|
---|
24 | currentisa=`uname -i`
|
---|
25 | if test "$currentisa" = "i86xpv"; then
|
---|
26 | echo "## VirtualBox cannot run under xVM Dom0! Fatal Error, Aborting installation!"
|
---|
27 | exit 2
|
---|
28 | fi
|
---|
29 |
|
---|
30 | osversion=`uname -r`
|
---|
31 | currentzone=`zonename`
|
---|
32 | if test "$currentzone" = "global"; then
|
---|
33 | echo "Configuring VirtualBox kernel modules..."
|
---|
34 | /opt/VirtualBox/vboxdrv.sh stopall silentunload checkarch
|
---|
35 | rc=$?
|
---|
36 | if test "$rc" -eq 0; then
|
---|
37 | /opt/VirtualBox/vboxdrv.sh start
|
---|
38 | rc=$?
|
---|
39 | if test "$rc" -eq 0; then
|
---|
40 | if test -f /platform/i86pc/kernel/drv/vboxflt.conf; then
|
---|
41 | /opt/VirtualBox/vboxdrv.sh fltstart
|
---|
42 | rc=$?
|
---|
43 | fi
|
---|
44 |
|
---|
45 | if test -f /platform/i86pc/kernel/drv/vboxusbmon.conf && test "$osversion" != "5.10"; then
|
---|
46 | /opt/VirtualBox/vboxdrv.sh usbstart
|
---|
47 | rc=$?
|
---|
48 | if test "$rc" -eq 0; then
|
---|
49 | # add vboxusbmon to the devlink.tab
|
---|
50 | sed -e '
|
---|
51 | /name=vboxusbmon/d' /etc/devlink.tab > /etc/devlink.vbox
|
---|
52 | echo "type=ddi_pseudo;name=vboxusbmon \D" >> /etc/devlink.vbox
|
---|
53 | mv -f /etc/devlink.vbox /etc/devlink.tab
|
---|
54 | fi
|
---|
55 | fi
|
---|
56 | fi
|
---|
57 | fi
|
---|
58 |
|
---|
59 | # Fail on any errors while unloading previous modules because it makes it very hard to
|
---|
60 | # track problems when older vboxdrv is hanging about in memory and add_drv of the new
|
---|
61 | # one suceeds and it appears as though the new one is being used.
|
---|
62 | if test "$rc" -ne 0; then
|
---|
63 | echo "## Configuration failed. Aborting installation."
|
---|
64 | exit 2
|
---|
65 | fi
|
---|
66 | fi
|
---|
67 |
|
---|
68 | # create symlinks and hardlinks
|
---|
69 | VBOXBASEDIR="/opt/VirtualBox"
|
---|
70 | SYSISAEXEC="/usr/lib/isaexec"
|
---|
71 | echo "Creating links..."
|
---|
72 | if test -f "$VBOXBASEDIR/amd64/VirtualBox" || test -f "$VBOXBASEDIR/i386/VirtualBox"; then
|
---|
73 | /usr/sbin/installf -c none $PKGINST /usr/bin/VirtualBox=$VBOXBASEDIR/VBox.sh s
|
---|
74 | /usr/sbin/installf -c none $PKGINST /usr/bin/VBoxQtconfig=$VBOXBASEDIR/VBox.sh s
|
---|
75 | fi
|
---|
76 | /usr/sbin/installf -c none $PKGINST /usr/bin/VBoxManage=$VBOXBASEDIR/VBox.sh s
|
---|
77 | /usr/sbin/installf -c none $PKGINST /usr/bin/VBoxSDL=$VBOXBASEDIR/VBox.sh s
|
---|
78 | if test -f "$VBOXBASEDIR/amd64/VBoxHeadless" || test -f "$VBOXBASEDIR/i386/VBoxHeadless"; then
|
---|
79 | if test -d $VBOXBASEDIR/amd64; then
|
---|
80 | /usr/sbin/installf -c none $PKGINST $VBOXBASEDIR/amd64/rdesktop-vrdp-keymaps=$VBOXBASEDIR/rdesktop-vrdp-keymaps s
|
---|
81 | /usr/sbin/installf -c none $PKGINST $VBOXBASEDIR/amd64/additions=$VBOXBASEDIR/additions s
|
---|
82 | if test -f $VBOXBASEDIR/VirtualBox.chm; then
|
---|
83 | /usr/sbin/installf -c none $PKGINST $VBOXBASEDIR/amd64/VirtualBox.chm=$VBOXBASEDIR/VirtualBox.chm s
|
---|
84 | fi
|
---|
85 | fi
|
---|
86 | if test -d $VBOXBASEDIR/i386; then
|
---|
87 | /usr/sbin/installf -c none $PKGINST $VBOXBASEDIR/i386/rdesktop-vrdp-keymaps=$VBOXBASEDIR/rdesktop-vrdp-keymaps s
|
---|
88 | /usr/sbin/installf -c none $PKGINST $VBOXBASEDIR/i386/additions=$VBOXBASEDIR/additions s
|
---|
89 | if test -f $VBOXBASEDIR/VirtualBox.chm; then
|
---|
90 | /usr/sbin/installf -c none $PKGINST $VBOXBASEDIR/i386/VirtualBox.chm=$VBOXBASEDIR/VirtualBox.chm s
|
---|
91 | fi
|
---|
92 | fi
|
---|
93 | /usr/sbin/installf -c none $PKGINST /usr/bin/VBoxHeadless=/$VBOXBASEDIR/VBox.sh s
|
---|
94 | /usr/sbin/installf -c none $PKGINST /usr/bin/VBoxVRDP=$VBOXBASEDIR/VBox.sh s
|
---|
95 | fi
|
---|
96 |
|
---|
97 | if test "$currentzone" = "global"; then
|
---|
98 | # Web service
|
---|
99 | if test -f /var/svc/manifest/application/virtualbox/webservice.xml; then
|
---|
100 | /usr/sbin/svccfg import /var/svc/manifest/application/virtualbox/webservice.xml
|
---|
101 | /usr/sbin/svcadm disable -s svc:/application/virtualbox/webservice:default
|
---|
102 | fi
|
---|
103 |
|
---|
104 | # add vboxdrv to the devlink.tab
|
---|
105 | sed -e '
|
---|
106 | /name=vboxdrv/d' /etc/devlink.tab > /etc/devlink.vbox
|
---|
107 | echo "type=ddi_pseudo;name=vboxdrv \D" >> /etc/devlink.vbox
|
---|
108 | mv -f /etc/devlink.vbox /etc/devlink.tab
|
---|
109 |
|
---|
110 | # create the device link
|
---|
111 | /usr/sbin/devfsadm -i vboxdrv
|
---|
112 |
|
---|
113 | # don't create link for Solaris 10
|
---|
114 | if test -f /platform/i86pc/kernel/drv/vboxusbmon.conf && test "$osversion" != "5.10"; then
|
---|
115 | /usr/sbin/devfsadm -i vboxusbmon
|
---|
116 | fi
|
---|
117 | sync
|
---|
118 |
|
---|
119 | # We need to touch the desktop link in order to add it to the menu right away
|
---|
120 | if test -f "/usr/share/applications/virtualbox.desktop"; then
|
---|
121 | touch /usr/share/applications/virtualbox.desktop
|
---|
122 | fi
|
---|
123 |
|
---|
124 | # Zone access service
|
---|
125 | if test -f /var/svc/manifest/application/virtualbox/zoneaccess.xml; then
|
---|
126 | /usr/sbin/svccfg import /var/svc/manifest/application/virtualbox/zoneaccess.xml
|
---|
127 | /usr/sbin/svcadm enable -s svc:/application/virtualbox/zoneaccess
|
---|
128 | fi
|
---|
129 | fi
|
---|
130 |
|
---|
131 | /usr/sbin/installf -f $PKGINST
|
---|
132 |
|
---|
133 | echo "Done."
|
---|
134 |
|
---|
135 | # return 20 = requires reboot, 2 = partial failure, 0 = success
|
---|
136 | exit 0
|
---|
137 |
|
---|