mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 02:42:58 +00:00
Initial overhaul of uninstall script sourcing distro_check()
from basic-install.sh
Totally untested as yet...
Signed-off-by: Adam Warner <adamw@rner.email>
This commit is contained in:
parent
d45695a088
commit
95e3a5944d
1 changed files with 27 additions and 11 deletions
|
@ -36,6 +36,24 @@ else
|
|||
fi
|
||||
fi
|
||||
|
||||
readonly PI_HOLE_FILES_DIR="/etc/.pihole"
|
||||
source "${PI_HOLE_FILES_DIR}/automated install/basic-install.sh"
|
||||
# setupVars set in basic-install.sh
|
||||
source "${setupVars}"
|
||||
|
||||
# distro_check() sourced from basic-install.sh
|
||||
distro_check
|
||||
|
||||
# Install packages used by the Pi-hole
|
||||
if [[ "${INSTALL_WEB}" == true ]]; then
|
||||
# Install the Web dependencies
|
||||
DEPS=("${PIHOLE_DEPS[@]}" "${PIHOLE_WEB_DEPS[@]}")
|
||||
# Otherwise,
|
||||
else
|
||||
# just install the Core dependencies
|
||||
DEPS=("${PIHOLE_DEPS[@]}")
|
||||
fi
|
||||
|
||||
# Compatability
|
||||
if [ -x "$(command -v rpm)" ]; then
|
||||
# Fedora Family
|
||||
|
@ -45,7 +63,6 @@ if [ -x "$(command -v rpm)" ]; then
|
|||
PKG_MANAGER="yum"
|
||||
fi
|
||||
PKG_REMOVE="${PKG_MANAGER} remove -y"
|
||||
PIHOLE_DEPS=( bind-utils bc dnsmasq lighttpd lighttpd-fastcgi php-common git curl unzip wget findutils )
|
||||
package_check() {
|
||||
rpm -qa | grep ^$1- > /dev/null
|
||||
}
|
||||
|
@ -56,7 +73,6 @@ elif [ -x "$(command -v apt-get)" ]; then
|
|||
# Debian Family
|
||||
PKG_MANAGER="apt-get"
|
||||
PKG_REMOVE="${PKG_MANAGER} -y remove --purge"
|
||||
PIHOLE_DEPS=( dnsutils bc dnsmasq lighttpd php5-common git curl unzip wget )
|
||||
package_check() {
|
||||
dpkg-query -W -f='${Status}' "$1" 2>/dev/null | grep -c "ok installed"
|
||||
}
|
||||
|
@ -72,7 +88,7 @@ fi
|
|||
removeAndPurge() {
|
||||
# Purge dependencies
|
||||
echo ""
|
||||
for i in "${PIHOLE_DEPS[@]}"; do
|
||||
for i in "${DEPS[@]}"; do
|
||||
package_check ${i} > /dev/null
|
||||
if [[ "$?" -eq 0 ]]; then
|
||||
while true; do
|
||||
|
|
Loading…
Reference in a new issue