From e27fdf45b81e8795d6323e405cac6e11e859d7d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristhian=20Mart=C3=ADnez=20Ochoa?= Date: Fri, 2 Nov 2018 16:11:03 -0700 Subject: [PATCH] check permissions Now we check for sudo/root privileges before installation. --- weby | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/weby b/weby index 648d358..55d9ce1 100644 --- a/weby +++ b/weby @@ -11,7 +11,14 @@ if ! [[ $distr == "Ubuntu" && $osver =~ ^(xenial|bionic)$ ]]; then echo "**** This OS is not supported by Webinoly and could not work properly ****" echo "****************************************************************************" echo "$(tput sgr0)" - read -p "Press [Enter] key to continue..." + read -p "Press [Enter] key to Continue or [Ctrl+C] to Cancel..." +fi +# Check for sudo/root privileges +if ! groups $USERNAME | grep &>/dev/null '\bsudo\b' | groups $USERNAME | grep &>/dev/null '\broot\b'; then + echo "$(tput setaf 1)" + echo "**** [ERROR] sudo/root privileges are required to install Webinoly ****" + echo "$(tput sgr0)" + read -p "Press [Enter] key to Continue or [Ctrl+C] to Cancel..." fi # In case client is just Updating Webinoly and not fresh-installing we need accurate statistics.