From cb401589102f226ebf316413902e9c75f3e8d01a Mon Sep 17 00:00:00 2001 From: Josh Kastang Date: Sun, 10 Jan 2016 09:31:46 -0500 Subject: [PATCH] implemented a more graceful removal of /var/www/html - it is dangerous to assume /var/www/html is not being used for anything else when uninstalling pihole --- automated install/uninstall.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/automated install/uninstall.sh b/automated install/uninstall.sh index eb07bb60..377f7ba8 100644 --- a/automated install/uninstall.sh +++ b/automated install/uninstall.sh @@ -18,7 +18,16 @@ fi apt-get -y remove --purge dnsutils bc toilet apt-get -y remove --purge dnsmasq apt-get -y remove --purge lighttpd php5-common php5-cgi php5 -rm -rf /var/www/html + +# only web directories/files that are created by pihole should +# be removed. if the web directory is empty after removing +# these files, then the parent html folder can be removed. +rm -rf /var/www/html/admin +rm -rf /var/www/html/pihold +if [ ! "$(ls -A /var/www/html)" ]; then + rm -rf /var/www/html +fi + rm /etc/dnsmasq.conf /etc/dnsmasq.conf.orig # attempt to preserve backwards compatibility with older versions