VirtualBox

source: vbox/trunk/src/VBox/Installer/solaris/checkinstall.sh@ 50295

Last change on this file since 50295 was 47894, checked in by vboxsync, 11 years ago

VBoxNetLwipNAT => VBoxNetNAT

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id
File size: 6.8 KB
Line 
1#!/bin/sh
2## @file
3#
4# VirtualBox checkinstall script for Solaris.
5#
6
7#
8# Copyright (C) 2009-2012 Oracle Corporation
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
19infoprint()
20{
21 echo 1>&2 "$1"
22}
23
24errorprint()
25{
26 echo 1>&2 "## $1"
27}
28
29abort_error()
30{
31 errorprint "Please close all VirtualBox processes and re-run this installer."
32 exit 1
33}
34
35checkdep_svr4()
36{
37 if test -z "$1"; then
38 errorprint "Missing argument to checkdep_svr4"
39 return 1
40 fi
41 $BIN_PKGINFO $BASEDIR_OPT "$1" >/dev/null 2>&1
42 if test $? -eq 0; then
43 return 0
44 fi
45 PKG_MISSING_SVR4="$PKG_MISSING_SVR4 $1"
46 return 1
47}
48
49checkdep_ips()
50{
51 if test -z "$1"; then
52 errorprint "Missing argument to checkdep_svr4"
53 return 1
54 fi
55 # using "list" without "-a" only lists installed pkgs which is what we need
56 $BIN_PKG $BASEDIR_OPT list "$1" >/dev/null 2>&1
57 if test $? -eq 0; then
58 return 0
59 fi
60 PKG_MISSING_IPS="$PKG_MISSING_IPS $1"
61 return 1
62
63}
64
65# nothing to check for remote install
66REMOTE_INST=0
67if test "x${PKG_INSTALL_ROOT:=/}" != "x/"; then
68 BASEDIR_OPT="-R $PKG_INSTALL_ROOT"
69 REMOTE_INST=1
70fi
71
72# nothing to check for non-global zones
73currentzone=`zonename`
74if test "$currentzone" != "global"; then
75 exit 0
76fi
77
78
79infoprint "Checking package dependencies..."
80
81PKG_MISSING_IPS=""
82PKG_MISSING_SVR4=""
83BIN_PKGINFO=`which pkginfo 2> /dev/null`
84BIN_PKG=`which pkg 2> /dev/null`
85
86if test -x "$BIN_PKG"; then
87 checkdep_ips "runtime/python-26"
88 checkdep_ips "system/library/iconv/utf-8"
89else
90 PKG_MISSING_IPS="runtime/python-26 system/library/iconv/utf-8"
91fi
92if test -x "$BIN_PKGINFO"; then
93 checkdep_svr4 "SUNWPython"
94 checkdep_svr4 "SUNWPython-devel"
95 checkdep_svr4 "SUNWuiu8"
96else
97 PKG_MISSING_SVR4="SUNWPython SUNWPython-devel SUNWuiu8"
98fi
99
100if test "$PKG_MISSING_IPS" != "" && test "$PKG_MISSING_SVR4" != ""; then
101 if test ! -x "$BIN_PKG" && test ! -x "$BIN_PKGINFO"; then
102 errorprint "Missing or non-executable binaries: pkg ($BIN_PKG) and pkginfo ($BIN_PKGINFO)."
103 errorprint "Cannot check for dependencies."
104 errorprint ""
105 errorprint "Please install one of the required packaging system."
106 exit 1
107 fi
108 errorprint "Missing packages: "
109 errorprint "IPS : $PKG_MISSING_IPS"
110 errorprint "SVr4: $PKG_MISSING_SVR4"
111 errorprint ""
112 errorprint "Please install either the IPS or SVr4 packages before installing VirtualBox."
113 exit 1
114else
115 infoprint "Done."
116fi
117
118# nothing more to do for remote installs
119if test "$REMOTE_INST" -eq 1; then
120 exit 0
121fi
122
123# Check if the Zone Access service is holding open vboxdrv, if so stop & remove it
124servicefound=`svcs -H "svc:/application/virtualbox/zoneaccess" 2> /dev/null | grep '^online'`
125if test ! -z "$servicefound"; then
126 infoprint "VirtualBox's zone access service appears to still be running."
127 infoprint "Halting & removing zone access service..."
128 /usr/sbin/svcadm disable -s svc:/application/virtualbox/zoneaccess
129 # Don't delete the service, handled by manifest class action
130 # /usr/sbin/svccfg delete svc:/application/virtualbox/zoneaccess
131fi
132
133# Check if the Web service is running, if so stop & remove it
134servicefound=`svcs -H "svc:/application/virtualbox/webservice" 2> /dev/null | grep '^online'`
135if test ! -z "$servicefound"; then
136 infoprint "VirtualBox web service appears to still be running."
137 infoprint "Halting & removing webservice..."
138 /usr/sbin/svcadm disable -s svc:/application/virtualbox/webservice
139 # Don't delete the service, handled by manifest class action
140 # /usr/sbin/svccfg delete svc:/application/virtualbox/webservice
141fi
142
143# Check if the autostart service is running, if so stop & remove it
144servicefound=`svcs -H "svc:/application/virtualbox/autostart" 2> /dev/null | grep '^online'`
145if test ! -z "$servicefound"; then
146 infoprint "VirtualBox autostart service appears to still be running."
147 infoprint "Halting & removing autostart service..."
148 /usr/sbin/svcadm disable -s svc:/application/virtualbox/autostart
149fi
150
151# Check if VBoxSVC is currently running
152VBOXSVC_PID=`ps -eo pid,fname | grep VBoxSVC | grep -v grep | awk '{ print $1 }'`
153if test ! -z "$VBOXSVC_PID" && test "$VBOXSVC_PID" -ge 0; then
154 errorprint "VirtualBox's VBoxSVC (pid $VBOXSVC_PID) still appears to be running."
155 abort_error
156fi
157
158# Check if VBoxNetDHCP is currently running
159VBOXNETDHCP_PID=`ps -eo pid,fname | grep VBoxNetDHCP | grep -v grep | awk '{ print $1 }'`
160if test ! -z "$VBOXNETDHCP_PID" && test "$VBOXNETDHCP_PID" -ge 0; then
161 errorprint "VirtualBox's VBoxNetDHCP (pid $VBOXNETDHCP_PID) still appears to be running."
162 abort_error
163fi
164
165# Check if VBoxNetNAT is currently running
166VBOXNETNAT_PID=`ps -eo pid,fname | grep VBoxNetNAT | grep -v grep | awk '{ print $1 }'`
167if test ! -z "$VBOXNETNAT_PID" && test "$VBOXNETNAT_PID" -ge 0; then
168 errorprint "VirtualBox's VBoxNetNAT (pid $VBOXNETNAT_PID) still appears to be running."
169 abort_error
170fi
171
172# Check if vboxnet is still plumbed, if so try unplumb it
173BIN_IFCONFIG=`which ifconfig 2> /dev/null`
174if test -x "$BIN_IFCONFIG"; then
175 vboxnetup=`$BIN_IFCONFIG vboxnet0 >/dev/null 2>&1`
176 if test "$?" -eq 0; then
177 infoprint "VirtualBox NetAdapter is still plumbed"
178 infoprint "Trying to remove old NetAdapter..."
179 $BIN_IFCONFIG vboxnet0 unplumb
180 if test "$?" -ne 0; then
181 errorprint "VirtualBox NetAdapter 'vboxnet0' couldn't be unplumbed (probably in use)."
182 abort_error
183 fi
184 fi
185 vboxnetup=`$BIN_IFCONFIG vboxnet0 inet6 >/dev/null 2>&1`
186 if test "$?" -eq 0; then
187 infoprint "VirtualBox NetAdapter (Ipv6) is still plumbed"
188 infoprint "Trying to remove old NetAdapter..."
189 $BIN_IFCONFIG vboxnet0 inet6 unplumb
190 if test "$?" -ne 0; then
191 errorprint "VirtualBox NetAdapter 'vboxnet0' IPv6 couldn't be unplumbed (probably in use)."
192 abort_error
193 fi
194 fi
195fi
196
197# If we are using SVR4 packages then make sure that SMF has finished
198# disabling any services left over from a previous installation which
199# may interfere with installing new ones. Should only be relevant on
200# Solaris 11.
201if test -x "$BIN_PKGINFO"; then
202 for i in 1 2 3 4 5 6 7 8 9 10; do
203 svcs -a | grep virtualbox >/dev/null || break
204 if test "${i}" = "1"; then
205 printf "Waiting for services from previous installation to be removed."
206 else
207 printf "."
208 fi
209 sleep 1
210 done
211 test "${i}" = "1" || printf "\n"
212fi
213
214exit 0
215
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