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 | currentzone=`zonename`
|
---|
31 | if test "$currentzone" = "global"; then
|
---|
32 | echo "Configuring VirtualBox kernel modules..."
|
---|
33 | /opt/VirtualBox/vboxdrv.sh stopall silentunload checkarch
|
---|
34 | rc=$?
|
---|
35 | if test "$rc" -eq 0; then
|
---|
36 | /opt/VirtualBox/vboxdrv.sh start
|
---|
37 | rc=$?
|
---|
38 | if test "$rc" -eq 0; then
|
---|
39 | if test -f /platform/i86pc/kernel/drv/vboxflt.conf; then
|
---|
40 | /opt/VirtualBox/vboxdrv.sh fltstart
|
---|
41 | rc=$?
|
---|
42 | fi
|
---|
43 | fi
|
---|
44 | fi
|
---|
45 |
|
---|
46 | # Fail on any errors while unloading previous modules because it makes it very hard to
|
---|
47 | # track problems when older vboxdrv is hanging about in memory and add_drv of the new
|
---|
48 | # one suceeds and it appears as though the new one is being used.
|
---|
49 | if test "$rc" -ne 0; then
|
---|
50 | echo "## Configuration failed. Aborting installation."
|
---|
51 | exit 2
|
---|
52 | fi
|
---|
53 | fi
|
---|
54 |
|
---|
55 | # create symlinks and hardlinks
|
---|
56 | VBOXBASEDIR="/opt/VirtualBox"
|
---|
57 | SYSISAEXEC="/usr/lib/isaexec"
|
---|
58 | echo "Creating links..."
|
---|
59 | if test -f "$VBOXBASEDIR/amd64/VirtualBox" || test -f "$VBOXBASEDIR/i386/VirtualBox"; then
|
---|
60 | /usr/sbin/installf -c none $PKGINST /usr/bin/VirtualBox=$VBOXBASEDIR/VBox.sh s
|
---|
61 | /usr/sbin/installf -c none $PKGINST /usr/bin/VBoxQtconfig=$VBOXBASEDIR/VBox.sh s
|
---|
62 | fi
|
---|
63 | /usr/sbin/installf -c none $PKGINST /usr/bin/VBoxManage=$VBOXBASEDIR/VBox.sh s
|
---|
64 | /usr/sbin/installf -c none $PKGINST /usr/bin/VBoxSDL=$VBOXBASEDIR/VBox.sh s
|
---|
65 | if test -f "$VBOXBASEDIR/amd64/VBoxHeadless" || test -f "$VBOXBASEDIR/i386/VBoxHeadless"; then
|
---|
66 | if test -d $VBOXBASEDIR/amd64; then
|
---|
67 | /usr/sbin/installf -c none $PKGINST $VBOXBASEDIR/amd64/rdesktop-vrdp-keymaps=$VBOXBASEDIR/rdesktop-vrdp-keymaps s
|
---|
68 | /usr/sbin/installf -c none $PKGINST $VBOXBASEDIR/amd64/additions=$VBOXBASEDIR/additions s
|
---|
69 | if test -f $VBOXBASEDIR/VirtualBox.chm; then
|
---|
70 | /usr/sbin/installf -c none $PKGINST $VBOXBASEDIR/amd64/VirtualBox.chm=$VBOXBASEDIR/VirtualBox.chm s
|
---|
71 | fi
|
---|
72 | fi
|
---|
73 | if test -d $VBOXBASEDIR/i386; then
|
---|
74 | /usr/sbin/installf -c none $PKGINST $VBOXBASEDIR/i386/rdesktop-vrdp-keymaps=$VBOXBASEDIR/rdesktop-vrdp-keymaps s
|
---|
75 | /usr/sbin/installf -c none $PKGINST $VBOXBASEDIR/i386/additions=$VBOXBASEDIR/additions s
|
---|
76 | if test -f $VBOXBASEDIR/VirtualBox.chm; then
|
---|
77 | /usr/sbin/installf -c none $PKGINST $VBOXBASEDIR/i386/VirtualBox.chm=$VBOXBASEDIR/VirtualBox.chm s
|
---|
78 | fi
|
---|
79 | fi
|
---|
80 | /usr/sbin/installf -c none $PKGINST /usr/bin/VBoxHeadless=/$VBOXBASEDIR/VBox.sh s
|
---|
81 | /usr/sbin/installf -c none $PKGINST /usr/bin/VBoxVRDP=$VBOXBASEDIR/VBox.sh s
|
---|
82 | fi
|
---|
83 |
|
---|
84 | if test "$currentzone" = "global"; then
|
---|
85 | # Web service
|
---|
86 | if test -f /var/svc/manifest/application/virtualbox/webservice.xml; then
|
---|
87 | /usr/sbin/svccfg import /var/svc/manifest/application/virtualbox/webservice.xml
|
---|
88 | /usr/sbin/svcadm disable -s svc:/application/virtualbox/webservice:default
|
---|
89 | fi
|
---|
90 |
|
---|
91 | # add vboxdrv to the devlink.tab
|
---|
92 | sed -e '
|
---|
93 | /name=vboxdrv/d' /etc/devlink.tab > /etc/devlink.vbox
|
---|
94 | echo "type=ddi_pseudo;name=vboxdrv \D" >> /etc/devlink.vbox
|
---|
95 | mv -f /etc/devlink.vbox /etc/devlink.tab
|
---|
96 |
|
---|
97 | # create the device link
|
---|
98 | /usr/sbin/devfsadm -i vboxdrv
|
---|
99 | sync
|
---|
100 |
|
---|
101 | # We need to touch the desktop link in order to add it to the menu right away
|
---|
102 | if test -f "/usr/share/applications/virtualbox.desktop"; then
|
---|
103 | touch /usr/share/applications/virtualbox.desktop
|
---|
104 | fi
|
---|
105 |
|
---|
106 | # Zone access service
|
---|
107 | if test -f /var/svc/manifest/application/virtualbox/zoneaccess.xml; then
|
---|
108 | /usr/sbin/svccfg import /var/svc/manifest/application/virtualbox/zoneaccess.xml
|
---|
109 | /usr/sbin/svcadm enable -s svc:/application/virtualbox/zoneaccess
|
---|
110 | fi
|
---|
111 | fi
|
---|
112 |
|
---|
113 | /usr/sbin/installf -f $PKGINST
|
---|
114 |
|
---|
115 | echo "Done."
|
---|
116 |
|
---|
117 | # return 20 = requires reboot, 2 = partial failure, 0 = success
|
---|
118 | exit 0
|
---|
119 |
|
---|