summaryrefslogtreecommitdiff
path: root/tools/mk_smtp_rules
diff options
context:
space:
mode:
Diffstat (limited to 'tools/mk_smtp_rules')
-rwxr-xr-xtools/mk_smtp_rules11
1 files changed, 7 insertions, 4 deletions
diff --git a/tools/mk_smtp_rules b/tools/mk_smtp_rules
index 85c3298..eb241b0 100755
--- a/tools/mk_smtp_rules
+++ b/tools/mk_smtp_rules
@@ -3,16 +3,19 @@
# if /etc/tcpserver/smtp.rules does not already exist,
# create it with some reasonable defaults
-dest=/etc/tcpserver/smtp.rules
+dest=$1
+
+: ${dest:=/etc/tcpserver/smtp.rules}
install -d $( dirname $dest )
-if ! test -r $dest ; then
+if test -r $dest ; then
+ 1>&2 echo "Oops, destination '$dest' already exists."
+ exit 1
+fi
<<EoF cat > $dest
10.:allow,RELAYCLIENT=""
127.0.0.:allow,RELAYCLIENT=""
:allow
EoF
-
-fi