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