#!/bin/bash -e
# Source debconf library.
. /usr/share/debconf/confmodule
db_version 2.0
# This conf script is capable of backing up
db_capb backup
if [ x"$1" = x"configure" ] ; then
if [ -n $2 ] ; then
if dpkg --compare-versions "$2" lt "0.2.10-0.2" ; then
PCMCIA_SCRIPT_UP=/etc/pcmcia/ip-up.d/1masqmail
PCMCIA_SCRIPT_DOWN=/etc/pcmcia/ip-down.d/99masqmail
if [ -x $PCMCIA_SCRIPT_UP ] || [ -x $PCMCIA_SCRIPT_DOWN ] ; then
chmod -x $PCMCIA_SCRIPT_UP $PCMCIA_SCRIPT_DOWN
db_input high masqmail/note_pcmcia_scripts || true;
db_go
fi
fi
fi
fi
if [ x"$1" = x"configure" ] ; then
if [ -n $2 ] ; then
if dpkg --compare-versions "$2" lt "0.2.17-1" ; then
db_input medium masqmail/note_moved_tpl || true;
db_go
fi
fi
fi
# shamelessly copied from xserver-common.config.
# Thanks to Branden. :-)
CONFIGFILE=/etc/masqmail/masqmail.conf
ASK_TO_REPLACE=
if [ -e $CONFIGFILE ]; then
# does the file have debconf markers in it?
if egrep -q '^### BEGIN DEBCONF SECTION' $CONFIGFILE && \
egrep -q '^### END DEBCONF SECTION' $CONFIGFILE; then
PRIORITY=medium
else
ASK_TO_REPLACE=yes
PRIORITY=high
fi
else
PRIORITY=medium
# this is for the postinst, which tests this:
db_set masqmail/move_existing_nondebconf_config "true"
fi
# use debconf to manage configuration file?
db_input $PRIORITY masqmail/manage_config_with_debconf || true
db_go
db_get masqmail/manage_config_with_debconf
if [ "$RET" = "false" ]; then
exit 0
fi
# move existing configuration file out of
# the way?
if [ x"$ASK_TO_REPLACE" = x"yes" ]; then
db_input $PRIORITY masqmail/move_existing_nondebconf_config || true
db_go
db_get masqmail/move_existing_nondebconf_config || true
if [ "$RET" = "true" ]; then
mv $CONFIGFILE $CONFIGFILE.debconf-backup
else
exit 0
fi
fi
if [ -f /etc/mailname ] ; then
hostfqdn=`cat /etc/mailname`
else
hostfqdn=`hostname -f`
fi
hostname=`hostname`
db_fget masqmail/host_name seen
if [ "$RET" = "false" ]; then
db_set masqmail/host_name ${hostfqdn}
fi
db_fget masqmail/local_hosts seen
if [ "$RET" = "false" ]; then
db_set masqmail/local_hosts "localhost;${hostname};${hostfqdn}"
fi
STATE=1
while [ "$STATE" != 0 -a "$STATE" != 19 ]; do
case "$STATE" in
1)
db_input medium masqmail/host_name || true
;;
2)
db_input medium masqmail/local_hosts || true
;;
3)
db_input medium masqmail/local_nets || true
;;
4)
db_input medium masqmail/listen_addresses || true
;;
5)
db_input low masqmail/use_syslog || true
;;
6)
db_input medium masqmail/online_detect || true
;;
7)
db_get masqmail/online_detect
if [ "$RET" = "file" ] ; then
db_input low masqmail/online_file || true
else
db_input medium masqmail/online_pipe || true
fi
;;
8)
db_input medium masqmail/mbox_default || true
;;
9)
db_get masqmail/mbox_default
if [ "$RET" = "mda" ] ; then
db_input medium masqmail/mda || true
else
db_input low masqmail/mda || true
fi
;;
10)
db_input low masqmail/alias_local_caseless || true
;;
11)
db_input low masqmail/init_smtp_daemon || true
;;
12)
db_input low masqmail/init_queue_daemon || true
;;
13)
db_get masqmail/init_queue_daemon
if [ "$RET" = "true" ] ; then
db_input low masqmail/queue_daemon_ival || true
fi
;;
14)
db_input medium masqmail/init_fetch_daemon || true
;;
15)
db_get masqmail/init_fetch_daemon
if [ "$RET" = "true" ] ; then
db_input low masqmail/fetch_daemon_ival || true
fi
;;
16)
db_input medium masqmail/ipup_runqueue || true
;;
17)
db_input medium masqmail/ipup_fetch || true
;;
18)
db_input medium masqmail/ifup_ifaces || true
;;
esac
if db_go; then
STATE=$(($STATE + 1))
else
STATE=$(($STATE - 1))
fi
done
db_input medium masqmail/you_are_not_finished || true
db_go
# dpkg-reconfigure does not stop services:
# (cause of Bug#151528)
# in debhelper version < 1.2.9
DH_VERSION=`dpkg -l debconf | awk ' /^ii/ { print $3 }'`
if dpkg --compare-versions $DH_VERSION lt "1.2.9" ; then
if [ x"$1" = x"reconfigure" ] ; then
if [ -x "/etc/init.d/masqmail" ]; then
/etc/init.d/masqmail stop || true
fi
fi
fi
exit 0
syntax highlighted by Code2HTML, v. 0.9.1