VirtualBox

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

Last change on this file since 40757 was 40757, checked in by vboxsync, 13 years ago

Solaris/Installer: checkinstall quoting fix for zones.

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id
File size: 5.6 KB
Line 
1#!/bin/sh
2## @file
3#
4# VirtualBox checkinstall script for Solaris.
5#
6
7#
8# Copyright (C) 2009-2010 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 VBoxSVC is currently running
144VBOXSVC_PID=`ps -eo pid,fname | grep VBoxSVC | grep -v grep | awk '{ print $1 }'`
145if test ! -z "$VBOXSVC_PID" && test "$VBOXSVC_PID" -ge 0; then
146 errorprint "VirtualBox's VBoxSVC (pid $VBOXSVC_PID) still appears to be running."
147 abort_error
148fi
149
150# Check if VBoxNetDHCP is currently running
151VBOXNETDHCP_PID=`ps -eo pid,fname | grep VBoxNetDHCP | grep -v grep | awk '{ print $1 }'`
152if test ! -z "$VBOXNETDHCP_PID" && test "$VBOXNETDHCP_PID" -ge 0; then
153 errorprint "VirtualBox's VBoxNetDHCP (pid $VBOXNETDHCP_PID) still appears to be running."
154 abort_error
155fi
156
157# Check if vboxnet is still plumbed, if so try unplumb it
158BIN_IFCONFIG=`which ifconfig 2> /dev/null`
159if test -x "$BIN_IFCONFIG"; then
160 vboxnetup=`$BIN_IFCONFIG vboxnet0 >/dev/null 2>&1`
161 if test "$?" -eq 0; then
162 infoprint "VirtualBox NetAdapter is still plumbed"
163 infoprint "Trying to remove old NetAdapter..."
164 $BIN_IFCONFIG vboxnet0 unplumb
165 if test "$?" -ne 0; then
166 errorprint "VirtualBox NetAdapter 'vboxnet0' couldn't be unplumbed (probably in use)."
167 abort_error
168 fi
169 fi
170 vboxnetup=`$BIN_IFCONFIG vboxnet0 inet6 >/dev/null 2>&1`
171 if test "$?" -eq 0; then
172 infoprint "VirtualBox NetAdapter (Ipv6) is still plumbed"
173 infoprint "Trying to remove old NetAdapter..."
174 $BIN_IFCONFIG vboxnet0 inet6 unplumb
175 if test "$?" -ne 0; then
176 errorprint "VirtualBox NetAdapter 'vboxnet0' IPv6 couldn't be unplumbed (probably in use)."
177 abort_error
178 fi
179 fi
180fi
181
182exit 0
183
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