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 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
|
#! /bin/sh
# postinst script for hinfo
set -e
. /usr/share/debconf/confmodule
case "$1" in
configure|reconfigure)
where=
for period in daily weekly monthly
do
if [ -x /etc/cron.${period}/hinfo ] ; then
if [ -z "$where" ] ; then
where=$period
else
if cmp /etc/cron.${period}/hinfo /etc/cron.${where}/hinfo
then
rm /etc/cron/${where}/hinfo
where=$period
else
echo "You have both /etc/cron.${where}/hinfo and /etc/cron.${period}/hinfo" 1>&2
echo "One of these should be remvoed" 1>&2
fi
fi
fi
done
for file in whois.ins.pl dnsbl.ins.pl
do
cp -u /usr/share/hinfo/${file} /var/lib/hinfo/${file}
done
db_get hinfo/autoupdate
au=$RET
case "$au" in
never)
if [ ! -z "$where" ] ; then
ucf -s /usr/share/hinfo /dev/null /etc/cron.${where}/hinfo
if [ -f /etc/cron.${where}/hinfo -a ! -s /etc/cron.${where}/hinfo ]
then
rm /etc/cron.${where}/hinfo
fi
fi
;;
now)
if [ ! -z "$where" ] ; then
ucf -s /usr/share/hinfo /dev/null /etc/cron.${where}/hinfo
if [ -f /etc/cron.${where}/hinfo -a ! -s /etc/cron.${where}/hinfo ]
then
rm /etc/cron.${where}/hinfo
fi
fi
/usr/sbin/hinfo-update || true
;;
daily|weekly|monthly)
db_get hinfo/autoupdateverbose
verb=$RET
if id hinfo >/dev/null 2>&1 ; then : ; else
adduser --system --disabled-login --home /var/lib/hinfo hinfo
fi
chown -R hinfo /var/lib/hinfo
if [ ! -f /etc/cron.${au}/hinfo -a ! -z "$where" ] ; then
mv /etc/cron.${where}/hinfo /etc/cron.${au}/hinfo
fi
temp=`tempfile -p hinfo -m 0755`
cat <<EOF >$temp
#!/bin/sh
if [ -x /usr/sbin/hinfo-update ] ; then
su -s /bin/sh -c '/usr/sbin/hinfo-update -$verb' hinfo
fi
EOF
ucf -s /usr/share/hinfo $temp /etc/cron.${au}/hinfo
chmod u+x /etc/cron.${au}/hinfo
rm $temp
su -s /bin/sh -c /usr/sbin/hinfo-update hinfo || true
;;
esac
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0
|