debian/masqmail-debian

annotate masqmail.config @ 53:98e8aa5bd236

using scripts from autotools-dev to ensure recent config.{sub,guess} backporters to lenny need to do this manually
author meillo@marmaro.de
date Fri, 25 Jun 2010 14:08:56 +0200
parents 1b63ae1db988
children
rev   line source
meillo@51 1 #!/bin/bash
meillo@51 2 set -e
meillo@0 3
meillo@0 4 # Source debconf library.
meillo@0 5 . /usr/share/debconf/confmodule
meillo@0 6
meillo@0 7 db_version 2.0
meillo@0 8
meillo@0 9 # This conf script is capable of backing up
meillo@0 10 db_capb backup
meillo@0 11
meillo@0 12 # shamelessly copied from xserver-common.config.
meillo@0 13 # Thanks to Branden. :-)
meillo@0 14
meillo@0 15 CONFIGFILE=/etc/masqmail/masqmail.conf
meillo@0 16
meillo@0 17 ASK_TO_REPLACE=
meillo@0 18 if [ -e $CONFIGFILE ]; then
meillo@0 19 # does the file have debconf markers in it?
meillo@0 20 if egrep -q '^### BEGIN DEBCONF SECTION' $CONFIGFILE && \
meillo@0 21 egrep -q '^### END DEBCONF SECTION' $CONFIGFILE; then
meillo@0 22 PRIORITY=medium
meillo@0 23 else
meillo@0 24 ASK_TO_REPLACE=yes
meillo@0 25 PRIORITY=high
meillo@0 26 fi
meillo@0 27 else
meillo@0 28 PRIORITY=medium
meillo@0 29 # this is for the postinst, which tests this:
meillo@0 30 db_set masqmail/move_existing_nondebconf_config "true"
meillo@0 31 fi
meillo@0 32
meillo@0 33 # use debconf to manage configuration file?
meillo@0 34 db_input $PRIORITY masqmail/manage_config_with_debconf || true
meillo@0 35 db_go
meillo@0 36 db_get masqmail/manage_config_with_debconf
meillo@0 37 if [ "$RET" = "false" ]; then
meillo@0 38 exit 0
meillo@0 39 fi
meillo@0 40
meillo@0 41 # move existing configuration file out of
meillo@0 42 # the way?
meillo@0 43 if [ x"$ASK_TO_REPLACE" = x"yes" ]; then
meillo@0 44 db_input $PRIORITY masqmail/move_existing_nondebconf_config || true
meillo@0 45 db_go
meillo@0 46 db_get masqmail/move_existing_nondebconf_config || true
meillo@0 47 if [ "$RET" = "true" ]; then
meillo@0 48 mv $CONFIGFILE $CONFIGFILE.debconf-backup
meillo@0 49 else
meillo@0 50 exit 0
meillo@0 51 fi
meillo@0 52 fi
meillo@0 53
meillo@0 54 if [ -f /etc/mailname ] ; then
meillo@0 55 hostfqdn=`cat /etc/mailname`
meillo@9 56 elif [ `hostname -f 2>/dev/null` ] ; then
meillo@0 57 hostfqdn=`hostname -f`
meillo@0 58 fi
meillo@0 59 hostname=`hostname`
meillo@0 60
meillo@0 61 db_fget masqmail/host_name seen
meillo@0 62 if [ "$RET" = "false" ]; then
meillo@0 63 db_set masqmail/host_name ${hostfqdn}
meillo@0 64 fi
meillo@0 65 db_fget masqmail/local_hosts seen
meillo@0 66 if [ "$RET" = "false" ]; then
meillo@0 67 db_set masqmail/local_hosts "localhost;${hostname};${hostfqdn}"
meillo@0 68 fi
meillo@0 69
meillo@0 70 STATE=1
meillo@0 71 while [ "$STATE" != 0 -a "$STATE" != 19 ]; do
meillo@0 72 case "$STATE" in
meillo@0 73 1)
meillo@0 74 db_input medium masqmail/host_name || true
meillo@0 75 ;;
meillo@0 76 2)
meillo@0 77 db_input medium masqmail/local_hosts || true
meillo@0 78 ;;
meillo@0 79 3)
meillo@0 80 db_input medium masqmail/local_nets || true
meillo@0 81 ;;
meillo@0 82 4)
meillo@0 83 db_input medium masqmail/listen_addresses || true
meillo@0 84 ;;
meillo@0 85 5)
meillo@0 86 db_input low masqmail/use_syslog || true
meillo@0 87 ;;
meillo@0 88 6)
meillo@0 89 db_input medium masqmail/online_detect || true
meillo@0 90 ;;
meillo@0 91 7)
meillo@0 92 db_get masqmail/online_detect
meillo@0 93 if [ "$RET" = "file" ] ; then
meillo@0 94 db_input low masqmail/online_file || true
meillo@0 95 else
meillo@0 96 db_input medium masqmail/online_pipe || true
meillo@0 97 fi
meillo@0 98 ;;
meillo@0 99 8)
meillo@0 100 db_input medium masqmail/mbox_default || true
meillo@0 101 ;;
meillo@0 102 9)
meillo@0 103 db_get masqmail/mbox_default
meillo@0 104 if [ "$RET" = "mda" ] ; then
meillo@0 105 db_input medium masqmail/mda || true
meillo@0 106 else
meillo@0 107 db_input low masqmail/mda || true
meillo@0 108 fi
meillo@0 109 ;;
meillo@0 110 10)
meillo@0 111 db_input low masqmail/alias_local_caseless || true
meillo@0 112 ;;
meillo@0 113 11)
meillo@0 114 db_input low masqmail/init_smtp_daemon || true
meillo@0 115 ;;
meillo@0 116 12)
meillo@0 117 db_input low masqmail/init_queue_daemon || true
meillo@0 118 ;;
meillo@0 119 13)
meillo@0 120 db_get masqmail/init_queue_daemon
meillo@0 121 if [ "$RET" = "true" ] ; then
meillo@0 122 db_input low masqmail/queue_daemon_ival || true
meillo@0 123 fi
meillo@0 124 ;;
meillo@0 125 14)
meillo@0 126 db_input medium masqmail/init_fetch_daemon || true
meillo@0 127 ;;
meillo@0 128 15)
meillo@0 129 db_get masqmail/init_fetch_daemon
meillo@0 130 if [ "$RET" = "true" ] ; then
meillo@0 131 db_input low masqmail/fetch_daemon_ival || true
meillo@0 132 fi
meillo@0 133 ;;
meillo@0 134 16)
meillo@0 135 db_input medium masqmail/ipup_runqueue || true
meillo@0 136 ;;
meillo@0 137 17)
meillo@0 138 db_input medium masqmail/ipup_fetch || true
meillo@0 139 ;;
meillo@0 140 18)
meillo@0 141 db_input medium masqmail/ifup_ifaces || true
meillo@0 142 ;;
meillo@0 143
meillo@0 144 esac
meillo@0 145
meillo@0 146 if db_go; then
meillo@0 147 STATE=$(($STATE + 1))
meillo@0 148 else
meillo@0 149 STATE=$(($STATE - 1))
meillo@0 150 fi
meillo@0 151 done
meillo@0 152
meillo@0 153 # dpkg-reconfigure does not stop services:
meillo@0 154 # (cause of Bug#151528)
meillo@0 155 # in debhelper version < 1.2.9
meillo@0 156
meillo@0 157 DH_VERSION=`dpkg -l debconf | awk ' /^ii/ { print $3 }'`
meillo@0 158
meillo@0 159 if dpkg --compare-versions $DH_VERSION lt "1.2.9" ; then
meillo@0 160 if [ x"$1" = x"reconfigure" ] ; then
meillo@0 161 if which invoke-rc.d >/dev/null 2>&1; then
meillo@0 162 invoke-rc.d masqmail stop
meillo@0 163 else
meillo@0 164 if [ -x "/etc/init.d/masqmail" ]; then
meillo@0 165 /etc/init.d/masqmail stop || true
meillo@0 166 fi
meillo@0 167 fi
meillo@0 168 fi
meillo@0 169 fi
meillo@0 170
meillo@0 171 exit 0