diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index b0b94e85..82cfbf96 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -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 diff --git a/automated install/uninstall.sh b/automated install/uninstall.sh index a518fa0f..59eca67b 100644 --- a/automated install/uninstall.sh +++ b/automated install/uninstall.sh @@ -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