File: postrm

package info (click to toggle)
mon 0.38.15-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 708 kB
  • ctags: 238
  • sloc: perl: 6,458; ansic: 774; sh: 332; makefile: 112
file content (48 lines) | stat: -rw-r--r-- 994 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
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/sh -e

# $Id: postrm,v 1.2 1998/10/13 03:39:01 roderick Exp $

#DEBHELPER#

any_output=
domv() {
    [ -f "$1" -a ! -f "$2" ] || return 0

    [ -n "$any_output" ] && echo
    any_output=t

    echo "In the older version of mon you're downgrading to, the $1 file" \
    	    "is kept at $2." | fmt
    while :
    do
	echo -n "Would you like me to move the existing file" \
	    	"to the old location? [Y] "
	read reply
	[ -z "$reply" ] && reply=y
	case $reply in
	    [yY]*)
	    	dir=`dirname "$2"`
		[ -d "$dir" ] || {
		    echo "mkdir $dir"
		    mkdir $dir
		}
	    	echo "mv $1 $2"
		mv "$1" "$2"
		return
		;;
	    [nN]*)
	    	echo "Leaving existing file in place."
		return
		;;
	esac
	echo "Invalid response \`$reply', answer with Y or N."
    done
}

# Before 0.37l /etc/mon didn't exist.
if [ x-"$1" = x-upgrade -a $# = 2 ] &&
	dpkg --compare-versions "$2" lt 0.37l
then
    domv /etc/mon/mon.cf /etc/mon.cf
    domv /etc/mon/netappfree.cf /usr/lib/mon/etc/netappfree.cf
fi