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