From 3aa525b0c0311f8d6775cdf7153625992510fa53 Mon Sep 17 00:00:00 2001 From: WaLLy3K Date: Fri, 22 Sep 2017 14:17:56 +1000 Subject: [PATCH 1/2] Ensure domains files are not deleted upon w/blist --- gravity.sh | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/gravity.sh b/gravity.sh index 6c3e9ec6..cba3c083 100755 --- a/gravity.sh +++ b/gravity.sh @@ -554,14 +554,17 @@ gravity_Cleanup() { rm ${piholeDir}/*.tmp 2> /dev/null rm /tmp/*.phgpb 2> /dev/null - # Remove any unused .domains files - for file in ${piholeDir}/*.${domainsExtension}; do - # If list is not in active array, then remove it - if [[ ! "${activeDomains[*]}" == *"${file}"* ]]; then - rm -f "${file}" 2> /dev/null || \ - echo -e " ${CROSS} Failed to remove ${file##*/}" - fi - done + # Ensure this function only runs alongside gravity_Supernova() + if [[ "${skipDownload}" == false ]]; then + # Remove any unused .domains files + for file in ${piholeDir}/*.${domainsExtension}; do + # If list is not in active array, then remove it + if [[ ! "${activeDomains[*]}" == *"${file}"* ]]; then + rm -f "${file}" 2> /dev/null || \ + echo -e " ${CROSS} Failed to remove ${file##*/}" + fi + done + fi echo -e "${OVER} ${TICK} ${str}" From cd7c00ef8e4dd3b64721c31045c3c616694c9d5f Mon Sep 17 00:00:00 2001 From: WaLLy3K Date: Sat, 23 Sep 2017 10:32:56 +1000 Subject: [PATCH 2/2] Fix Ctrl-C inadvertently deleting domains files --- gravity.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gravity.sh b/gravity.sh index cba3c083..a228644c 100755 --- a/gravity.sh +++ b/gravity.sh @@ -181,6 +181,7 @@ gravity_Supernova() { echo "" fi done + gravity_Blackbody=true } # Download specified URL and perform checks on HTTP status and file content @@ -554,8 +555,8 @@ gravity_Cleanup() { rm ${piholeDir}/*.tmp 2> /dev/null rm /tmp/*.phgpb 2> /dev/null - # Ensure this function only runs alongside gravity_Supernova() - if [[ "${skipDownload}" == false ]]; then + # Ensure this function only runs when gravity_Supernova() has completed + if [[ "${gravity_Blackbody:-}" == true ]]; then # Remove any unused .domains files for file in ${piholeDir}/*.${domainsExtension}; do # If list is not in active array, then remove it