debian/masqmail-debian

view masqmail.config @ 51:845b243eb46f

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