2015-12-06 14:31:49 +00:00
|
|
|
#!/usr/bin/env bash
|
2015-11-21 19:29:03 +00:00
|
|
|
# Completely uninstalls the Pi-hole
|
2015-12-06 14:31:49 +00:00
|
|
|
# (c) 2015 by Jacob Salmela
|
|
|
|
# This file is part of Pi-hole.
|
|
|
|
#
|
|
|
|
# Pi-hole is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
|
2016-01-10 14:01:41 +00:00
|
|
|
# Must be root to uninstall
|
2016-01-10 16:48:48 +00:00
|
|
|
if [[ $EUID -ne 0 ]]; then
|
|
|
|
sudo bash "$0" "$@"
|
|
|
|
exit $?
|
2016-01-10 14:01:41 +00:00
|
|
|
fi
|
2015-11-21 19:29:03 +00:00
|
|
|
|
2016-01-10 16:48:48 +00:00
|
|
|
|
2015-11-21 19:29:03 +00:00
|
|
|
######### SCRIPT ###########
|
2016-01-10 14:01:41 +00:00
|
|
|
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
|
2016-01-10 14:31:46 +00:00
|
|
|
|
|
|
|
# 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
|
2016-01-10 15:23:03 +00:00
|
|
|
rm -rf /var/www/html/pihole
|
|
|
|
rm /var/www/html/index.lighttpd.orig
|
2016-01-10 14:31:46 +00:00
|
|
|
if [ ! "$(ls -A /var/www/html)" ]; then
|
|
|
|
rm -rf /var/www/html
|
|
|
|
fi
|
|
|
|
|
2016-01-10 14:01:41 +00:00
|
|
|
rm /etc/dnsmasq.conf /etc/dnsmasq.conf.orig
|
2016-01-10 14:29:38 +00:00
|
|
|
|
|
|
|
# attempt to preserve backwards compatibility with older versions
|
|
|
|
# to gaurentee no additional changes were made to /etc/crontab after
|
|
|
|
# the installation of pihole, /etc/crontab.pihole should be permanently
|
|
|
|
# preserved.
|
|
|
|
# @TODO: debugging statement alerting user of this.
|
|
|
|
if [ -f /etc/crontab.orig ]; then
|
|
|
|
mv /etc/crontab /etc/crontab.pihole
|
|
|
|
mv /etc/crontab.orig /etc/crontab
|
|
|
|
service cron restart
|
|
|
|
fi
|
|
|
|
|
|
|
|
# attempt to preserve backwards compatibility with older versions
|
|
|
|
if [ -f /etc/cron.d/pihole ]; then
|
|
|
|
rm /etc/cron.d/pihole
|
|
|
|
fi
|
|
|
|
|
2016-01-10 14:01:41 +00:00
|
|
|
rm /etc/dnsmasq.conf
|
|
|
|
rm -rf /etc/lighttpd/
|
|
|
|
rm /var/log/pihole.log
|
|
|
|
rm /usr/local/bin/gravity.sh
|
|
|
|
rm /usr/local/bin/chronometer.sh
|
|
|
|
rm /usr/local/bin/whitelist.sh
|
|
|
|
rm /usr/local/bin/piholeLogFlush.sh
|
|
|
|
rm -rf /etc/pihole/
|