Add options to enable/disable hooks (sending mail, commit /etc/.git, save to database…) #7
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue