init script error message output
This commit is contained in:
@@ -12,13 +12,13 @@ if [ -f "${CONFIG_BASE}webhook.cfg" ]; then
|
||||
fi;
|
||||
error=0;
|
||||
if [ "${USE_SUDO}" != "0" ] && ! id "${SUDO_USER}" &>/dev/null; then
|
||||
echo "sudo user ${SUDO_USER} does not exist";
|
||||
echo "[!] sudo user ${SUDO_USER} does not exist";
|
||||
error=1;
|
||||
fi;
|
||||
# check that user exist
|
||||
# check that git exists
|
||||
if [ -z "$(command -v git)" ]; then
|
||||
echo "git is not installed";
|
||||
echo "[!] git is not installed";
|
||||
error=1;
|
||||
fi;
|
||||
GIT_COMMAND_BASE=("git");
|
||||
@@ -27,7 +27,7 @@ if [ -n "${USE_SUDO}" ]; then
|
||||
if [ "$(whoami)" = "root" ]; then
|
||||
GIT_COMMAND_BASE=("sudo" "-u" "${SUDO_USER}" "git");
|
||||
elif [ "$(whoami)" != "${SUDO_USER}" ]; then
|
||||
echo "Script must be run as root or as the ${SUDO_USER}";
|
||||
echo "[!] Script must be run as root or as the ${SUDO_USER}";
|
||||
error=1;
|
||||
fi;
|
||||
fi;
|
||||
@@ -39,25 +39,25 @@ LOG_FOLDER="log/"
|
||||
|
||||
# base folder does not exist
|
||||
if [ ! -d "${GIT_WEBHOOK_BASE_FOLDER}" ]; then
|
||||
echo "Base folder: ${GIT_WEBHOOK_BASE_FOLDER} not found";
|
||||
echo "[!] Base folder: ${GIT_WEBHOOK_BASE_FOLDER} not found";
|
||||
error=1;
|
||||
fi;
|
||||
|
||||
# branch name not set
|
||||
if [ -n "${BRANCH}" ]; then
|
||||
echo "No branch name given";
|
||||
echo "[!] No branch name given";
|
||||
error=1;
|
||||
fi;
|
||||
|
||||
# check that log folder exists
|
||||
if [ ! -d "${GIT_WEBHOOK_BASE_FOLDER}${LOG_FOLDER}" ]; then
|
||||
echo "Log folder does not exist: ${GIT_WEBHOOK_BASE_FOLDER}${LOG_FOLDER}";
|
||||
echo "[!] Log folder does not exist: ${GIT_WEBHOOK_BASE_FOLDER}${LOG_FOLDER}";
|
||||
error=1;
|
||||
fi;
|
||||
|
||||
# check that the base clone folder exists
|
||||
if [ ! -d "${GIT_WEBHOOK_BASE_FOLDER}${CLONE_BASE}" ]; then
|
||||
echo "Clone base folder does not exist: ${GIT_WEBHOOK_BASE_FOLDER}${CLONE_BASE}";
|
||||
echo "[!] Clone base folder does not exist: ${GIT_WEBHOOK_BASE_FOLDER}${CLONE_BASE}";
|
||||
error=1;
|
||||
fi;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user