diff options
author | Jonas Smedegaard <dr@jones.dk> | 2010-12-08 18:18:19 +0100 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2010-12-08 18:18:19 +0100 |
commit | 6df003841174375d1846b652027e3ffa7ecbb9f8 (patch) | |
tree | 761abffacd6e30ecc0f5290e35f3b54bc816ed6b /postfix | |
parent | 0e03d9cfa3da52e9413052899b59976e4a632d07 (diff) |
Verify that all input files are readable before (re)generating output file.
Diffstat (limited to 'postfix')
-rwxr-xr-x | postfix/mkpostfixconfig.sh | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/postfix/mkpostfixconfig.sh b/postfix/mkpostfixconfig.sh index 682f89b..d5a91ed 100755 --- a/postfix/mkpostfixconfig.sh +++ b/postfix/mkpostfixconfig.sh @@ -6,6 +6,16 @@ basedir="/etc/local-REDPILL" domains="$(cat "$basedir/realms" | sed 's/#.*//')" +exit1() { + response="${1:+Error: }${1:-Internal error!}" + echo "$response" + exit 1 +} + +for domain in $domains; do + [ -r "$basedir/$domain/mailnetworks" ] || exit1 "Could not read input file $basedir/$domain/mailnetworks" +done + echo '' > "$basedir/postfix/permit_mx_backup_networks" for domain in $domains; do cat "$basedir/$domain/mailnetworks" >> "$basedir/postfix/permit_mx_backup_networks" |