mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 02:42:58 +00:00
indent nested function in basic-install.sh
fix dependency in uninstall.sh Signed-off-by: Adam Warner <adamw@rner.email>
This commit is contained in:
parent
d92434b1e9
commit
64f29120c8
2 changed files with 25 additions and 25 deletions
|
@ -177,22 +177,22 @@ if command -v apt-get &> /dev/null; then
|
||||||
# The DNS server user
|
# The DNS server user
|
||||||
DNSMASQ_USER="dnsmasq"
|
DNSMASQ_USER="dnsmasq"
|
||||||
|
|
||||||
# A function to check...
|
# A function to check...
|
||||||
test_dpkg_lock() {
|
test_dpkg_lock() {
|
||||||
# An iterator used for counting loop iterations
|
# An iterator used for counting loop iterations
|
||||||
i=0
|
i=0
|
||||||
# fuser is a program to show which processes use the named files, sockets, or filesystems
|
# fuser is a program to show which processes use the named files, sockets, or filesystems
|
||||||
# So while the command is true
|
# So while the command is true
|
||||||
while fuser /var/lib/dpkg/lock >/dev/null 2>&1 ; do
|
while fuser /var/lib/dpkg/lock >/dev/null 2>&1 ; do
|
||||||
# Wait half a second
|
# Wait half a second
|
||||||
sleep 0.5
|
sleep 0.5
|
||||||
# and increase the iterator
|
# and increase the iterator
|
||||||
((i=i+1))
|
((i=i+1))
|
||||||
done
|
done
|
||||||
# Always return success, since we only return if there is no
|
# Always return success, since we only return if there is no
|
||||||
# lock (anymore)
|
# lock (anymore)
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
# If apt-get is not found, check for rpm to see if it's a Red Hat family OS
|
# If apt-get is not found, check for rpm to see if it's a Red Hat family OS
|
||||||
elif command -v rpm &> /dev/null; then
|
elif command -v rpm &> /dev/null; then
|
||||||
|
|
|
@ -45,7 +45,7 @@ if [ -x "$(command -v rpm)" ]; then
|
||||||
PKG_MANAGER="yum"
|
PKG_MANAGER="yum"
|
||||||
fi
|
fi
|
||||||
PKG_REMOVE="${PKG_MANAGER} remove -y"
|
PKG_REMOVE="${PKG_MANAGER} remove -y"
|
||||||
PIHOLE_DEPS=( bind-utils bc dnsmasq lighttpd lighttpd-fastcgi php-common php-sqlite git curl unzip wget findutils )
|
PIHOLE_DEPS=( bind-utils bc dnsmasq lighttpd lighttpd-fastcgi php-common php-pdo git curl unzip wget findutils )
|
||||||
package_check() {
|
package_check() {
|
||||||
rpm -qa | grep ^$1- > /dev/null
|
rpm -qa | grep ^$1- > /dev/null
|
||||||
}
|
}
|
||||||
|
@ -94,12 +94,12 @@ removeAndPurge() {
|
||||||
# Remove dnsmasq config files
|
# Remove 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
|
||||||
echo -e " ${TICK} Removing dnsmasq config files"
|
echo -e " ${TICK} Removing dnsmasq config files"
|
||||||
|
|
||||||
# Take care of any additional package cleaning
|
# Take care of any additional package cleaning
|
||||||
echo -ne " ${INFO} Removing & cleaning remaining dependencies..."
|
echo -ne " ${INFO} Removing & cleaning remaining dependencies..."
|
||||||
package_cleanup &> /dev/null
|
package_cleanup &> /dev/null
|
||||||
echo -e "${OVER} ${TICK} Removed & cleaned up remaining dependencies"
|
echo -e "${OVER} ${TICK} Removed & cleaned up remaining dependencies"
|
||||||
|
|
||||||
# Call removeNoPurge to remove Pi-hole specific files
|
# Call removeNoPurge to remove Pi-hole specific files
|
||||||
removeNoPurge
|
removeNoPurge
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,7 @@ removeNoPurge() {
|
||||||
${SUDO} mv /etc/lighttpd/lighttpd.conf.orig /etc/lighttpd/lighttpd.conf
|
${SUDO} mv /etc/lighttpd/lighttpd.conf.orig /etc/lighttpd/lighttpd.conf
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
${SUDO} rm /etc/dnsmasq.d/adList.conf &> /dev/null
|
${SUDO} rm /etc/dnsmasq.d/adList.conf &> /dev/null
|
||||||
${SUDO} rm /etc/dnsmasq.d/01-pihole.conf &> /dev/null
|
${SUDO} rm /etc/dnsmasq.d/01-pihole.conf &> /dev/null
|
||||||
${SUDO} rm -rf /var/log/*pihole* &> /dev/null
|
${SUDO} rm -rf /var/log/*pihole* &> /dev/null
|
||||||
|
@ -156,23 +156,23 @@ removeNoPurge() {
|
||||||
${SUDO} rm /etc/bash_completion.d/pihole &> /dev/null
|
${SUDO} rm /etc/bash_completion.d/pihole &> /dev/null
|
||||||
${SUDO} rm /etc/sudoers.d/pihole &> /dev/null
|
${SUDO} rm /etc/sudoers.d/pihole &> /dev/null
|
||||||
echo -e " ${TICK} Removed config files"
|
echo -e " ${TICK} Removed config files"
|
||||||
|
|
||||||
# Remove FTL
|
# Remove FTL
|
||||||
if command -v pihole-FTL &> /dev/null; then
|
if command -v pihole-FTL &> /dev/null; then
|
||||||
echo -ne " ${INFO} Removing pihole-FTL..."
|
echo -ne " ${INFO} Removing pihole-FTL..."
|
||||||
|
|
||||||
if [[ -x "$(command -v systemctl)" ]]; then
|
if [[ -x "$(command -v systemctl)" ]]; then
|
||||||
systemctl stop pihole-FTL
|
systemctl stop pihole-FTL
|
||||||
else
|
else
|
||||||
service pihole-FTL stop
|
service pihole-FTL stop
|
||||||
fi
|
fi
|
||||||
|
|
||||||
${SUDO} rm /etc/init.d/pihole-FTL
|
${SUDO} rm /etc/init.d/pihole-FTL
|
||||||
${SUDO} rm /usr/bin/pihole-FTL
|
${SUDO} rm /usr/bin/pihole-FTL
|
||||||
|
|
||||||
echo -e "${OVER} ${TICK} Removed pihole-FTL"
|
echo -e "${OVER} ${TICK} Removed pihole-FTL"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If the pihole user exists, then remove
|
# If the pihole user exists, then remove
|
||||||
if id "pihole" &> /dev/null; then
|
if id "pihole" &> /dev/null; then
|
||||||
${SUDO} userdel -r pihole 2> /dev/null
|
${SUDO} userdel -r pihole 2> /dev/null
|
||||||
|
|
Loading…
Reference in a new issue