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 49
|
#!/bin/sh -e
# $Id: preinst,v 1.1 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 "The $1 file has been moved to $2 in this version of mon." | fmt
while :
do
echo -n "Would you like me to move the existing file" \
"to the new 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
}
# /etc/mon was created in 0.37l.
if [ x-"$1" = x-upgrade -o x-"$1" = x-install ] && [ $# = 2 ] &&
# Config files from another version are present.
dpkg --compare-versions "$2" lt 0.37l
# The old version is from before the change.
then
domv /etc/mon.cf /etc/mon/mon.cf
domv /usr/lib/mon/etc/netappfree.cf /etc/mon/netappfree.cf
fi
|