From e41728d618bde3b7f3ea824f2a5edd89420f43f5 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 20 Feb 2017 17:57:41 +0000 Subject: [PATCH] Remove symlinks if they exist --- src/freedombone-addcert | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/freedombone-addcert b/src/freedombone-addcert index e49492c6..f606677a 100755 --- a/src/freedombone-addcert +++ b/src/freedombone-addcert @@ -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