source: trunk/debathena/config/msmtp-config/debian/debathena-msmtp-mta.postinst @ 25210

Revision 25210, 1.8 KB checked in by jdreed, 13 years ago (diff)
In msmtp-config: * Move debconf and aliases postinst stuff to debathena-msmtp-mta (Trac: #953) echo '# /etc/aliases' > /etc/aliases.tmp echo '# Created by debathena-msmtp-mta postinst' > /etc/aliases.tmp echo 'mailer-daemon: postmaster' >> /etc/aliases.tmp for i in postmaster nobody hostmaster usenet news webmaster www ftp abuse noc security cron; do echo "${i}: root" done >> /etc/aliases.tmp if [ -n "$1" ]; then fi mv /etc/aliases.tmp /etc/aliases configure) ;; abort-upgrade|abort-remove|abort-deconfigure) ;; *) echo "postinst called with unknown argument \`$1'" >&2 exit 1 ;;
Line 
1#!/bin/sh
2# postinst script for debathena-msmtp-mta
3#
4# see: dh_installdeb(1)
5
6set -e
7
8# summary of how this script can be called:
9#        * <postinst> `configure' <most-recently-configured-version>
10#        * <old-postinst> `abort-upgrade' <new version>
11#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
12#          <new-version>
13#        * <postinst> `abort-remove'
14#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
15#          <failed-install-package> <version> `removing'
16#          <conflicting-package> <version>
17# for details, see http://www.debian.org/doc/debian-policy/ or
18# the debian-policy package
19
20# Source debconf library.
21. /usr/share/debconf/confmodule
22
23# Mostly copied from exim4-config's postinst
24writealiases() {
25    echo '# /etc/aliases' > /etc/aliases.tmp
26    echo '# Created by debathena-msmtp-mta postinst' > /etc/aliases.tmp
27    echo 'mailer-daemon: postmaster' >> /etc/aliases.tmp
28    for i in postmaster nobody hostmaster usenet news webmaster www ftp abuse noc security cron; do
29        echo "${i}: root"
30    done >> /etc/aliases.tmp
31    if [ -n "$1" ]; then
32        echo "root: $1" >> /etc/aliases.tmp
33    fi
34    mv /etc/aliases.tmp /etc/aliases
35}
36
37case "$1" in
38    configure)
39        if [ ! -e /etc/aliases ]; then
40            db_get debathena-msmtp-config/root_addr
41            writealiases "$RET"
42        else
43            # Whine at the user if it looks like root's mail will
44            # end up somewhere local
45            if ! expand-alias root | grep -q @; then
46                echo "WARNING: Check /etc/aliases to ensure root's mail goes somewhere useful." >&2
47            fi
48        fi
49    ;;
50
51    abort-upgrade|abort-remove|abort-deconfigure)
52    ;;
53
54    *)
55        echo "postinst called with unknown argument \`$1'" >&2
56        exit 1
57    ;;
58esac
59
60# dh_installdeb will replace this with shell code automatically
61# generated by other debhelper scripts.
62
63#DEBHELPER#
64
65exit 0
Note: See TracBrowser for help on using the repository browser.