From 307f5e52297d7de1a8c47beb411548669a7cefe7 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Tue, 5 Feb 2019 22:30:19 -0600 Subject: [PATCH] Update nodemgmt-scripts.sh --- nodemgmt-scripts.sh | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/nodemgmt-scripts.sh b/nodemgmt-scripts.sh index 00abce85..dc9edd16 100755 --- a/nodemgmt-scripts.sh +++ b/nodemgmt-scripts.sh @@ -192,7 +192,12 @@ DELSITE(){ esac shift done - if [ -z ${DEL_SSL+x} ]; then DEL_SSL=no; fi + if [ -z ${DEL_SSL+x} ] || [[ $DEL_SSL =~ ^[Nn]$ ]]; then + DEL_SSL=no + elif [[ $DEL_SSL =~ ^[Yy]$ ]]; then + DEL_SSL=yes + fi + if [ ! -z ${DEL_SITE+x} ]; then echo -e "${idsCL[LightRed]}Deleting site '${idsCL[Red]}${DEL_SITE}${idsCL[LightRed]}'...${idsCL[Default]}" echo "" @@ -217,12 +222,10 @@ DELSITE(){ if [ -d /var/www/${DEL_SITE} ]; then ${NCMD} rm -rf /var/www/${DEL_SITE} fi - if [ "${DEL_SSL}" = "yes" ]; then - if [ -d /etc/letsencrypt/archive/${DEL_SITE} ]; then - ${NCMD} rm -rf /etc/letsencrypt/archive/${DEL_SITE} - ${NCMD} rm -rf /etc/letsencrypt/live/${DEL_SITE} - ${NCMD} rm -f /etc/letsencrypt/renewal/${DEL_SITE}.conf - fi + if [ "${DEL_SSL}" = "yes" ] && [ -d /etc/letsencrypt/archive/${DEL_SITE} ]; then + ${NCMD} rm -rf /etc/letsencrypt/archive/${DEL_SITE} + ${NCMD} rm -rf /etc/letsencrypt/live/${DEL_SITE} + ${NCMD} rm -f /etc/letsencrypt/renewal/${DEL_SITE}.conf fi echo -e "${idsCL[Green]}OK${idsCL[Default]}" nid=`expr $nid + 1` @@ -275,7 +278,9 @@ DELSITES(){ if [[ $response =~ ^[Yy]$ ]]; then echo -e -n "${idsCL[LightRed]}Do you also want to delete the certs for '${SITES[${selsite}]}' as well? [y/N]${idsCL[Default]} " read sslresponse - echo "delete - '${sslresponse}'" + DELSITE ${SITES[${selsite}]} ${sslresponse} + echo "" + DIVIDER ENTER2CONTINUE break else