Correct array syntax
This commit is contained in:
parent
b0ba4cee74
commit
8efae88e1d
@ -14,11 +14,11 @@ index=0
|
|||||||
# try to find any existing certificates for the various vhosts required by
|
# try to find any existing certificates for the various vhosts required by
|
||||||
# ejabberd, otherwise retrieve them via certbot
|
# ejabberd, otherwise retrieve them via certbot
|
||||||
for vhost in ${domains[@]}; do # for each vhost
|
for vhost in ${domains[@]}; do # for each vhost
|
||||||
[ ! -d "$certdir[$index]" ] && # if default cert dir for the vhost doesn't exist
|
[ ! -d "${certdir[$index]}" ] && # if default cert dir for the vhost doesn't exist
|
||||||
certdir[$index]=$(certbot certificates 2>/dev/null | grep "Domains:.* \(\*\.$domain\|$vhost\)\(\s\|$\)" -A 2 | awk '/Certificate Path/ {print $3}' | head -n1) # set cert dir for certificate
|
certdir[$index]=$(certbot certificates 2>/dev/null | grep "Domains:.* \(\*\.$domain\|$vhost\)\(\s\|$\)" -A 2 | awk '/Certificate Path/ {print $3}' | head -n1) # set cert dir for certificate
|
||||||
((index++))
|
((index++))
|
||||||
|
|
||||||
[ ! -d "$certdir[$index]" ] && # if there is no certificate for the domain
|
[ ! -d "${certdir[$index]}" ] && # if there is no certificate for the domain
|
||||||
if systemctl is-active --quiet nginx
|
if systemctl is-active --quiet nginx
|
||||||
then
|
then
|
||||||
pacman -S --noconfirm certbot-nginx
|
pacman -S --noconfirm certbot-nginx
|
||||||
@ -29,7 +29,7 @@ for vhost in ${domains[@]}; do # for each vhost
|
|||||||
certbot -d "$vhost" certonly --standalone --register-unsafely-without-email --agree-tos &&
|
certbot -d "$vhost" certonly --standalone --register-unsafely-without-email --agree-tos &&
|
||||||
certdir[$index]="/etc/letsencrypt/live/$vhost" # request cert with certbot
|
certdir[$index]="/etc/letsencrypt/live/$vhost" # request cert with certbot
|
||||||
fi
|
fi
|
||||||
[ ! -d "$certdir[$index]" ] && echo "Error locating or installing SSL certificate." && exit 1
|
[ ! -d "${certdir[$index]}" ] && echo "Error locating or installing SSL certificate." && exit 1
|
||||||
done
|
done
|
||||||
|
|
||||||
read -p "Enter the username for the admin user: " adminusername
|
read -p "Enter the username for the admin user: " adminusername
|
||||||
|
Loading…
Reference in New Issue
Block a user