check permissions

Now we check for sudo/root privileges before installation.
This commit is contained in:
Cristhian Martínez Ochoa 2018-11-02 16:11:03 -07:00
parent 5869e4efbe
commit e27fdf45b8

9
weby
View file

@ -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.