summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Smith <Luke Smith>2022-07-01 19:07:46 -0400
committerLuke Smith <Luke Smith>2022-07-01 19:07:46 -0400
commitf2d10c4af65089623da01a0985623cdfd22d6ae3 (patch)
tree623ee4d36d28a988cd8a195809e1880c1e183d0c
parentab62f850027a345894de15350c726d1cbbc49be1 (diff)
fix #223
-rwxr-xr-xemailwiz.sh8
1 files changed, 4 insertions, 4 deletions
diff --git a/emailwiz.sh b/emailwiz.sh
index 0141219..f9613c7 100755
--- a/emailwiz.sh
+++ b/emailwiz.sh
@@ -45,13 +45,13 @@ subdom=${MAIL_SUBDOM:-mail}
maildomain="$subdom.$domain"
certdir="/etc/letsencrypt/live/$maildomain"
-[ ! -d "$certdir" ] && certdir="$(dirname "$(certbot certificates 2>/dev/null | grep "$maildomain\|*.$domain" -A 2 | awk '/Certificate Path/ {print $3}' | head -n1)")"
+[ ! -d "$certdir" ] &&
+ possiblecert="$(certbot certificates 2>/dev/null | grep "$maildomain\|*\.$domain" -A 2 | awk '/Certificate Path/ {print $3}' | head -n1)" &&
+ certdir="${possiblecert%/*}"
[ ! -d "$certdir" ] && echo "Note! You must first have a Let's Encrypt Certbot HTTPS/SSL Certificate for $maildomain.
-Use Let's Encrypt's Certbot to get that and then rerun this script.
-
-You may need to set up a dummy $maildomain site in nginx or Apache for that to work." && exit 1
+Use Let's Encrypt's Certbot to get that and then rerun this script." && exit 1
# NOTE ON POSTCONF COMMANDS