postinst is in masqmail 0.2.30-1.
This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | #!/bin/sh
set -e
# source debconf library
. /usr/share/debconf/confmodule
CONFIGFILE=/etc/masqmail/masqmail.conf
WORKTMP=$CONFIGFILE.tmp
DEBCONFTMP=$CONFIGFILE.debconf
DEFAULTSFILE=/etc/default/masqmail
DEBDEFTMP=$DEFAULTSFILE.debconf
create_db_conf (){
rm -f $WORKTMP $DEBCONFTMP
cat >> $DEBCONFTMP << EOF
### BEGIN DEBCONF SECTION
# Do not edit within this region if you want your changes to be preserved by
# debconf. Instead, make changes after the "### END DEBCONF SECTION" line.
EOF
db_get masqmail/host_name || true
echo "host_name=\"$RET\"" >> $DEBCONFTMP
db_get masqmail/local_hosts || true
echo "local_hosts=\"$RET\"" >> $DEBCONFTMP
db_get masqmail/local_nets || true
echo "local_nets=\"$RET\"" >> $DEBCONFTMP
db_get masqmail/listen_addresses || true
echo "listen_addresses=\"$RET\"" >> $DEBCONFTMP
echo "spool_dir=\"/var/spool/masqmail\"" >> $DEBCONFTMP
echo "mail_dir=\"/var/mail\"" >> $DEBCONFTMP
echo "log_dir=\"/var/log/masqmail\"" >> $DEBCONFTMP
echo "do_queue=false" >> $DEBCONFTMP
db_get masqmail/use_syslog || true
echo "use_syslog=$RET" >> $DEBCONFTMP
db_get masqmail/online_detect || true
echo "online_detect=$RET" >> $DEBCONFTMP
if [ "$RET" = "file" ] ; then
db_get masqmail/online_file || true
echo "online_file=\"$RET\"" >> $DEBCONFTMP
else
db_get masqmail/online_pipe || true
echo "online_pipe=\"$RET\"" >> $DEBCONFTMP
fi
db_get masqmail/mbox_default || true
echo "mbox_default=$RET" >> $DEBCONFTMP
db_get masqmail/mda || true
echo "mda=\"$RET\"" >> $DEBCONFTMP
echo "alias_file=/etc/aliases" >> $DEBCONFTMP
db_get masqmail/alias_local_caseless || true
echo "alias_local_caseless=\"$RET\"" >> $DEBCONFTMP
cat >> $DEBCONFTMP << EOF
### END DEBCONF SECTION
EOF
}
write_db_conf (){
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
# see if the beginning of the file was left alone; sed cannot backtrack in
# an address range
if ! head -1 $CONFIGFILE | egrep -q '^### BEGIN DEBCONF SECTION'; then
# sick, sick, sick
LINES=$(sed -n '1,/^### BEGIN DEBCONF SECTION/p' < $CONFIGFILE | wc -l)
sed -n 1,$(( $LINES - 1 ))p < $CONFIGFILE > $WORKTMP
fi
cat $DEBCONFTMP >> $WORKTMP
sed -n '/^### END DEBCONF SECTION/,$p' < $CONFIGFILE | tail -n +2 >> $WORKTMP
else
echo "Existing $CONFIGFILE has missing or half-open debconf region;" >&2;
echo "not writing masqmail configuration file." >&2;
exit 1
fi
else
cat >> $DEBCONFTMP << EOF
#
# include the locations of your route and get configurations here.
# Examples:
# online_routes.default = "/etc/masqmail/default.route"
# online_gets.default = "/etc/masqmail/default.get"
# You can have more of those, with '.default' replaced with other
# names. See man 8 masqmail.conf.
#
EOF
cp $DEBCONFTMP $WORKTMP
fi
mv $WORKTMP $CONFIGFILE
# rm -f $WORKTMP $DEBCONFTMP
}
create_db_defaults () {
cat >> $DEBDEFTMP << EOF
#
# better use 'dpkg-reconfigure masqmail'
# instead of editing by hand
#
EOF
db_get masqmail/init_smtp_daemon || true
echo "INIT_SMTP_DAEMON=\"$RET\"" >> $DEBDEFTMP
db_get masqmail/init_queue_daemon || true
echo "INIT_QUEUE_DAEMON=\"$RET\"" >> $DEBDEFTMP
db_get masqmail/init_fetch_daemon || true
echo "INIT_FETCH_DAEMON=\"$RET\"" >> $DEBDEFTMP
echo "#" >> $DEBDEFTMP
db_get masqmail/queue_daemon_ival || true
echo "QUEUE_DAEMON_IVAL=\"$RET\"" >> $DEBDEFTMP
db_get masqmail/fetch_daemon_ival || true
echo "FETCH_DAEMON_IVAL=\"$RET\"" >> $DEBDEFTMP
echo "#" >> $DEBDEFTMP
db_get masqmail/ipup_runqueue || true
echo "IPUP_RUNQUEUE=\"$RET\"" >> $DEBDEFTMP
db_get masqmail/ipup_fetch || true
echo "IPUP_FETCH=\"$RET\"" >> $DEBDEFTMP
db_get masqmail/ifup_ifaces || true
echo "IFUP_IFACES=\"$RET\"" >> $DEBDEFTMP
}
write_db_defaults () {
mv $DEBDEFTMP $DEFAULTSFILE
}
case "$1" in
configure)
# Create spool and log directories
install -d -omail -gmail /var/log/masqmail
install -d -omail -gmail /var/spool/masqmail
install -d -omail -gmail /var/spool/masqmail/input
install -d -omail -gmail /var/spool/masqmail/lock
install -d -omail -gmail /var/spool/masqmail/popuidl
db_get masqmail/manage_config_with_debconf || true
if [ "$RET" = "true" ]; then
db_get masqmail/move_existing_nondebconf_config || true
if [ "$RET" = "true" ]; then
create_db_conf
write_db_conf
fi
create_db_defaults
write_db_defaults
fi
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
esac
# Automatically added by dh_installinit
if [ -x "/etc/init.d/masqmail" ]; then
update-rc.d masqmail defaults >/dev/null
invoke-rc.d masqmail start || exit $?
fi
# End automatically added section
|