VirtualBox

source: vbox/trunk/src/VBox/Installer/solaris/ipsinstall.sh@ 22003

Last change on this file since 22003 was 22003, checked in by vboxsync, 15 years ago

Solaris/Installer: redirect stderr to /dev/null

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
File size: 7.4 KB
Line 
1#!/bin/sh
2## @file
3# Sun VirtualBox - Manual IPS/pkg(5) postinstall script for Solaris.
4#
5# If you just installed VirtualBox using IPS/pkg(5), you should run this
6# script once to avoid rebooting the system before using VirtualBox.
7#
8
9#
10# Copyright (C) 2009 Sun Microsystems, Inc.
11#
12# This file is part of VirtualBox Open Source Edition (OSE), as
13# available from http://www.virtualbox.org. This file is free software;
14# you can redistribute it and/or modify it under the terms of the GNU
15# General Public License (GPL) as published by the Free Software
16# Foundation, in version 2 as it comes in the "COPYING" file of the
17# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
18# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
19#
20# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
21# Clara, CA 95054 USA or visit http://www.sun.com if you need
22# additional information or have any questions.
23#
24
25check_root()
26{
27 idbin=/usr/xpg4/bin/id
28 if test ! -f "$idbin"; then
29 found=`which id`
30 if test ! -f "$found" || test ! -h "$found"; then
31 echo "## Failed to find a suitable user id binary."
32 exit 1
33 else
34 idbin=$found
35 fi
36 fi
37
38 if test `$idbin -u` -ne 0; then
39 echo "## This script must be run with administrator privileges."
40 exit 2
41 fi
42}
43
44check_zone()
45{
46 currentzone=`zonename`
47 if test "$currentzone" != "global"; then
48 echo "## This script must be run from the global zone."
49 exit 3
50 fi
51}
52
53install_python_bindings()
54{
55 PYTHONBIN=$1
56 if test -x "$PYTHONBIN"; then
57 VBOX_INSTALL_PATH=/opt/VirtualBox
58 export VBOX_INSTALL_PATH
59 cd /opt/VirtualBox/sdk/installer
60 $PYTHONBIN ./vboxapisetup.py install > /dev/null
61 return 0
62 fi
63 return 1
64}
65
66check_root
67check_zone
68
69osversion=`uname -r`
70
71BIN_REMDRV=/usr/sbin/rem_drv
72BIN_ADDDRV=/usr/sbin/add_drv
73BIN_MODLOAD=/usr/sbin/modload
74BIN_DEVFSADM=/usr/sbin/devfsadm
75
76# Halt services in case of installation update
77zoneaccessfound=`svcs -a | grep "virtualbox/zoneaccess"`
78if test ! -z "$zoneaccessfound"; then
79 /usr/sbin/svcadm disable -s svc:/application/virtualbox/zoneaccess
80fi
81
82# Remove drivers ignoring errors as they are not really loaded
83# just updated various boot archive files without really loading
84# them... But we _want_ them to be loaded.
85echo "Removing stale driver configurations..."
86
87$BIN_REMDRV vboxflt > /dev/null 2>&1
88/sbin/ifconfig vboxnet0 unplumb > /dev/null 2>&1
89$BIN_REMDRV vboxnet > /dev/null 2>&1
90$BIN_REMDRV vboxusbmon > /dev/null 2>&1
91$BIN_REMDRV vboxdrv > /dev/null 2>&1
92
93echo "Loading VirtualBox Drivers:"
94# Add drivers the proper way and load them immediately
95/opt/VirtualBox/vboxdrv.sh start
96rc=$?
97if test "$rc" -eq 0; then
98 # Add vboxdrv to the devlink.tab
99 sed -e '/name=vboxdrv/d' /etc/devlink.tab > /etc/devlink.vbox
100 echo "type=ddi_pseudo;name=vboxdrv \D" >> /etc/devlink.vbox
101 mv -f /etc/devlink.vbox /etc/devlink.tab
102
103 # Create the device link
104 /usr/sbin/devfsadm -i vboxdrv
105 rc=$?
106
107 if test "$rc" -eq 0; then
108 # Load VBoxNetAdapter vboxnet
109 if test -f /platform/i86pc/kernel/drv/vboxnet.conf; then
110 /opt/VirtualBox/vboxdrv.sh netstart
111 rc=$?
112
113 if test "$rc" -eq 0; then
114 # nwam/dhcpagent fix
115 nwamfile=/etc/nwam/llp
116 nwambackupfile=$nwamfile.vbox
117 if test -f "$nwamfile"; then
118 sed -e '/vboxnet/d' $nwamfile > $nwambackupfile
119 echo "vboxnet0 static 192.168.56.1" >> $nwambackupfile
120 mv -f $nwambackupfile $nwamfile
121 echo " -> patched /etc/nwam/llp to use static IP for vboxnet0"
122 fi
123 fi
124 fi
125 else
126 echo "## Failed to create device link in /dev for vboxdrv"
127 fi
128
129 # Load VBoxNetFilter vboxflt
130 if test "$rc" -eq 0 && test -f /platform/i86pc/kernel/drv/vboxflt.conf; then
131 /opt/VirtualBox/vboxdrv.sh fltstart
132 rc=$?
133 fi
134
135 # Load VBoxUSBMonitor vboxusbmon (do NOT load for Solaris 10)
136 if test "$rc" -eq 0 && test -f /platform/i86pc/kernel/drv/vboxusbmon.conf && test "$osversion" != "5.10"; then
137 /opt/VirtualBox/vboxdrv.sh usbstart
138 rc=$?
139 if test "$rc" -eq 0; then
140
141 # Add vboxusbmon to the devlink.tab
142 sed -e '/name=vboxusbmon/d' /etc/devlink.tab > /etc/devlink.vbox
143 echo "type=ddi_pseudo;name=vboxusbmon \D" >> /etc/devlink.vbox
144 mv -f /etc/devlink.vbox /etc/devlink.tab
145
146 /usr/sbin/devfsadm -i vboxusbmon
147 rc=$?
148 if test "$rc" -ne 0; then
149 echo "## Failed to create device link in /dev for vboxusbmon"
150 fi
151 fi
152 fi
153fi
154
155rc2=0
156if test -f "/var/svc/manifest/application/virtualbox/virtualbox-zoneaccess.xml"; then
157 /usr/sbin/svccfg import /var/svc/manifest/application/virtualbox/virtualbox-zoneaccess.xml
158 rc2=$?
159 if test "$rc2" -eq 0; then
160 /usr/sbin/svcadm enable -s svc:/application/virtualbox/zoneaccess
161 rc2=$?
162 if test "$rc2" -eq 0; then
163 echo "Enabled VirtualBox zone service."
164 else
165 echo "## Failed to enable VirtualBox zone service."
166 fi
167 else
168 echo "## Failed to import VirtualBox zone service."
169 fi
170fi
171
172# We need to touch the desktop link in order to add it to the menu right away
173if test -f "/usr/share/applications/virtualbox.desktop"; then
174 touch /usr/share/applications/virtualbox.desktop
175 echo "Added VirtualBox shortcut menu item."
176fi
177
178# Install python bindings
179rc3=0
180if test -f "/opt/VirtualBox/sdk/installer/vboxapisetup.py" || test -h "/opt/VirtualBox/sdk/installer/vboxapisetup.py"; then
181 PYTHONBIN=`which python 2>/dev/null`
182 if test -f "$PYTHONBIN" || test -h "$PYTHONBIN"; then
183 echo "Installing Python bindings..."
184
185 INSTALLEDIT=1
186 PYTHONBIN=`which python2.4 2>/dev/null`
187 install_python_bindings "$PYTHONBIN"
188 if test "$?" -eq 0; then
189 INSTALLEDIT=0
190 fi
191 PYTHONBIN=`which python2.5 2>/dev/null`
192 install_python_bindings "$PYTHONBIN"
193 if test "$?" -eq 0; then
194 INSTALLEDIT=0
195 fi
196 PYTHONBIN=`which python2.6 2>/dev/null`
197 install_python_bindings "$PYTHONBIN"
198 if test "$?" -eq 0; then
199 INSTALLEDIT=0
200 fi
201
202 # remove files installed by Python build
203 rm -rf /opt/VirtualBox/sdk/installer/build
204
205 if test "$INSTALLEDIT" -ne 0; then
206 echo "** No suitable Python version found. Requires Python 2.4, 2.5 or 2.6."
207 fi
208 rc3=$INSTALLEDIT
209 else
210 echo "** WARNING! Python not found, skipped installed Python bindings."
211 echo " Manually run '/opt/VirtualBox/sdk/installer/vboxapisetup.py install'"
212 echo " to install the bindings when python is available."
213 rc3=1
214 fi
215fi
216
217# Update boot archive (only when driver's were all successfully loaded)
218rc4=0
219if test "$rc" -eq 0; then
220 BOOTADMBIN=/sbin/bootadm
221 if test -f "$BOOTADMBIN" || test -h "$BOOTADMBIN"; then
222 echo "Updating boot archive..."
223 $BOOTADMBIN update-archive > /dev/null
224 rc4=$?
225 fi
226fi
227
228echo "Done."
229if test "$rc" -eq 0 && test "$rc2" -eq 0 && test "$rc3" -eq 0 && test "$rc4" -eq 0; then
230 echo "Post install successfully completed."
231else
232 echo "Post install completed but with some errors."
233 # 20 - partially failed installed
234 $rc=20
235fi
236exit $rc
237
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette