From f284400eabd4805f258cd98d520efc51aab14512 Mon Sep 17 00:00:00 2001 From: Eduardo Mozart de Oliveira <2974895+eduardomozart@users.noreply.github.com> Date: Wed, 9 Aug 2023 15:28:39 -0300 Subject: [PATCH] Check if user belongs to sudo group (#14) Fixes #12 --- 1-setup.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/1-setup.sh b/1-setup.sh index 8f19cd3..ca8de67 100644 --- a/1-setup.sh +++ b/1-setup.sh @@ -39,6 +39,13 @@ if [[ $EUID -eq 0 ]]; then exit 1 fi +if ! [ $(id -nG "$USER" 2>/dev/null | egrep "sudo" | wc -l) -gt 0 ]; then + echo + echo -e "${LRED}The current user (${USER}) does not belong to 'sudo' group." 1>&2 + echo -e ${NC} + exit 1 +fi + # Check to see if previous build/install files exist, stop and check to be safe. if [ "$(find . -maxdepth 1 \( -name 'guacamole-*' -o -name 'mysql-connector-j-*' \))" != "" ]; then # Script branding header