mirror of
https://github.com/pi-hole/pi-hole
synced 2024-11-17 21:59:55 +00:00
Consistency
Now with block indents!
This commit is contained in:
parent
640398ced4
commit
7ebaf8e843
@ -11,29 +11,29 @@
|
|||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
|
|
||||||
# Must be root to uninstall
|
# Must be root to uninstall
|
||||||
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 uninstall."
|
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 [ -x "$(command -v sudo)" ];then
|
if [ -x "$(command -v sudo)" ]; then
|
||||||
export SUDO="sudo"
|
export SUDO="sudo"
|
||||||
else
|
else
|
||||||
echo "::: Please install sudo or run this as root."
|
echo "::: Please install sudo or run this as root."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Compatability
|
# Compatability
|
||||||
if [ -x "$(command -v rpm)" ];then
|
if [ -x "$(command -v rpm)" ]; then
|
||||||
# Fedora Family
|
# Fedora Family
|
||||||
if [ -x "$(command -v dnf)" ];then
|
if [ -x "$(command -v dnf)" ]; then
|
||||||
PKG_MANAGER="dnf"
|
PKG_MANAGER="dnf"
|
||||||
else
|
else
|
||||||
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 git curl unzip wget findutils )
|
PIHOLE_DEPS=( bind-utils bc dnsmasq lighttpd lighttpd-fastcgi php-common git curl unzip wget findutils )
|
||||||
package_check() {
|
package_check() {
|
||||||
rpm -qa | grep ^$1- > /dev/null
|
rpm -qa | grep ^$1- > /dev/null
|
||||||
@ -41,10 +41,10 @@ if [ -x "$(command -v rpm)" ];then
|
|||||||
package_cleanup() {
|
package_cleanup() {
|
||||||
${SUDO} ${PKG_MANAGER} -y autoremove
|
${SUDO} ${PKG_MANAGER} -y autoremove
|
||||||
}
|
}
|
||||||
elif [ -x "$(command -v apt-get)" ];then
|
elif [ -x "$(command -v apt-get)" ]; then
|
||||||
# Debian Family
|
# Debian Family
|
||||||
PKG_MANAGER="apt-get"
|
PKG_MANAGER="apt-get"
|
||||||
PKG_REMOVE="$PKG_MANAGER -y remove --purge"
|
PKG_REMOVE="${PKG_MANAGER} -y remove --purge"
|
||||||
PIHOLE_DEPS=( dnsutils bc dnsmasq lighttpd php5-common git curl unzip wget )
|
PIHOLE_DEPS=( dnsutils bc dnsmasq lighttpd php5-common git curl unzip wget )
|
||||||
package_check() {
|
package_check() {
|
||||||
dpkg-query -W -f='${Status}' "$1" 2>/dev/null | grep -c "ok installed"
|
dpkg-query -W -f='${Status}' "$1" 2>/dev/null | grep -c "ok installed"
|
||||||
@ -59,17 +59,17 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
spinner() {
|
spinner() {
|
||||||
local pid=$1
|
local pid=$1
|
||||||
local delay=0.50
|
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}"}
|
||||||
sleep ${delay}
|
sleep ${delay}
|
||||||
printf "\b\b\b\b\b\b"
|
printf "\b\b\b\b\b\b"
|
||||||
done
|
done
|
||||||
printf " \b\b\b\b"
|
printf " \b\b\b\b"
|
||||||
}
|
}
|
||||||
|
|
||||||
removeAndPurge() {
|
removeAndPurge() {
|
||||||
@ -79,15 +79,15 @@ removeAndPurge() {
|
|||||||
package_check ${i} > /dev/null
|
package_check ${i} > /dev/null
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
while true; do
|
while true; do
|
||||||
read -rp "::: Do you wish to remove $i from your system? [y/n]: " yn
|
read -rp "::: Do you wish to remove ${i} from your system? [y/n]: " yn
|
||||||
case ${yn} in
|
case ${yn} in
|
||||||
[Yy]* ) printf ":::\tRemoving %s..." "$i"; ${SUDO} ${PKG_REMOVE} "$i" &> /dev/null & spinner $!; printf "done!\n"; break;;
|
[Yy]* ) printf ":::\tRemoving %s..." "${i}"; ${SUDO} ${PKG_REMOVE} "${i}" &> /dev/null & spinner $!; printf "done!\n"; break;;
|
||||||
[Nn]* ) printf ":::\tSkipping %s" "$i\n"; break;;
|
[Nn]* ) printf ":::\tSkipping %s" "${i}\n"; break;;
|
||||||
* ) printf "::: You must answer yes or no!\n";;
|
* ) printf "::: You must answer yes or no!\n";;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
printf ":::\tPackage %s not installed... Not removing.\n" "$i"
|
printf ":::\tPackage %s not installed... Not removing.\n" "${i}"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user