VirtualBox

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

Last change on this file was 109074, checked in by vboxsync, 11 days ago

Installer/solaris: Update checkinstall.sh to extend the list of possible
Python packages to include Python 3.13 and also note the removal of
Python 3.7 from Solaris 11.4 as of SRU72.

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 12.4 KB
Line 
1#!/bin/sh
2# $Id: checkinstall.sh 109074 2025-04-24 15:45:38Z vboxsync $
3## @file
4#
5# VirtualBox checkinstall script for Solaris.
6#
7
8#
9# Copyright (C) 2009-2024 Oracle and/or its affiliates.
10#
11# This file is part of VirtualBox base platform packages, as
12# available from https://www.virtualbox.org.
13#
14# This program is free software; you can redistribute it and/or
15# modify it under the terms of the GNU General Public License
16# as published by the Free Software Foundation, in version 3 of the
17# License.
18#
19# This program is distributed in the hope that it will be useful, but
20# WITHOUT ANY WARRANTY; without even the implied warranty of
21# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22# General Public License for more details.
23#
24# You should have received a copy of the GNU General Public License
25# along with this program; if not, see <https://www.gnu.org/licenses>.
26#
27# SPDX-License-Identifier: GPL-3.0-only
28#
29
30infoprint()
31{
32 echo 1>&2 "$1"
33}
34
35errorprint()
36{
37 echo 1>&2 "## $1"
38}
39
40abort_error()
41{
42 errorprint "Please close all VirtualBox processes and re-run this installer."
43 exit 1
44}
45
46checkdep_ips()
47{
48 if test -z "$1"; then
49 errorprint "Missing argument to checkdep_ips"
50 return 1
51 fi
52 # using "list" without "-a" only lists installed pkgs which is what we need
53 $BIN_PKG $BASEDIR_OPT list "$1" >/dev/null 2>&1
54 if test "$?" -eq 0; then
55 return 0
56 fi
57 PKG_MISSING_IPS="$PKG_MISSING_IPS $1"
58 return 1
59}
60
61checkdep_ips_python()
62{
63 if test -z "$1"; then
64 errorprint "Missing argument to checkdep_ips_python"
65 return 1
66 fi
67
68 # Check installed packages for any python runtime from the argument list passed
69 # to this function. We can't use 'pkg list -q' here since it didn't exist until
70 # S11.2 FCS (CR 16663535).
71 for pkg in "${@}"; do
72 $BIN_PKG $BASEDIR_OPT list "${pkg}" >/dev/null 2>&1
73 if test "$?" -eq 0; then
74 return 0
75 fi
76 done
77
78 # 'pkg info' Branch fields:
79 # For S11-11.3: TrunkID|Update|SRU|Reserved|BuildID|NightlyID
80 # For S11.4: TrunkID|Update|SRU|Reserved|Reserved|BuildID|NightlyID
81 # N.B. For S11-11.3: TrunkID=0.175 For S11.4: TrunkID=11
82 # Example Solaris 11 FMRIs:
83 # Solaris 11 pre-FCS = 5.12.0.0.0.128.1
84 # Solaris 11 FCS = 0.175.0.0.0.2.0
85 # Solaris 11.1 SRU21 = 0.175.1.21.0.4.1
86 # Solaris 11.2 SRU15 = 0.175.2.14.0.2.2
87 # Solaris 11.3 SRU36 = 0.175.3.36.0.8.0
88 # Solaris 11.4 SRU55 = 11.4.55.0.1.138.3
89 eval `$BIN_PKG $BASEDIR_OPT info system/kernel | \
90 awk '/Branch:/ { split($2, array, "."); if ($2 == 175) {print "export UPDATE="array[3] " SRU="array[4];} \
91 else {print "export UPDATE="array[2] " SRU="array[3]} }'`
92
93 # If the parsing of the pkg FMRI failed for any reason then default to the first
94 # Solaris 11.4 CBE which was released relatively recently (March 2022) and is
95 # freely available.
96 if test -z "$UPDATE"; then
97 export UPDATE=4 SRU=42
98 fi
99
100 # Map of introduction and removal of python releases in Solaris 11 releases/SRUs:
101 # python 2.6: S11 FCS -> S11.3 SRU19 [removed in S11.3 SRU20]
102 # python 2.7: S11 FCS -> S11.4 SRU56 [removed in S11.4 SRU57]
103 # python 3.4: S11.3 FCS -> S11.4 SRU26 [removed in S11.4 SRU27]
104 # python 3.5: S11.4 FCS -> S11.4 SRU29 [removed in S11.4 SRU30]
105 # python 3.7: S11.4 SRU4 -> S11.4 SRU71 [removed in S11.4 SRU72]
106 # python 3.9: S11.4 SRU30 -> TBD
107 # python 3.11: S11.4 SRU54 -> TBD
108 # python 3.13: S11.4 SRU78 -> TBD
109 if test "$UPDATE" -lt 3 || test "$UPDATE" -gt 4; then # S11 FCS - S11.2 SRU15 or anything before S11 FCS
110 PKG_MISSING_IPS="$PKG_MISSING_IPS runtime/python-26 or runtime/python-27"
111 elif test "$UPDATE" -eq 3 && test "$SRU" -le 19; then # S11.3 FCS - S11.3 SRU19
112 PKG_MISSING_IPS="$PKG_MISSING_IPS runtime/python-26 or runtime/python-27 or runtime/python-34"
113 elif test "$UPDATE" -eq 3 && test "$SRU" -gt 19; then # S11.3 SRU20 - S11.3 SRU<latest>
114 PKG_MISSING_IPS="$PKG_MISSING_IPS runtime/python-27 or runtime/python-34"
115 elif test "$UPDATE" -eq 4 && test "$SRU" -le 3; then # S11.4 FCS - S11.4 SRU3
116 PKG_MISSING_IPS="$PKG_MISSING_IPS runtime/python-27 or runtime/python-34 or runtime/python-35"
117 elif test "$UPDATE" -eq 4 && test "$SRU" -le 26; then # S11.4 SRU4 - S11.4 SRU26
118 PKG_MISSING_IPS="$PKG_MISSING_IPS runtime/python-27 or runtime/python-34 or runtime/python-35 or runtime/python-37"
119 elif test "$UPDATE" -eq 4 && test "$SRU" -le 29; then # S11.4 SRU27 - S11.4 SRU29
120 PKG_MISSING_IPS="$PKG_MISSING_IPS runtime/python-27 or runtime/python-35 or runtime/python-37"
121 elif test "$UPDATE" -eq 4 && test "$SRU" -le 53; then # S11.4 SRU30 - S11.4 SRU53
122 PKG_MISSING_IPS="$PKG_MISSING_IPS runtime/python-27 or runtime/python-37 or runtime/python-39"
123 elif test "$UPDATE" -eq 4 && test "$SRU" -le 56; then # S11.4 SRU54 - S11.4 SRU56
124 PKG_MISSING_IPS="$PKG_MISSING_IPS runtime/python-27 or runtime/python-37 or runtime/python-39 or runtime/python-311"
125 elif test "$UPDATE" -eq 4 && test "$SRU" -le 71; then # S11.4 SRU57 - S11.4 SRU71
126 PKG_MISSING_IPS="$PKG_MISSING_IPS runtime/python-37 or runtime/python-39 or runtime/python-311"
127 elif test "$UPDATE" -eq 4 && test "$SRU" -gt 71; then # S11.4 SRU72 - S11.4 SRU<latest>
128 PKG_MISSING_IPS="$PKG_MISSING_IPS runtime/python-39 or runtime/python-311 or runtime/python-313"
129 else # Fall through just in case.
130 PKG_MISSING_IPS="$PKG_MISSING_IPS runtime/python-39 or runtime/python-311 or runtime/python-313"
131 fi
132
133 return 1
134}
135
136checkdep_ips_either()
137{
138 if test -z "$1" || test -z "$2"; then
139 errorprint "Missing argument to checkdep_ips_either"
140 return 1
141 fi
142 # using "list" without "-a" only lists installed pkgs which is what we need
143 $BIN_PKG $BASEDIR_OPT list "$1" >/dev/null 2>&1
144 if test "$?" -eq 0; then
145 return 0
146 fi
147 $BIN_PKG $BASEDIR_OPT list "$2" >/dev/null 2>&1
148 if test "$?" -eq 0; then
149 return 0
150 fi
151 PKG_MISSING_IPS="$PKG_MISSING_IPS $1 or $2"
152 return 1
153}
154
155disable_service()
156{
157 if test -z "$1" || test -z "$2"; then
158 errorprint "Missing argument to disable_service"
159 return 1
160 fi
161 servicefound=`$BIN_SVCS -H "$1" 2> /dev/null | grep '^online'`
162 if test ! -z "$servicefound"; then
163 infoprint "$2 ($1) is still enabled. Disabling..."
164 $BIN_SVCADM disable -s "$1"
165 # Don't delete the service, handled by manifest class action
166 # /usr/sbin/svccfg delete $1
167 fi
168}
169
170# find_bin_path()
171# !! failure is always fatal
172find_bin_path()
173{
174 if test -z "$1"; then
175 errorprint "missing argument to find_bin_path()"
176 exit 1
177 fi
178
179 binfilename=`basename $1`
180 binfilepath=`which $binfilename 2> /dev/null`
181 if test -x "$binfilepath"; then
182 echo "$binfilepath"
183 return 0
184 else
185 errorprint "$1 missing or is not an executable"
186 exit 1
187 fi
188}
189
190# find_bins()
191# !! failure is always fatal
192find_mandatory_bins()
193{
194 # Search only for binaries that might be in different locations
195 if test ! -x "$BIN_SVCS"; then
196 BIN_SVCS=`find_bin_path "$BIN_SVCS"`
197 fi
198
199 if test ! -x "$BIN_SVCADM"; then
200 BIN_SVCADM=`find_bin_path "$BIN_SVCADM"`
201 fi
202}
203
204
205#
206# Begin execution
207#
208
209# Nothing to check for remote install
210REMOTE_INST=0
211if test "x${PKG_INSTALL_ROOT:=/}" != "x/"; then
212 BASEDIR_OPT="-R $PKG_INSTALL_ROOT"
213 REMOTE_INST=1
214fi
215
216# Nothing to check for non-global zones
217currentzone=`zonename`
218if test "x$currentzone" != "xglobal"; then
219 exit 0
220fi
221
222PKG_MISSING_IPS=""
223BIN_PKG=/usr/bin/pkg
224BIN_SVCS=/usr/bin/svcs
225BIN_SVCADM=/usr/sbin/svcadm
226
227# Check non-optional binaries
228find_mandatory_bins
229
230infoprint "Checking package dependencies..."
231
232if test -x "$BIN_PKG"; then
233 checkdep_ips "system/library/iconv/iconv-core"
234 checkdep_ips "x11/library/libice"
235 checkdep_ips "x11/library/libsm"
236 checkdep_ips "x11/library/libx11"
237 checkdep_ips "x11/library/libxcb"
238 checkdep_ips "x11/library/libxext"
239 checkdep_ips "x11/library/libxfixes"
240 checkdep_ips "x11/library/libxkbcommon"
241 checkdep_ips "x11/library/libxrender"
242 checkdep_ips "x11/library/mesa"
243 checkdep_ips "x11/library/toolkit/libxt"
244 checkdep_ips "x11/library/xcb-util"
245 checkdep_ips_python "runtime/python-26" "runtime/python-27" "runtime/python-34" "runtime/python-35" "runtime/python-37" "runtime/python-39" "runtime/python-311" "runtime/python-313"
246 checkdep_ips_either "system/library/gcc/gcc-c++-runtime" "system/library/gcc/gcc-c++-runtime-9"
247 checkdep_ips_either "system/library/gcc/gcc-c-runtime" "system/library/gcc/gcc-c-runtime-9"
248else
249 PKG_MISSING_IPS="runtime/python-37 system/library/iconv/iconv-core system/library/gcc/gcc-c++-runtime-9 system/library/gcc/gcc-c-runtime-9"
250fi
251
252if test "x$PKG_MISSING_IPS" != "x"; then
253 if test ! -x "$BIN_PKG"; then
254 errorprint "Missing or non-executable binary: pkg ($BIN_PKG)."
255 errorprint "Cannot check for dependencies."
256 errorprint ""
257 errorprint "Please install one of the required packaging system."
258 exit 1
259 fi
260 errorprint "Missing packages: $PKG_MISSING_IPS"
261 errorprint ""
262 errorprint "Please install these packages before installing VirtualBox."
263 exit 1
264else
265 infoprint "Done."
266fi
267
268# Nothing more to do for remote installs
269if test "$REMOTE_INST" -eq 1; then
270 exit 0
271fi
272
273# Check & disable running services
274disable_service "svc:/application/virtualbox/zoneaccess" "VirtualBox zone access service"
275disable_service "svc:/application/virtualbox/webservice" "VirtualBox web service"
276disable_service "svc:/application/virtualbox/autostart" "VirtualBox auto-start service"
277disable_service "svc:/application/virtualbox/balloonctrl" "VirtualBox balloon-control service"
278
279# Check if VBoxSVC is currently running
280VBOXSVC_PID=`ps -eo pid,fname | grep VBoxSVC | grep -v grep | awk '{ print $1 }'`
281if test ! -z "$VBOXSVC_PID" && test "$VBOXSVC_PID" -ge 0; then
282 errorprint "VirtualBox's VBoxSVC (pid $VBOXSVC_PID) still appears to be running."
283 abort_error
284fi
285
286# Check if VBoxNetDHCP is currently running
287VBOXNETDHCP_PID=`ps -eo pid,fname | grep VBoxNetDHCP | grep -v grep | awk '{ print $1 }'`
288if test ! -z "$VBOXNETDHCP_PID" && test "$VBOXNETDHCP_PID" -ge 0; then
289 errorprint "VirtualBox's VBoxNetDHCP (pid $VBOXNETDHCP_PID) still appears to be running."
290 abort_error
291fi
292
293# Check if VBoxNetNAT is currently running
294VBOXNETNAT_PID=`ps -eo pid,fname | grep VBoxNetNAT | grep -v grep | awk '{ print $1 }'`
295if test ! -z "$VBOXNETNAT_PID" && test "$VBOXNETNAT_PID" -ge 0; then
296 errorprint "VirtualBox's VBoxNetNAT (pid $VBOXNETNAT_PID) still appears to be running."
297 abort_error
298fi
299
300# Check if vboxnet is still plumbed, if so try unplumb it
301BIN_IFCONFIG=`which ifconfig 2> /dev/null`
302if test -x "$BIN_IFCONFIG"; then
303 vboxnetup=`$BIN_IFCONFIG vboxnet0 >/dev/null 2>&1`
304 if test "$?" -eq 0; then
305 infoprint "VirtualBox NetAdapter is still plumbed"
306 infoprint "Trying to remove old NetAdapter..."
307 $BIN_IFCONFIG vboxnet0 unplumb
308 if test "$?" -ne 0; then
309 errorprint "VirtualBox NetAdapter 'vboxnet0' couldn't be unplumbed (probably in use)."
310 abort_error
311 fi
312 fi
313 vboxnetup=`$BIN_IFCONFIG vboxnet0 inet6 >/dev/null 2>&1`
314 if test "$?" -eq 0; then
315 infoprint "VirtualBox NetAdapter (Ipv6) is still plumbed"
316 infoprint "Trying to remove old NetAdapter..."
317 $BIN_IFCONFIG vboxnet0 inet6 unplumb
318 if test "$?" -ne 0; then
319 errorprint "VirtualBox NetAdapter 'vboxnet0' IPv6 couldn't be unplumbed (probably in use)."
320 abort_error
321 fi
322 fi
323fi
324
325# Make sure that SMF has finished removing any services left over from a
326# previous installation which may interfere with installing new ones.
327# This is only relevant on Solaris 11 for SysV packages.
328#
329# See BugDB 14838646 for the original problem and @bugref{7866} for
330# follow up fixes.
331for i in 1 2 3 4 5 6 7 8 9 10; do
332 $BIN_SVCS -H "svc:/application/virtualbox/autostart" >/dev/null 2>&1 ||
333 $BIN_SVCS -H "svc:/application/virtualbox/webservice" >/dev/null 2>&1 ||
334 $BIN_SVCS -H "svc:/application/virtualbox/zoneaccess" >/dev/null 2>&1 ||
335 $BIN_SVCS -H "svc:/application/virtualbox/balloonctrl" >/dev/null 2>&1 || break
336 if test "${i}" = "1"; then
337 printf "Waiting for services from previous installation to be removed."
338 elif test "${i}" = "10"; then
339 printf "\nWarning!!! Some service(s) still appears to be present"
340 else
341 printf "."
342 fi
343 sleep 1
344done
345test "${i}" = "1" || printf "\n"
346
347exit 0
348
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