Remove symlinks if they exist

This commit is contained in:
Bob Mottram 2017-02-20 17:57:41 +00:00
parent 0631a8b4a7
commit e41728d618
1 changed files with 6 additions and 0 deletions

View File

@ -231,6 +231,9 @@ function add_cert_letsencrypt {
rm -f /etc/ssl/private/${LETSENCRYPT_HOSTNAME}.key
fi
fi
if [ -L /etc/ssl/private/${LETSENCRYPT_HOSTNAME}.key ]; then
rm /etc/ssl/private/${LETSENCRYPT_HOSTNAME}.key
fi
ln -s /etc/letsencrypt/live/${LETSENCRYPT_HOSTNAME}/privkey.pem /etc/ssl/private/${LETSENCRYPT_HOSTNAME}.key
# link the public key
@ -241,6 +244,9 @@ function add_cert_letsencrypt {
rm -f /etc/ssl/certs/${LETSENCRYPT_HOSTNAME}.pem
fi
fi
if [ -L /etc/ssl/certs/${LETSENCRYPT_HOSTNAME}.pem ]; then
rm /etc/ssl/certs/${LETSENCRYPT_HOSTNAME}.pem
fi
ln -s /etc/letsencrypt/live/${LETSENCRYPT_HOSTNAME}/fullchain.pem /etc/ssl/certs/${LETSENCRYPT_HOSTNAME}.pem
cp /etc/letsencrypt/live/${LETSENCRYPT_HOSTNAME}/fullchain.pem /etc/ssl/mycerts/${LETSENCRYPT_HOSTNAME}.pem