Separated if statements for prerequisite checks

This commit is contained in:
Asif Bacchus 2018-10-03 15:38:35 -06:00
parent 9661209194
commit 48d06eaa58

View File

@ -215,12 +215,16 @@ done
### Verify script pre-requisties ### Verify script pre-requisties
# If not running as root, display error on console and exit
## If not running as root, display error on console and exit
if [ $(id -u) -ne 0 ]; then if [ $(id -u) -ne 0 ]; then
echo -e "\n${err}This script MUST be run as ROOT. Exiting.${normal}" echo -e "\n${err}This script MUST be run as ROOT. Exiting.${normal}"
exit 2 exit 2
fi
## Check NextCloud webroot
# Ensure NextCloud webroot is provided # Ensure NextCloud webroot is provided
elif [ -z "$ncRoot" ]; then if [ -z "$ncRoot" ]; then
echo -e "\n${err}The NextCloud webroot must be specified (-n parameter)" \ echo -e "\n${err}The NextCloud webroot must be specified (-n parameter)" \
"${normal}\n" "${normal}\n"
exit 1 exit 1
@ -234,8 +238,11 @@ elif [ -n "$ncRoot" ]; then
"(-n parameter) does not exist.${normal}\n" "(-n parameter) does not exist.${normal}\n"
exit 1 exit 1
fi fi
fi
## Check NextCloud webuser account
# Ensure NextCloud webuser account is provided # Ensure NextCloud webuser account is provided
elif [ -z "$webUser" ]; then if [ -z "$webUser" ]; then
echo -e "\n${err}The webuser account running NextCloud must be provided" \ echo -e "\n${err}The webuser account running NextCloud must be provided" \
"(-u parameter)${normal}\n" "(-u parameter)${normal}\n"
exit 1 exit 1