From def18270f1b30fb00b6ddd2bfd28a0f488de2f43 Mon Sep 17 00:00:00 2001 From: Jeremy Lecour Date: Tue, 19 Mar 2019 13:51:07 +0100 Subject: [PATCH] Add evocheck execution --- README.md | 2 ++ evomaintenance.sh | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/README.md b/README.md index 4fe0e74..e46d56b 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,8 @@ Options --no-db disable the database hook --commit enable the commit hook (default) --no-commit disable the commit hook + --evocheck enable evocheck execution (default) + --no-evocheck disable evocheck execution --auto use "auto" mode --no-auto use "manual" mode (default) -v, --verbose increase verbosity diff --git a/evomaintenance.sh b/evomaintenance.sh index 65fb133..7324737 100755 --- a/evomaintenance.sh +++ b/evomaintenance.sh @@ -40,6 +40,8 @@ Options --no-db disable the database hook --commit enable the commit hook (default) --no-commit disable the commit hook + --evocheck enable evocheck execution (default) + --no-evocheck disable evocheck execution --auto use "auto" mode --no-auto use "manual" mode (default) -v, --verbose increase verbosity @@ -130,6 +132,20 @@ get_repository_status() { unset GIT_DIR GIT_WORK_TREE } +get_evocheck() { + if [ -x "${EVOCHECK_BIN}" ]; then + printf "Evocheck status :" + EVOCHECK_OUT=$(${EVOCHECK_BIN}) + EVOCHECK_RC=$? + + if [ "${EVOCHECK_RC}" = "0" ] && [ -z "${EVOCHECK_OUT}" ]; then + printf " OK\n\n" + else + printf " ERROR\n%s\n\n" "${EVOCHECK_OUT}" + fi + fi +} + print_log() { printf "*********** %s ***************\n" "$(get_now)" print_session_data @@ -282,6 +298,7 @@ HOOK_MAIL=${HOOK_MAIL:-"1"} DRY_RUN=${DRY_RUN:-"0"} VERBOSE=${VERBOSE:-"0"} AUTO=${AUTO:-"0"} +EVOCHECK=${EVOCHECK:-"1"} GIT_STATUS_MAX_LINES=${GIT_STATUS_MAX_LINES:-20} # initialize variables @@ -412,6 +429,8 @@ if [ -z "${PSQL_BIN}" ]; then echo "No \`psql' command has been found, can't save to the database." 2>&1 fi +EVOCHECK_BIN="/usr/share/scripts/evocheck.sh" + GIT_REPOSITORIES="/etc /etc/bind" # initialize variable @@ -437,6 +456,9 @@ else fi readonly INTERACTIVE +if [ "${INTERACTIVE}" = "1" ] && [ "${EVOCHECK}" = "1" ]; then + get_evocheck +fi if [ -n "${GIT_STATUSES}" ] && [ "${INTERACTIVE}" = "1" ]; then printf "/!\ There are some uncommited changes.\n%s\n\n" "${GIT_STATUSES}" fi