summaryrefslogtreecommitdiffstats
path: root/opendkim.sh
blob: d4f011116588087b39458adf6c02b118f0a5b69b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# This source code is released into the public domain.
#
# The OpenDKIM internal.ldap file is just a list of prefixes, one per line.

OPENDKIM_FILE="/usr/local/etc/mail/internal.ldap"
OPENDKIM_TEMP="${OPENDKIM_FILE}.ldaptmp"

if [ ! -f "$OPENDKIM_FILE" ]; then
	exit 0
fi

awk <"$NETWORKS_FILE" >"$OPENDKIM_TEMP" '{ print $1 }'

if cmp -s "$OPENDKIM_TEMP" "$OPENDKIM_FILE"; then
	rm "$OPENDKIM_TEMP"
	exit 0
fi

printf '%s updated:\n\n' "$OPENDKIM_FILE"
diff "$OPENDKIM_FILE" "$OPENDKIM_TEMP"
printf '\n'

mv "$OPENDKIM_TEMP" "$OPENDKIM_FILE" 
/usr/local/etc/rc.d/milter-opendkim reload