VirtualBox

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

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

Solaris/Installer: fixed and tested ips/pkg(5) post install.

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