Mercurial > debian > masqmail-debian
diff masqmail.config @ 0:5ef519035828
debian directory of masqmail-0.2.21-4
author | meillo@marmaro.de |
---|---|
date | Fri, 26 Sep 2008 21:25:48 +0200 |
parents | |
children | 1b63ae1db988 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/masqmail.config Fri Sep 26 21:25:48 2008 +0200 @@ -0,0 +1,170 @@ +#!/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 + +# 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 + +# 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 which invoke-rc.d >/dev/null 2>&1; then + invoke-rc.d masqmail stop + else + if [ -x "/etc/init.d/masqmail" ]; then + /etc/init.d/masqmail stop || true + fi + fi + fi +fi + +exit 0