-
Notifications
You must be signed in to change notification settings - Fork 0
/
uninstall.sh
33 lines (32 loc) · 1.36 KB
/
uninstall.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
read -p "Are you sure you want to uninstall PiHole Argonone Fan Hat Monitor? " prompt
if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]; then
echo "############################################"
echo "Uninstalling PiHole Argonone Fan Hat Monitor"
echo "############################################"
defaultpiholedir=/var/www/html/admin
read -p "Where is your Pi-Hole Admin folder? (Default = $defaultpiholedir)" piholedir
piholedir=${piholedir:=$defaultpiholedir}
if [ ! -d "$piholedir" ]; then
echo "Directory $piholedir does not exist!! Aborting!"
exit
fi
echo "Removing Crontab"
sudo crontab -l | sudo grep -v "$piholedir/scripts/pi-hole/fanspeed/fanspeed.sh" | sudo crontab -
echo "Removing Files and config"
sudo rm -r "$piholedir/scripts/pi-hole/fanspeed/"
sudo rm "$piholedir/scripts/pi-hole/js/fan*"
sudo rm "$piholedir/fanspeed.php"
sudo rm "$piholedir/api_fanspeed.php"
read -p "Do you wish to delete the database file? " dbfile
if [[ $dbfile == "y" || $dbfile == "Y" || $dbfile == "yes" || $dbfile == "Yes" ]]; then
sudo rm /etc/pihole/fanspeed.db
fi
echo "Removing all files from PiHole and returning to standard"
cd "$piholedir"
sudo git fetch
sudo git reset --hard HEAD
echo "Uninstall Complete"
else
exit 0
fi