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 diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/masqmail.config	Fri Sep 26 21:25:48 2008 +0200
     1.3 @@ -0,0 +1,170 @@
     1.4 +#!/bin/bash -e
     1.5 +
     1.6 +# Source debconf library.
     1.7 +. /usr/share/debconf/confmodule
     1.8 +
     1.9 +db_version 2.0
    1.10 +
    1.11 +# This conf script is capable of backing up
    1.12 +db_capb backup
    1.13 +
    1.14 +# shamelessly copied from xserver-common.config.
    1.15 +# Thanks to Branden. :-)
    1.16 +
    1.17 +CONFIGFILE=/etc/masqmail/masqmail.conf
    1.18 +
    1.19 +ASK_TO_REPLACE=
    1.20 +if [ -e $CONFIGFILE ]; then
    1.21 +  # does the file have debconf markers in it?
    1.22 +  if egrep -q '^### BEGIN DEBCONF SECTION' $CONFIGFILE && \
    1.23 +     egrep -q '^### END DEBCONF SECTION' $CONFIGFILE; then
    1.24 +    PRIORITY=medium
    1.25 +  else
    1.26 +    ASK_TO_REPLACE=yes
    1.27 +    PRIORITY=high
    1.28 +  fi
    1.29 +else
    1.30 +  PRIORITY=medium
    1.31 +  # this is for the postinst, which tests this:
    1.32 +  db_set masqmail/move_existing_nondebconf_config "true"
    1.33 +fi
    1.34 +
    1.35 +# use debconf to manage configuration file?
    1.36 +db_input $PRIORITY masqmail/manage_config_with_debconf || true
    1.37 +db_go
    1.38 +db_get masqmail/manage_config_with_debconf
    1.39 +if [ "$RET" = "false" ]; then
    1.40 +  exit 0
    1.41 +fi
    1.42 +
    1.43 +# move existing configuration file out of
    1.44 +# the way?
    1.45 +if [ x"$ASK_TO_REPLACE" = x"yes" ]; then
    1.46 +  db_input $PRIORITY masqmail/move_existing_nondebconf_config || true
    1.47 +  db_go
    1.48 +  db_get masqmail/move_existing_nondebconf_config || true
    1.49 +  if [ "$RET" = "true" ]; then
    1.50 +    mv $CONFIGFILE $CONFIGFILE.debconf-backup
    1.51 +  else
    1.52 +    exit 0
    1.53 +  fi
    1.54 +fi
    1.55 +
    1.56 +if [ -f /etc/mailname ] ; then
    1.57 +  hostfqdn=`cat /etc/mailname`
    1.58 +else
    1.59 +  hostfqdn=`hostname -f`
    1.60 +fi
    1.61 +hostname=`hostname`
    1.62 +
    1.63 +db_fget masqmail/host_name seen
    1.64 +if [ "$RET" = "false" ]; then
    1.65 +    db_set masqmail/host_name ${hostfqdn}
    1.66 +fi
    1.67 +db_fget masqmail/local_hosts seen
    1.68 +if [ "$RET" = "false" ]; then
    1.69 +    db_set masqmail/local_hosts "localhost;${hostname};${hostfqdn}"
    1.70 +fi
    1.71 +
    1.72 +STATE=1
    1.73 +while [ "$STATE" != 0 -a "$STATE" != 19 ]; do
    1.74 +	case "$STATE" in
    1.75 +	1)
    1.76 +		db_input medium masqmail/host_name || true
    1.77 +		;;
    1.78 +	2)
    1.79 +		db_input medium masqmail/local_hosts || true
    1.80 +		;;
    1.81 +	3)
    1.82 +		db_input medium masqmail/local_nets || true
    1.83 +		;;
    1.84 +	4)
    1.85 +		db_input medium masqmail/listen_addresses || true
    1.86 +		;;
    1.87 +	5)
    1.88 +		db_input low masqmail/use_syslog || true
    1.89 +		;;
    1.90 +	6)
    1.91 +		db_input medium masqmail/online_detect || true
    1.92 +		;;
    1.93 +	7)
    1.94 +		db_get masqmail/online_detect
    1.95 +		if [ "$RET" = "file" ] ; then
    1.96 +			db_input low masqmail/online_file || true
    1.97 +		else
    1.98 +			db_input medium masqmail/online_pipe || true
    1.99 +		fi
   1.100 +		;;
   1.101 +	8)
   1.102 +		db_input medium masqmail/mbox_default || true
   1.103 +		;;
   1.104 +	9)
   1.105 +		db_get masqmail/mbox_default
   1.106 +		if [ "$RET" = "mda" ] ; then
   1.107 +		    db_input medium masqmail/mda || true
   1.108 +		else
   1.109 +		    db_input low masqmail/mda || true
   1.110 +		fi
   1.111 +		;;
   1.112 +	10)
   1.113 +		db_input low masqmail/alias_local_caseless || true
   1.114 +		;;
   1.115 +	11)
   1.116 +		db_input low masqmail/init_smtp_daemon || true
   1.117 +		;;
   1.118 +	12)
   1.119 +		db_input low masqmail/init_queue_daemon || true
   1.120 +		;;
   1.121 +	13)
   1.122 +		db_get masqmail/init_queue_daemon
   1.123 +		if [ "$RET" = "true" ] ; then
   1.124 +		    db_input low masqmail/queue_daemon_ival || true
   1.125 +		fi
   1.126 +		;;
   1.127 +	14)
   1.128 +		db_input medium masqmail/init_fetch_daemon || true
   1.129 +		;;
   1.130 +	15)
   1.131 +		db_get masqmail/init_fetch_daemon
   1.132 +		if [ "$RET" = "true" ] ; then
   1.133 +		    db_input low masqmail/fetch_daemon_ival || true
   1.134 +		fi
   1.135 +		;;
   1.136 +	16)
   1.137 +		db_input medium masqmail/ipup_runqueue || true
   1.138 +		;;
   1.139 +	17)
   1.140 +		db_input medium masqmail/ipup_fetch || true
   1.141 +		;;
   1.142 +	18)
   1.143 +		db_input medium masqmail/ifup_ifaces || true
   1.144 +		;;
   1.145 +
   1.146 +	esac			
   1.147 +
   1.148 +	if db_go; then
   1.149 +		STATE=$(($STATE + 1))
   1.150 +	else
   1.151 +		STATE=$(($STATE - 1))
   1.152 +	fi
   1.153 +done
   1.154 + 	
   1.155 +# dpkg-reconfigure does not stop services:
   1.156 +# (cause of Bug#151528)
   1.157 +# in debhelper version < 1.2.9
   1.158 +
   1.159 +DH_VERSION=`dpkg -l debconf | awk ' /^ii/ { print $3 }'`
   1.160 +
   1.161 +if dpkg --compare-versions $DH_VERSION lt "1.2.9" ; then
   1.162 +    if [ x"$1" = x"reconfigure" ] ; then
   1.163 +	if which invoke-rc.d >/dev/null 2>&1; then
   1.164 +		invoke-rc.d masqmail stop 
   1.165 +	else
   1.166 +		if [ -x "/etc/init.d/masqmail" ]; then
   1.167 +	    		/etc/init.d/masqmail stop || true
   1.168 +		fi
   1.169 +	fi
   1.170 +    fi
   1.171 +fi
   1.172 +
   1.173 +exit 0