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 | osrevision=`uname -r`
|
---|
26 | if test "$currentisa" = "i86xpv"; then
|
---|
27 | echo "## VirtualBox cannot run under xVM Dom0! Fatal Error, Aborting installation!"
|
---|
28 | exit 2
|
---|
29 | fi
|
---|
30 |
|
---|
31 | currentzone=`zonename`
|
---|
32 | if test "$currentzone" = "global"; then
|
---|
33 | echo "Configuring VirtualBox kernel module(s)..."
|
---|
34 | /opt/VirtualBox/vboxdrv.sh stopall silentunload
|
---|
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 | fi
|
---|
45 | fi
|
---|
46 |
|
---|
47 | # Fail on any errors while unloading previous modules because it makes it very hard to
|
---|
48 | # track problems when older vboxdrv is hanging about in memory and add_drv of the new
|
---|
49 | # one suceeds and it appears as though the new one is being used.
|
---|
50 | if test "$rc" -ne 0; then
|
---|
51 | echo "## Configuration failed. Aborting installation."
|
---|
52 | exit 2
|
---|
53 | fi
|
---|
54 | fi
|
---|
55 |
|
---|
56 | # create links
|
---|
57 | echo "Creating links..."
|
---|
58 | if test -f /opt/VirtualBox/VirtualBox; then
|
---|
59 | /usr/sbin/installf -c none $PKGINST /usr/bin/VirtualBox=/opt/VirtualBox/VBox.sh s
|
---|
60 | # Qt links
|
---|
61 | /usr/sbin/installf -c none $PKGINST /usr/bin/VBoxQtconfig=/opt/VirtualBox/VBox.sh s
|
---|
62 | fi
|
---|
63 | /usr/sbin/installf -c none $PKGINST /usr/bin/VBoxManage=/opt/VirtualBox/VBox.sh s
|
---|
64 | /usr/sbin/installf -c none $PKGINST /usr/bin/VBoxSDL=/opt/VirtualBox/VBox.sh s
|
---|
65 | if test -f /opt/VirtualBox/VBoxHeadless; then
|
---|
66 | /usr/sbin/installf -c none $PKGINST /usr/bin/VBoxHeadless=/opt/VirtualBox/VBox.sh s
|
---|
67 | if test -f /opt/VirtualBox/VBoxVRDP.so; then
|
---|
68 | /usr/sbin/installf -c none $PKGINST /usr/bin/VBoxVRDP=/opt/VirtualBox/VBox.sh s
|
---|
69 | fi
|
---|
70 | fi
|
---|
71 |
|
---|
72 | if test "$currentzone" = "global"; then
|
---|
73 | # Web service
|
---|
74 | if test -f /var/svc/manifest/application/virtualbox/webservice.xml; then
|
---|
75 | /usr/sbin/svccfg import /var/svc/manifest/application/virtualbox/webservice.xml
|
---|
76 | /usr/sbin/svcadm disable -s svc:/application/virtualbox/webservice:default
|
---|
77 | fi
|
---|
78 |
|
---|
79 | # add vboxdrv to the devlink.tab
|
---|
80 | sed -e '
|
---|
81 | /name=vboxdrv/d' /etc/devlink.tab > /etc/devlink.vbox
|
---|
82 | echo "type=ddi_pseudo;name=vboxdrv \D" >> /etc/devlink.vbox
|
---|
83 | mv -f /etc/devlink.vbox /etc/devlink.tab
|
---|
84 |
|
---|
85 | # create the device link
|
---|
86 | /usr/sbin/devfsadm -i vboxdrv
|
---|
87 |
|
---|
88 | # We need to touch the desktop link in order to add it to the menu right away
|
---|
89 | if test -f "/usr/share/applications/virtualbox.desktop"; then
|
---|
90 | touch /usr/share/applications/virtualbox.desktop
|
---|
91 | fi
|
---|
92 |
|
---|
93 | # Zone access service only necessary for Solaris 10
|
---|
94 | if test "$osrevision" = "5.10"; then
|
---|
95 | /usr/sbin/installf -c none $PKGINST /var/svc/manifest/application/virtualbox/zoneaccess.xml f
|
---|
96 | cp /opt/VirtualBox/virtualbox-zoneaccess.xml /var/svc/manifest/application/virtualbox/zoneaccess.xml
|
---|
97 |
|
---|
98 | /usr/sbin/svccfg import /var/svc/manifest/application/virtualbox/zoneaccess.xml
|
---|
99 | /usr/sbin/svcadm enable -s svc:/application/virtualbox/zoneaccess
|
---|
100 | else
|
---|
101 | /usr/sbin/removef $PKGINST /opt/VirtualBox/zoneaccess.sh 1>/dev/null 2>/dev/null
|
---|
102 | rm -f /opt/VirtualBox/zoneaccess.sh
|
---|
103 | fi
|
---|
104 |
|
---|
105 | /usr/sbin/removef $PKGINST /opt/VirtualBox/virtualbox-zoneaccess.xml 1>/dev/null 2>/dev/null
|
---|
106 | rm -f /opt/VirtualBox/virtualbox-zoneaccess.xml
|
---|
107 | fi
|
---|
108 |
|
---|
109 | /usr/sbin/removef -f $PKGINST
|
---|
110 | /usr/sbin/installf -f $PKGINST
|
---|
111 |
|
---|
112 | echo "Done."
|
---|
113 |
|
---|
114 | # return 20 = requires reboot, 2 = partial failure, 0 = success
|
---|
115 | exit 0
|
---|
116 |
|
---|