VirtualBox

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

Last change on this file since 20491 was 20490, checked in by vboxsync, 16 years ago

solaris/ipsinstall.sh: file description at the top of the file where it can easily be found.

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
File size: 6.0 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 | grep "no id"`
30 if test ! -z "$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
53check_root
54check_zone
55
56osversion=`uname -r`
57
58BIN_REMDRV=/usr/sbin/rem_drv
59BIN_ADDDRV=/usr/sbin/add_drv
60BIN_MODLOAD=/usr/sbin/modload
61BIN_DEVFSADM=/usr/sbin/devfsadm
62
63# Halt services in case of installation update
64zoneaccessfound=`svcs -a | grep "virtualbox/zoneaccess"`
65if test ! -z "$zoneaccessfound"; then
66 /usr/sbin/svcadm disable -s svc:/application/virtualbox/zoneaccess
67fi
68
69# Remove drivers ignoring errors as they are not really loaded
70# just updated various boot archive files without really loading
71# them... But we _want_ them to be loaded.
72echo "Removing stale driver configurations..."
73
74$BIN_REMDRV vboxflt > /dev/null 2>&1
75/sbin/ifconfig vboxnet0 unplumb > /dev/null 2>&1
76$BIN_REMDRV vboxnet > /dev/null 2>&1
77$BIN_REMDRV vboxusbmon > /dev/null 2>&1
78$BIN_REMDRV vboxdrv > /dev/null 2>&1
79
80echo "Loading VirtualBox Drivers:"
81# Add drivers the proper way and load them immediately
82/opt/VirtualBox/vboxdrv.sh start
83rc=$?
84if test "$rc" -eq 0; then
85 # Add vboxdrv to the devlink.tab
86 sed -e '/name=vboxdrv/d' /etc/devlink.tab > /etc/devlink.vbox
87 echo "type=ddi_pseudo;name=vboxdrv \D" >> /etc/devlink.vbox
88 mv -f /etc/devlink.vbox /etc/devlink.tab
89
90 # Create the device link
91 /usr/sbin/devfsadm -i vboxdrv
92
93 # Load VBoxNetAdapter vboxnet
94 if test -f /platform/i86pc/kernel/drv/vboxnet.conf; then
95 /opt/VirtualBox/vboxdrv.sh netstart
96 rc=$?
97
98 if test "$rc" -eq 0; then
99 # nwam/dhcpagent fix
100 nwamfile=/etc/nwam/llp
101 nwambackupfile=$nwamfile.vbox
102 if test -f "$nwamfile"; then
103 sed -e '/vboxnet/d' $nwamfile > $nwambackupfile
104 echo "vboxnet0 static 192.168.56.1" >> $nwambackupfile
105 mv -f $nwambackupfile $nwamfile
106 echo " -> patched /etc/nwam/llp to use static IP for vboxnet0"
107 fi
108 fi
109 fi
110
111 # Load VBoxNetFilter vboxflt
112 if test -f /platform/i86pc/kernel/drv/vboxflt.conf; then
113 /opt/VirtualBox/vboxdrv.sh fltstart
114 rc=$?
115 fi
116
117 # Load VBoxUSBMonitor vboxusbmon (do NOT load for Solaris 10)
118 if test -f /platform/i86pc/kernel/drv/vboxusbmon.conf && test "$osversion" != "5.10"; then
119 /opt/VirtualBox/vboxdrv.sh usbstart
120 rc=$?
121 if test "$rc" -eq 0; then
122
123 # Add vboxusbmon to the devlink.tab
124 sed -e '/name=vboxusbmon/d' /etc/devlink.tab > /etc/devlink.vbox
125 echo "type=ddi_pseudo;name=vboxusbmon \D" >> /etc/devlink.vbox
126 mv -f /etc/devlink.vbox /etc/devlink.tab
127
128 /usr/sbin/devfsadm -i vboxusbmon
129 fi
130 fi
131fi
132
133# Enable Zone access service (note IPS auto-prefixes "virtualbox-" to the filename...)
134if test -f "/var/svc/manifest/application/virtualbox/virtualbox-zoneaccess.xml"; then
135 /usr/sbin/svccfg import /var/svc/manifest/application/virtualbox/virtualbox-zoneaccess.xml
136 rc=$?
137 if test "$rc" -eq 0; then
138 /usr/sbin/svcadm enable -s svc:/application/virtualbox/zoneaccess
139 rc=$?
140 if test "$rc" -eq 0; then
141 echo "Enabled VirtualBox zone service."
142 else
143 echo "## Failed to enable VirtualBox zone service."
144 fi
145 else
146 echo "## Failed to import VirtualBox zone service."
147 fi
148fi
149
150# We need to touch the desktop link in order to add it to the menu right away
151if test -f "/usr/share/applications/virtualbox.desktop"; then
152 touch /usr/share/applications/virtualbox.desktop
153 echo "Added VirtualBox shortcut menu item."
154fi
155
156# Install python bindings
157if test -f "/opt/VirtualBox/sdk/installer/vboxapisetup.py" || test -h "/opt/VirtualBox/sdk/installer/vboxapisetup.py"; then
158 PYTHONBIN=`which python`
159 if test -f "$PYTHONBIN" || test -h "$PYTHONBIN"; then
160 echo "Installing python bindings..."
161
162 VBOX_INSTALL_PATH=/opt/VirtualBox
163 export VBOX_INSTALL_PATH
164 cd /opt/VirtualBox/sdk/installer
165 $PYTHONBIN ./vboxapisetup.py install > /dev/null
166 echo "Done."
167 else
168 echo "** WARNING! Python not found, skipped installed Python bindings."
169 echo " Manually run '/opt/VirtualBox/sdk/installer/vboxapisetup.py install'"
170 echo " to install the bindings when python is available."
171 fi
172fi
173
174# Update boot archive
175BOOTADMBIN=/sbin/bootadm
176if test -f "$BOOTADMBIN" || test -h "$BOOTADMBIN"; then
177 echo "Updating boot archive..."
178 $BOOTADMBIN update-archive > /dev/null
179fi
180
181echo "Done."
182if test "$rc" -eq 0; then
183 echo "Post install successfully completed."
184else
185 echo "Post install completed but with some errors."
186fi
187exit 0
188
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