exits if sudo is not installed when run as a regular user
pull/185/head
jacobsalmela 9 years ago
parent bee109c784
commit 0a0f00da3b

@ -17,11 +17,19 @@
# curl -L install.pi-hole.net | bash
######## VARIABLES #########
# Must be root to install
if [[ $EUID -eq 0 ]];then
echo "You are root."
else
echo "sudo will be used for the install."
export SUDO="sudo"
# Check if it is actually installed
# If it isn't, exit because the install cannot complete
if [[ $(dpkg-query -s sudo) ]];then
export SUDO="sudo"
else
echo "Please install sudo or run this as root."
exit 1
fi
fi

@ -13,7 +13,14 @@ if [[ $EUID -eq 0 ]];then
echo "You are root."
else
echo "sudo will be used for the install."
export SUDO="sudo"
# Check if it is actually installed
# If it isn't, exit because the unnstall cannot complete
if [[ $(dpkg-query -s sudo) ]];then
export SUDO="sudo"
else
echo "Please install sudo or run this as root."
exit 1
fi
fi

Loading…
Cancel
Save