4242remove () {
4343
4444 if [ "${MODE}" = "0" ] ; then
45+
4546 bf-echo " .. will remove ${1}*"
47+
4648 elif [ "${MODE}" = "1" ] ; then
47- bf-echo " .. removing ${1}*"
48- bf-rmrf ${1}* > /dev/null 2>&1
49+
50+ bf-echo " .. removing ${1}"
51+
52+ if [ -d "${1}" ] ; then
53+ bf-debug " ${1}/"
54+ rm -r ${1}
55+ fi
56+
57+ CRT=${1}.crt
58+ if [ -f "${CRT}" ] ; then
59+ bf-debug " ${CRT}"
60+ rm ${CRT}
61+ fi
62+
63+ KEY=${1}.key
64+ if [ -f "${KEY}" ] ; then
65+ bf-debug " ${KEY}"
66+ rm ${KEY}
67+ fi
68+
69+ bf-debug " done"
70+
4971 fi
5072
5173}
@@ -70,7 +92,10 @@ SSL_CONFIGS=(${PROXY_SSL_CERTS}/*)
7092bf-echo "Checking against configured domains..."
7193for CFG in "${SSL_CONFIGS[@]}" ; do
7294
73- # do nothing if this is a file
95+ # do nothing if CFG doesn't exist any more - which means it's been deleted by the script
96+ [[ ! -d "${CFG}" ]] && [[ ! -f "${CFG}" ]] && continue
97+
98+ # do nothing if CFG is a file
7499 [[ -f "${CFG}" ]] && continue
75100
76101 # get name
@@ -95,7 +120,10 @@ NGINX_CONFIGS=(${PROXY_SITES}/*)
95120bf-echo "Checking against configured domains..."
96121for CFG in "${NGINX_CONFIGS[@]}" ; do
97122
98- # do nothing if this is a file
123+ # do nothing if CFG doesn't exist any more - which means it's been deleted by the script
124+ [[ ! -d "${CFG}" ]] && [[ ! -f "${CFG}" ]] && continue
125+
126+ # do nothing if CFG is a file
99127 [[ -f "${CFG}" ]] && continue
100128
101129 # get name and strip .d from end of directory
0 commit comments