# This source code is released into the public domain. # # The Postfix mynetworks.ldap file is a list of " OK", one per line. # Since this is a cidr map, there's no need to run postmap, but we do have # to reload postfix. POSTFIX_FILE="/usr/local/etc/postfix/mynetworks.ldap" POSTFIX_TEMP="${POSTFIX_FILE}.ldaptmp" if [ ! -f "$POSTFIX_FILE" ]; then exit 0 fi awk <"$NETWORKS_FILE" >"$POSTFIX_TEMP" '{ print $1 " OK" }' if cmp -s "$POSTFIX_TEMP" "$POSTFIX_FILE"; then rm "$POSTFIX_TEMP" exit 0 fi printf '%s updated:\n\n' "$POSTFIX_FILE" diff "$POSTFIX_FILE" "$POSTFIX_TEMP" printf '\n' mv "$POSTFIX_TEMP" "$POSTFIX_FILE" /usr/local/sbin/postfix reload