summaryrefslogtreecommitdiff
path: root/postfix
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2010-12-08 18:18:19 +0100
committerJonas Smedegaard <dr@jones.dk>2010-12-08 18:18:19 +0100
commit6df003841174375d1846b652027e3ffa7ecbb9f8 (patch)
tree761abffacd6e30ecc0f5290e35f3b54bc816ed6b /postfix
parent0e03d9cfa3da52e9413052899b59976e4a632d07 (diff)
Verify that all input files are readable before (re)generating output file.
Diffstat (limited to 'postfix')
-rwxr-xr-xpostfix/mkpostfixconfig.sh10
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"