This file is indexed.

prerm is in util-vserver 0.30.216-pre2864-2ubuntu1.

This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/bin/sh

set -e

. /usr/share/debconf/confmodule

# summary of how this script can be called:
#        * <prerm> `remove'
#        * <old-prerm> `upgrade' <new-version>
#        * <new-prerm> `failed-upgrade' <old-version>
#        * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
#        * <deconfigured's-prerm> `deconfigure' `in-favour'
#          <package-being-installed> <version> `removing'
#          <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package

# Try to stop any vservers that are running in a sane way, no vservers should be
# running when configurations are removed! If it does not succeed, prompt the
# admin to do it.

: ${UTIL_VSERVER_VARS:=/usr/lib/util-vserver/util-vserver-vars}

test -e "$UTIL_VSERVER_VARS" || 
   {
   	echo "Can not find util-vserver installation (the file '$UTIL_VSERVER_VARS' is expected); aborting..." >&2
   	exit 1
   }

. "$UTIL_VSERVER_VARS"

stop_vservers() {
  set +e
  if [ -x /usr/sbin/invoke-rc.d ]; then
    invoke-rc.d util-vserver forcestop
  else
    /etc/init.d/util-vserver forcestop
  fi
  errno=$?
  set -e

  if [ "$?" != 0 ]; then
    echo "Trying to stop vservers resulted in exitcode $?." 1>&2
    echo "Stop them yourself and try again!" 1>&2
    exit 1
  fi
}


case "$1" in
    remove|purge)
    	if [ -n "`vserver-stat | grep -v "CTX   PROC    VSZ    RSS  userTIME   sysTIME    UPTIME NAME" |grep -v ^0 2>/dev/null`" ]
	then
		db_reset util-vserver/prerm_stop_running_vservers || true
		db_input high util-vserver/prerm_stop_running_vservers || true
		db_go
		db_get util-vserver/prerm_stop_running_vservers || true
		if [ "$RET" = "true" ]; then
			stop_vservers
		else
			echo "WARNING: running vservers detected, reinstall util-vserver to manage them"
		fi
		db_stop
	fi
    ;; 
    upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
    ;;
    *)
     echo "prerm called with unknown argument \`$1'" >&2
     exit 1
    ;;
esac

# Automatically added by dh_installinit
if [ -x "/etc/init.d/util-vserver" ] && [ "$1" = remove ]; then
	if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
		invoke-rc.d util-vserver stop || exit $?
	else
		/etc/init.d/util-vserver stop || exit $?
	fi
fi
# End automatically added section


exit 0