File: prerm

package info (click to toggle)
bnetd 0.4.25-6
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 4,516 kB
  • ctags: 7,224
  • sloc: ansic: 67,547; sh: 3,142; makefile: 796; python: 304; perl: 211; awk: 73
file content (44 lines) | stat: -rw-r--r-- 1,034 bytes parent folder | download | duplicates (3)
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
#!/bin/sh

set -e

case "$1" in
    upgrade|remove|failed-upgrade|deconfigure)
    ;;
    *)
        echo "prerm called with unknown argument \`$1'" >&2
        exit 1
    ;;
esac

if [ \( "$1" = "upgrade" -o "$1" = "remove" \) -a -L /usr/doc/bnetd ]; then
	rm -f /usr/doc/bnetd
fi

# If the previous bnetd configuration was buggy, the init script called by
# the debhelper code may not be able to stop the bnetd daemon.
# To catch this, we ignore shell failures while running the devhelper code
# and look at its exit status.

set +e

#DEBHELPER#

# If devhelper code didn't work, kill bnetd using cruder methods
if [ $? -ne 0 ]; then
	BNETD_PS_REGEX='[0-9]:[0-9][0-9] /usr/sbin/bnetd$'
	if ps ax | grep -q "$BNETD_PS_REGEX"; then
		echo -n 'Sending TERM signal to bnetd ... '
		kill `ps ax | grep "$BNETD_PS_REGEX" | cut -c1-6`
		echo 'done.'
	fi
	sleep 2
	if ps ax | grep -q "$BNETD_PS_REGEX"; then
		echo -n 'Sending KILL signal to bnetd ... '
		kill -9 `ps ax | grep "$BNETD_PS_REGEX" | cut -c1-6`
		echo 'done.'
	fi
fi

exit 0