File: cfengine2.preinst

package info (click to toggle)
cfengine2 2.1.14-1sarge1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 3,688 kB
  • ctags: 12
  • sloc: sh: 290; makefile: 113; perl: 29
file content (36 lines) | stat: -rw-r--r-- 731 bytes parent folder | download | duplicates (6)
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
#! /bin/sh
#
# Possible invocations:
#    * new-preinst install
#    * new-preinst install old-version
#    * new-preinst upgrade old-version
#    * old-preinst abort-upgrade new-version

set -e

#DEBHELPER#

case "$1" in
	upgrade)
		bindir="/var/lib/cfengine2/bin"
		# Remove it if it's a genuine directory so dpkg can install
		# the link in its place.
		if [ ! -h "$bindir" -a -d "$bindir" ]; then
		    rmdir "$bindir" || {
			fmt <<EOF >&2
ERROR: $bindir could not be deleted automatically.
To fix this, check it and delete it yourself, then run

# dpkg --configure cfengine2
EOF
			exit 1
		    }
		fi
		;;
	install|abort-upgrade)
		;;
	*)
		echo "Cfengine2 preinst called with invalid argument, '$1'" >&2
		exit 1
		;;
esac