File: postinst

package info (click to toggle)
email-reminder 0.7.8-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 744 kB
  • ctags: 154
  • sloc: perl: 2,302; xml: 112; sh: 75; makefile: 11
file content (69 lines) | stat: -rwxr-xr-x 2,447 bytes parent folder | download | duplicates (6)
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
#!/bin/sh

set -e

# summary of how this script can be called:
#        * <postinst> `configure' <most-recently-configured-version>
#        * <old-postinst> `abort-upgrade' <new version>
#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
#          <new-version>
#        * <postinst> `abort-remove'
#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
#          <failed-install-package> <version> `removing'
#          <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package

. /usr/share/debconf/confmodule

CONFIG_FILE=/etc/email-reminder.conf

case "$1" in
    configure)
        # Create a restricted user to run send-reminders with
        adduser --system --disabled-login --shell /bin/false --no-create-home --home /var/spool/email-reminder --gecos 'Email-reminder mailer,,,' email-reminder || true

        # The config file can include the SMTP password so hide it
	touch $CONFIG_FILE
        chmod 600 $CONFIG_FILE
	chown email-reminder $CONFIG_FILE

	# Generate the config file
        echo "# WARNING: this file is automatically generated by debconf" > $CONFIG_FILE
        echo "# DO NOT edit directly or your changes will be lost" >> $CONFIG_FILE
        echo "# Instead, run 'dpkg-reconfigure email-reminder'" >> $CONFIG_FILE
        db_get email-reminder/send_reminders
        echo "send_reminders = ${RET}" >> $CONFIG_FILE
        db_get email-reminder/smtp_server
        echo "smtp_server = ${RET}" >> $CONFIG_FILE
        db_get email-reminder/smtp_username
        echo "smtp_username = ${RET}" >> $CONFIG_FILE
        db_get email-reminder/smtp_password
        echo "smtp_password = ${RET}" >> $CONFIG_FILE
        db_reset email-reminder/smtp_password
        db_get email-reminder/smtp_ssl
        echo "smtp_ssl = ${RET}" >> $CONFIG_FILE
        db_get email-reminder/mail_from
        echo "mail_from = ${RET}" >> $CONFIG_FILE

        # Create the spool directory for that user
        mkdir -p /var/spool/email-reminder
        chown email-reminder /var/spool/email-reminder/
        chmod 750 /var/spool/email-reminder/
    ;;

    abort-upgrade|abort-remove|abort-deconfigure)
    ;;

    *)
        echo "postinst called with unknown argument \`$1'" >&2
        exit 1
    ;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0