File: preinst

package info (click to toggle)
apmd 3.0final-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 688 kB
  • ctags: 641
  • sloc: ansic: 2,617; makefile: 567; sh: 240
file content (37 lines) | stat: -rwxr-xr-x 827 bytes parent folder | download
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
#!/bin/sh
#
# This is the preinst script for the Debian GNU/Linux apmd package
#
# Written by Dirk Eddelbuettel <edd@debian.org>   

#DEBHELPER#

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