VirtualBox

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

Last change on this file since 34497 was 32702, checked in by vboxsync, 14 years ago

Solaris/Installer: Make package non-relocatable and use PKG_INSTALL_ROOT.

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id
File size: 3.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 errorprint "Note: It can take up to 10 seconds for all VirtualBox & related processes to close."
33 exit 1
34}
35
36# nothing to check for remote install
37if test "x${PKG_INSTALL_ROOT:=/}" != "x/"; then
38 exit 0
39fi
40
41# Check if the Zone Access service is holding open vboxdrv, if so stop & remove it
42servicefound=`svcs -H "svc:/application/virtualbox/zoneaccess" 2> /dev/null | grep '^online'`
43if test ! -z "$servicefound"; then
44 infoprint "VirtualBox's zone access service appears to still be running."
45 infoprint "Halting & removing zone access service..."
46 /usr/sbin/svcadm disable -s svc:/application/virtualbox/zoneaccess
47 # Don't delete the service, handled by manifest class action
48 # /usr/sbin/svccfg delete svc:/application/virtualbox/zoneaccess
49fi
50
51# Check if the Web service is running, if so stop & remove it
52servicefound=`svcs -H "svc:/application/virtualbox/webservice" 2> /dev/null | grep '^online'`
53if test ! -z "$servicefound"; then
54 infoprint "VirtualBox web service appears to still be running."
55 infoprint "Halting & removing webservice..."
56 /usr/sbin/svcadm disable -s svc:/application/virtualbox/webservice
57 # Don't delete the service, handled by manifest class action
58 # /usr/sbin/svccfg delete svc:/application/virtualbox/webservice
59fi
60
61# Check if VBoxSVC is currently running
62VBOXSVC_PID=`ps -eo pid,fname | grep VBoxSVC | grep -v grep | awk '{ print $1 }'`
63if test ! -z "$VBOXSVC_PID" && test "$VBOXSVC_PID" -ge 0; then
64 errorprint "VirtualBox's VBoxSVC (pid $VBOXSVC_PID) still appears to be running."
65 abort_error
66fi
67
68# Check if VBoxNetDHCP is currently running
69VBOXNETDHCP_PID=`ps -eo pid,fname | grep VBoxNetDHCP | grep -v grep | awk '{ print $1 }'`
70if test ! -z "$VBOXNETDHCP_PID" && test "$VBOXNETDHCP_PID" -ge 0; then
71 errorprint "VirtualBox's VBoxNetDHCP (pid $VBOXNETDHCP_PID) still appears to be running."
72 abort_error
73fi
74
75# Check if vboxnet is still plumbed, if so try unplumb it
76BIN_IFCONFIG=`which ifconfig 2> /dev/null`
77if test -x "$BIN_IFCONFIG"; then
78 vboxnetup=`$BIN_IFCONFIG vboxnet0 >/dev/null 2>&1`
79 if test "$?" -eq 0; then
80 infoprint "VirtualBox NetAdapter is still plumbed"
81 infoprint "Trying to remove old NetAdapter..."
82 $BIN_IFCONFIG vboxnet0 unplumb
83 if test "$?" -ne 0; then
84 errorprint "VirtualBox NetAdapter 'vboxnet0' couldn't be unplumbed (probably in use)."
85 abort_error
86 fi
87 fi
88 vboxnetup=`$BIN_IFCONFIG vboxnet0 inet6 >/dev/null 2>&1`
89 if test "$?" -eq 0; then
90 infoprint "VirtualBox NetAdapter (Ipv6) is still plumbed"
91 infoprint "Trying to remove old NetAdapter..."
92 $BIN_IFCONFIG vboxnet0 inet6 unplumb
93 if test "$?" -ne 0; then
94 errorprint "VirtualBox NetAdapter 'vboxnet0' IPv6 couldn't be unplumbed (probably in use)."
95 abort_error
96 fi
97 fi
98fi
99
100exit 0
101
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