masqmail

annotate debian/masqmail.config @ 1:af25f5c39d90

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