summaryrefslogtreecommitdiff
path: root/debian/sendmail.cron.daily.in
blob: 131f9a23c64793296238b21462d205787a31ef5b (plain)
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
#!/bin/sh
set +e;

#------------------------------------------------------------------------------
# Autoconf variables - in a form suitable for sh, perl
# Generated automatically from autoconf.sh.in by configure.
#------------------------------------------------------------------------------
# Variables for, and by, Autoconf (Don't touch these! edit config step)
PACKAGE_NAME="@PACKAGE_NAME@";
PACKAGE_VERSION="@PACKAGE_VERSION@";
prefix="@prefix@";
exec_prefix="@exec_prefix@";
bindir="@bindir@";
sbindir="@sbindir@";
libexecdir="@libexecdir@";
datadir="@datadir@";
sysconfdir="@sysconfdir@";
sharedstatedir="@sharedstatedir@";
localstatedir="@localstatedir@";
libdir="@libdir@";
includedir="@includedir@";
infodir="@infodir@";
mandir="@mandir@";
docdir="@docdir@";
srcdir="@srcdir@";

copies=2;

# backup "/etc/mail/sendmail.mc"
if [ -f ${sysconfdir}/mail/sendmail.mc ]; then
	if [ ! -f ${localstatedir}/backups/sendmail.mc.bak ]; then
		cp -pf ${sysconfdir}/mail/sendmail.mc \
			${localstatedir}/backups/sendmail.mc.bak;
	   	fi;
	if ! cmp -s ${localstatedir}/backups/sendmail.mc.bak \
		${sysconfdir}/mail/sendmail.mc ; then
		cd ${localstatedir}/backups;
		/usr/bin/savelog -p -c $copies sendmail.mc.bak > /dev/null;
		cp -pf ${sysconfdir}/mail/sendmail.mc \
			${localstatedir}/backups/sendmail.mc.bak;
		fi;
	fi;

# backup "/etc/mail/submit.mc"
if [ -f ${sysconfdir}/mail/submit.mc ]; then
	if [ ! -f ${localstatedir}/backups/submit.mc.bak ]; then
		cp -pf ${sysconfdir}/mail/submit.mc \
			${localstatedir}/backups/submit.mc.bak;
		fi;
	if ! cmp -s ${localstatedir}/backups/submit.mc.bak \
		${sysconfdir}/mail/submit.mc ; then
		cd ${localstatedir}/backups;
		/usr/bin/savelog -p -c $copies submit.mc.bak > /dev/null;
		cp -pf ${sysconfdir}/mail/submit.mc \
			${localstatedir}/backups/submit.mc.bak;
		fi;
	fi;

# while we're here, might as well do sendmail.cf
if [ -f ${sysconfdir}/mail/sendmail.cf ]; then
	if [ ! -f ${localstatedir}/backups/sendmail.cf.bak ]; then
		cp -pf ${sysconfdir}/mail/sendmail.cf \
			${localstatedir}/backups/sendmail.cf.bak;
		fi;
	if ! cmp -s ${localstatedir}/backups/sendmail.cf.bak \
		${sysconfdir}/mail/sendmail.cf ; then
		cd ${localstatedir}/backups;
		# save previous generation only if differences are significant
		diff -bBwI "^\#\#\#\#\# " \
			${localstatedir}/backups/sendmail.cf.bak \
			${sysconfdir}/mail/sendmail.cf > /dev/null;
		if [ $? -ne 0 ]; then
			/usr/bin/savelog -p -c $copies sendmail.cf.bak \
				> /dev/null;
			fi;
		cp -pf ${sysconfdir}/mail/sendmail.cf \
			${localstatedir}/backups/sendmail.cf.bak;
		fi;
	fi;

# while we're here, might as well do submit.cf
if [ -f ${sysconfdir}/mail/submit.cf ]; then
	if [ ! -f ${localstatedir}/backups/submit.cf.bak ]; then
		cp -pf ${sysconfdir}/mail/submit.cf \
			${localstatedir}/backups/submit.cf.bak;
		fi;
	if ! cmp -s ${localstatedir}/backups/submit.cf.bak \
		${sysconfdir}/mail/submit.cf ; then
		cd ${localstatedir}/backups;
		# save previous generation only if differences are significant
		diff -bBwI "^\#\#\#\#\# " \
			${localstatedir}/backups/submit.cf.bak \
			${sysconfdir}/mail/submit.cf > /dev/null;
		if [ $? -ne 0 ]; then
			/usr/bin/savelog -p -c $copies submit.cf.bak \
				> /dev/null;
			fi;
		cp -pf ${sysconfdir}/mail/submit.cf \
			${localstatedir}/backups/submit.cf.bak;
		fi;
	fi;