summaryrefslogtreecommitdiff
path: root/dehydrated
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2018-10-20 11:39:08 +0200
committerJonas Smedegaard <dr@jones.dk>2018-10-20 11:39:08 +0200
commit690822fd57bb508f6619ab18289deb0387b59e2d (patch)
tree0119448adbbba4db6cbe0a605ec3135b76c3dee6 /dehydrated
parent9cd25d92fe4cba6010c16630c394ea911ad32bb9 (diff)
Tidy: Reorder to first resolve variables, then check if mailhost exists, then other mailhost rules.
Diffstat (limited to 'dehydrated')
-rwxr-xr-xdehydrated/cron.weekly/local-dehydrated22
1 files changed, 11 insertions, 11 deletions
diff --git a/dehydrated/cron.weekly/local-dehydrated b/dehydrated/cron.weekly/local-dehydrated
index 861169f..9ec2acd 100755
--- a/dehydrated/cron.weekly/local-dehydrated
+++ b/dehydrated/cron.weekly/local-dehydrated
@@ -6,22 +6,22 @@ set -eu
REALM=$(cat /etc/local-ORG/realm) || true
-# update non-EC mailhost cert if resolvable and not a certdomain
mailhost=$(cat "/etc/local-REDPILL/$REALM/mailhost") || true
mailname=$(cat /etc/mailname) || true
-
fqdn=$(hostname --fqdn)
-if [ -n "$fqdn" ] && [ "$mailhost" != "$fqdn" ]; then
- extradomains=${extradomains:+$extradomains }$fqdn
-fi
-
domain=$(hostname --domain)
-if [ -n "$domain" ] && [ "$mailhost" != "$domain" ] && [ "$fqdn" != "$domain" ]; then
- extradomains=${extradomains:+$extradomains }$domain
-fi
-if [ -n "$mailhost" ] && [ "$mailhost" = "$mailname" ] && ! grep ^"$mailhost" /etc/dehydrated/domains.txt; then
- dehydrated --cron --domain "$mailhost $extradomains" --algo rsa
+# update non-EC mailhost cert if resolvable and not a certdomain
+if [ -n "$mailhost" ]; then
+ if [ -n "$fqdn" ] && [ "$mailhost" != "$fqdn" ]; then
+ extradomains=${extradomains:+$extradomains }$fqdn
+ fi
+ if [ -n "$domain" ] && [ "$mailhost" != "$domain" ] && [ "$fqdn" != "$domain" ]; then
+ extradomains=${extradomains:+$extradomains }$domain
+ fi
+ if [ "$mailhost" = "$mailname" ] && ! grep ^"$mailhost" /etc/dehydrated/domains.txt; then
+ dehydrated --cron --domain "$mailhost $extradomains" --algo rsa
+ fi
fi
# update certdomain certs