From 690822fd57bb508f6619ab18289deb0387b59e2d Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Sat, 20 Oct 2018 11:39:08 +0200 Subject: Tidy: Reorder to first resolve variables, then check if mailhost exists, then other mailhost rules. --- dehydrated/cron.weekly/local-dehydrated | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'dehydrated') 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 -- cgit v1.2.3