1 | #!/bin/sh
|
---|
2 | ## @file
|
---|
3 | # Sun VirtualBox
|
---|
4 | # VirtualBox postinstall script for Solaris.
|
---|
5 | #
|
---|
6 |
|
---|
7 | #
|
---|
8 | # Copyright (C) 2007-2009 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 |
|
---|
40 | # VBoxDrv loaded successfully, proceed with the rest...
|
---|
41 | if test "$rc" -eq 0; then
|
---|
42 | # Load VBoxNetAdapter vboxnet
|
---|
43 | if test -f /platform/i86pc/kernel/drv/vboxnet.conf; then
|
---|
44 | /opt/VirtualBox/vboxdrv.sh netstart
|
---|
45 | rc=$?
|
---|
46 |
|
---|
47 | # nwam/dhcpagent fix
|
---|
48 | if test "$rc" -eq 0 && test -f /etc/nwam/llp; then
|
---|
49 | sed -e '/vboxnet/d' /etc/nwam/llp > /etc/nwam/llp.vbox
|
---|
50 | echo "vboxnet0 static 192.168.56.1" >> /etc/nwam/llp.vbox
|
---|
51 | mv -f /etc/nwam/llp.vbox /etc/nwam/llp
|
---|
52 | fi
|
---|
53 | fi
|
---|
54 |
|
---|
55 | # Load VBoxNetFilter vboxflt
|
---|
56 | if test -f /platform/i86pc/kernel/drv/vboxflt.conf; then
|
---|
57 | /opt/VirtualBox/vboxdrv.sh fltstart
|
---|
58 | rc=$?
|
---|
59 | fi
|
---|
60 |
|
---|
61 | # Load VBoxUSBMon vboxusbmon (do NOT load for Solaris 10)
|
---|
62 | if test -f /platform/i86pc/kernel/drv/vboxusbmon.conf && test "$osversion" != "5.10"; then
|
---|
63 | /opt/VirtualBox/vboxdrv.sh usbstart
|
---|
64 | rc=$?
|
---|
65 | if test "$rc" -eq 0; then
|
---|
66 | # Add vboxusbmon to the devlink.tab
|
---|
67 | sed -e '
|
---|
68 | /name=vboxusbmon/d' /etc/devlink.tab > /etc/devlink.vbox
|
---|
69 | echo "type=ddi_pseudo;name=vboxusbmon \D" >> /etc/devlink.vbox
|
---|
70 | mv -f /etc/devlink.vbox /etc/devlink.tab
|
---|
71 | fi
|
---|
72 | fi
|
---|
73 | fi
|
---|
74 | fi
|
---|
75 |
|
---|
76 | # Fail on any errors while unloading previous modules because it makes it very hard to
|
---|
77 | # track problems when older vboxdrv is hanging about in memory and add_drv of the new
|
---|
78 | # one suceeds and it appears as though the new one is being used.
|
---|
79 | if test "$rc" -ne 0; then
|
---|
80 | echo "## Configuration failed. Aborting installation."
|
---|
81 | exit 2
|
---|
82 | fi
|
---|
83 | fi
|
---|
84 |
|
---|
85 | VBOXBASEDIR="/opt/VirtualBox"
|
---|
86 | echo "Configuring services and drivers..."
|
---|
87 |
|
---|
88 | if test "$currentzone" = "global"; then
|
---|
89 | # Web service
|
---|
90 | if test -f /var/svc/manifest/application/virtualbox/webservice.xml; then
|
---|
91 | /usr/sbin/svccfg import /var/svc/manifest/application/virtualbox/webservice.xml
|
---|
92 | /usr/sbin/svcadm disable -s svc:/application/virtualbox/webservice:default
|
---|
93 | fi
|
---|
94 |
|
---|
95 | # Add vboxdrv to the devlink.tab
|
---|
96 | sed -e '
|
---|
97 | /name=vboxdrv/d' /etc/devlink.tab > /etc/devlink.vbox
|
---|
98 | echo "type=ddi_pseudo;name=vboxdrv \D" >> /etc/devlink.vbox
|
---|
99 | mv -f /etc/devlink.vbox /etc/devlink.tab
|
---|
100 |
|
---|
101 | # Create the device link
|
---|
102 | /usr/sbin/devfsadm -i vboxdrv
|
---|
103 |
|
---|
104 | # Don't create link for Solaris 10
|
---|
105 | if test -f /platform/i86pc/kernel/drv/vboxusbmon.conf && test "$osversion" != "5.10"; then
|
---|
106 | /usr/sbin/devfsadm -i vboxusbmon
|
---|
107 | fi
|
---|
108 | sync
|
---|
109 |
|
---|
110 | # We need to touch the desktop link in order to add it to the menu right away
|
---|
111 | if test -f "/usr/share/applications/virtualbox.desktop"; then
|
---|
112 | touch /usr/share/applications/virtualbox.desktop
|
---|
113 | fi
|
---|
114 |
|
---|
115 | # Zone access service
|
---|
116 | if test -f /var/svc/manifest/application/virtualbox/zoneaccess.xml; then
|
---|
117 | /usr/sbin/svccfg import /var/svc/manifest/application/virtualbox/zoneaccess.xml
|
---|
118 | /usr/sbin/svcadm enable -s svc:/application/virtualbox/zoneaccess
|
---|
119 | fi
|
---|
120 | fi
|
---|
121 |
|
---|
122 | /usr/sbin/installf -f $PKGINST
|
---|
123 |
|
---|
124 | echo "Done."
|
---|
125 |
|
---|
126 | # return 20 = requires reboot, 2 = partial failure, 0 = success
|
---|
127 | exit 0
|
---|
128 |
|
---|