File: sendmail-base.postinst.in

package info (click to toggle)
sendmail 8.18.2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 12,268 kB
  • sloc: ansic: 106,906; perl: 7,504; sh: 5,488; makefile: 888
file content (76 lines) | stat: -rw-r--r-- 2,706 bytes parent folder | download | duplicates (5)
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
#!/bin/sh
set -e;

PACKAGE=sendmail-base;

# do we have debconf?
if [ -f /usr/share/debconf/confmodule ]; then
	DEBCONF=true;
	#. /usr/share/debconf/confmodule;
	#db_stop; # For testing
else
	DEBCONF='';
	fi;

if [ "$1" = "configure" ]; then
		#-----------------------------------------------------------
		# Tell users about new and interesting things...
		if [ -x @datadir@/sendmail/update_notices ]; then
		    @datadir@/sendmail/update_notices $2;
		    fi;

		#-----------------------------------------------------------
		# Create group/user smmta/smmsp iff needed
		touch @sysconfdir@/mail/tsmmta;
        if ! chown root:smmta @sysconfdir@/mail/tsmmta 2>/dev/null; then
            addgroup --system --quiet smmta;
            fi;
        if ! chown smmta:smmta @sysconfdir@/mail/tsmmta 2>/dev/null; then
            adduser --system --ingroup smmta --home "/var/lib/sendmail" \
                --disabled-password \
                --quiet --gecos 'Mail Transfer Agent' smmta;
            fi;
        rm @sysconfdir@/mail/tsmmta;
		touch @sysconfdir@/mail/tsmmsp;
		if ! chown root:smmsp @sysconfdir@/mail/tsmmsp 2>/dev/null; then
			addgroup --system --quiet smmsp;
			fi;
		if ! chown smmsp:smmsp @sysconfdir@/mail/tsmmsp 2>/dev/null; then
			adduser --system --ingroup smmsp --home "/var/lib/sendmail" \
				--disabled-password \
				--quiet --gecos 'Mail Submission Program' smmsp;
			fi;
		rm @sysconfdir@/mail/tsmmsp;

		#-----------------------------------------------------------
		# With a dynamic uid/gid, have to set appropriate ownership herein
		chown root:smmsp @sysconfdir@/mail/sasl;
		chown root:smmsp @sysconfdir@/mail/tls;

		if [ -f "@localstatedir@/run/sendmail/stampdir/reload" ]; then
			chown smmsp:smmsp "@localstatedir@/run/sendmail/stampdir/reload"
		fi


		#-----------------------------------------------------------
		# Save the current configuration files in safe place...
		if [ -x @sysconfdir@/cron.daily/sendmail ]; then
			echo "Saving current /etc/mail/sendmail.mc,cf to /var/backups";
			@sysconfdir@/cron.daily/sendmail || true;
			fi;

		#-----------------------------------------------------------
		# Make sure inetd.conf has sendmail in it (but disabled)
		if which update-inetd > /dev/null; then
			update-inetd --remove "^587";
			update-inetd --group MAIL --add \
				"smtp\tstream\ttcp\tnowait\troot\t@sbindir@/sendmail sendmail -Am -bs";
			update-inetd --group MAIL --add \
				"submission\tstream\ttcp\tnowait\troot\t@sbindir@/sendmail sendmail -Am -bs";
			update-inetd --group MAIL --add \
				"smtps\tstream\ttcp\tnowait\troot\t@sbindir@/sendmail sendmail -Am -bs";
			update-inetd --multi --disable smtp,smtps,submission
			fi;
fi

#DEBHELPER#