mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-12-23 21:30:17 +00:00
Prompt user to remove each dependent package if they do choose to remove packages at all.
This commit is contained in:
parent
5ee382c8eb
commit
5442954db6
2 changed files with 52 additions and 10 deletions
|
@ -75,9 +75,9 @@ fi
|
|||
spinner()
|
||||
{
|
||||
local pid=$1
|
||||
local delay=0.75
|
||||
local delay=0.50
|
||||
local spinstr='|/-\'
|
||||
while [ "$(ps a | awk '{print $1}' | grep $pid)" ]; do
|
||||
while [ "$(ps a | awk '{print $1}' | grep "$pid")" ]; do
|
||||
local temp=${spinstr#?}
|
||||
printf " [%c] " "$spinstr"
|
||||
local spinstr=$temp${spinstr%"$temp"}
|
||||
|
@ -486,6 +486,10 @@ installConfigs() {
|
|||
$SUDO echo ":::"
|
||||
$SUDO echo "::: Installing configs..."
|
||||
versionCheckDNSmasq
|
||||
if [ ! -d "/etc/lighttpd" ]; then
|
||||
$SUDO mkdir /etc/lighttpd
|
||||
$SUDO chown "$USER":root /etc/lighttpds
|
||||
fi
|
||||
$SUDO mv /etc/lighttpd/lighttpd.conf /etc/lighttpd/lighttpd.conf.orig
|
||||
$SUDO cp /etc/.pihole/advanced/lighttpd.conf /etc/lighttpd/lighttpd.conf
|
||||
}
|
||||
|
@ -664,6 +668,9 @@ installPihole() {
|
|||
stopServices
|
||||
setUser
|
||||
$SUDO mkdir -p /etc/pihole/
|
||||
if [ ! -d "/var/www/html" ]; then
|
||||
$SUDO mkdir /var/www/html
|
||||
fi
|
||||
$SUDO chown www-data:www-data /var/www/html
|
||||
$SUDO chmod 775 /var/www/html
|
||||
$SUDO usermod -a -G www-data pihole
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
if [[ $EUID -eq 0 ]];then
|
||||
echo "You are root."
|
||||
else
|
||||
echo "sudo will be used for the install."
|
||||
echo "sudo will be used for the uninstall."
|
||||
# Check if it is actually installed
|
||||
# If it isn't, exit because the unnstall cannot complete
|
||||
if [[ $(dpkg-query -s sudo) ]];then
|
||||
|
@ -27,15 +27,49 @@ fi
|
|||
|
||||
function removeAndPurge {
|
||||
# Purge dependencies
|
||||
echo "Purging dependencies!"
|
||||
$SUDO apt-get -y remove --purge dnsutils bc toilet
|
||||
$SUDO apt-get -y remove --purge dnsmasq
|
||||
$SUDO apt-get -y remove --purge lighttpd php5-common php5-cgi php5
|
||||
read -p "Do you wish to purge dnsutils?" -n 1 -r
|
||||
echo
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
$SUDO apt-get -y remove --purge dnsutils
|
||||
fi
|
||||
|
||||
read -p "Do you wish to purge bc?" -n 1 -r
|
||||
echo
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
$SUDO apt-get -y remove --purge bc
|
||||
fi
|
||||
|
||||
read -p "Do you wish to purge toilet?" -n 1 -r
|
||||
echo
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
$SUDO apt-get -y remove --purge toilet
|
||||
fi
|
||||
|
||||
read -p "Do you wish to purge dnsmasq?" -n 1 -r
|
||||
echo
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
$SUDO apt-get -y remove --purge dnsmasq
|
||||
fi
|
||||
|
||||
read -p "Do you wish to purge lighttpd?" -n 1 -r
|
||||
echo
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
$SUDO apt-get -y remove --purge lighttpd
|
||||
fi
|
||||
|
||||
read -p "Do you wish to purge php5?" -n 1 -r
|
||||
echo
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
$SUDO apt-get -y remove --purge php5-common php5-cgi php5
|
||||
fi
|
||||
|
||||
# Remove dependency config files
|
||||
echo "Removing dnsmasq config files..."
|
||||
$SUDO rm /etc/dnsmasq.conf /etc/dnsmasq.conf.orig /etc/dnsmasq.d/01-pihole.conf &> /dev/null
|
||||
|
||||
# Take care of any additional package cleaning
|
||||
$SUDO apt-get -y autoremove
|
||||
|
||||
# Call removeNoPurge to remove PiHole specific files
|
||||
removeNoPurge
|
||||
}
|
||||
|
@ -86,13 +120,14 @@ function removeNoPurge {
|
|||
}
|
||||
|
||||
######### SCRIPT ###########
|
||||
echo "WARNING: This is destructive if run on any non-Debian based OS"
|
||||
echo "(SAFE TO RUN ON RASPBIAN)"
|
||||
echo "Preparing to remove packages, be sure that each may be safely removed depending on your operating system."
|
||||
echo "(SAFE TO REMOVE ALL ON RASPBIAN)"
|
||||
while true; do
|
||||
read -p "Do you wish to purge PiHole's dependencies from your OS?" yn
|
||||
read -rp "Do you wish to purge PiHole's dependencies from your OS? (You will be prompted for each package)" yn
|
||||
case $yn in
|
||||
[Yy]* ) removeAndPurge; break;;
|
||||
|
||||
[Nn]* ) removeNoPurge; break;;
|
||||
esac
|
||||
done
|
||||
|
||||
|
|
Loading…
Reference in a new issue