exits if sudo is not installed when run as a regular user
This commit is contained in:
jacobsalmela 2016-01-16 14:10:03 -06:00
parent bee109c784
commit 0a0f00da3b
2 changed files with 17 additions and 2 deletions

View File

@ -17,11 +17,19 @@
# curl -L install.pi-hole.net | bash # curl -L install.pi-hole.net | bash
######## VARIABLES ######### ######## VARIABLES #########
# Must be root to install
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 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 fi

View File

@ -13,7 +13,14 @@ 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 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 fi