File: preinst

package info (click to toggle)
apmd 3.0beta5-1
  • links: PTS
  • area: main
  • in suites: slink
  • size: 244 kB
  • ctags: 106
  • sloc: ansic: 1,047; sh: 119; makefile: 109
file content (35 lines) | stat: -rwxr-xr-x 814 bytes parent folder | download | duplicates (2)
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
#!/bin/sh
#
# This is the preinst script for the Debian GNU/Linux apmd package
#
# Written by Dirk Eddelbuettel <edd@debian.org>   

set -e

case "$1" in
    install)
	;;
    upgrade)
	# Stop a running apmd from an older version
	if [ -f /usr/sbin/apmd ]
	then
	    start-stop-daemon --stop --quiet --oknodo  \
		    --pidfile /var/run/apmd.pid --exec /usr/sbin/apmd
	fi
	# Handle bug #4489: Old versions of apmd erroneously killed kerneld 
	# We test for these versions numbers, given by dpkg as $2, using an
	# expr(1) match, and if the 5 chars are matched, restart the kerneld
	if [ `expr match "$2" '2\.[124]-[01]$'` -eq 5 ]
	then 
	    /etc/init.d/kerneld start >/dev/null
	fi
	;;
    abort-upgrade)
	;;
    *)
	echo "preinst called with unknown argument \`$1'" >&2
	exit 0
	;;
esac                  

exit 0