VirtualBox

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

Last change on this file since 56123 was 56123, checked in by vboxsync, 10 years ago

Solaris/Installer: svn props for checkinstall.sh

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

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