Rename variables for hooks

This commit is contained in:
Jérémy Lecour 2019-03-10 19:05:30 +01:00
parent 9f99b12cd4
commit b1e2a6ac0f

View file

@ -144,9 +144,9 @@ print_options() {
cat <<END cat <<END
********** Options **************** ********** Options ****************
MESSAGE: ${MESSAGE} MESSAGE: ${MESSAGE}
OPT_COMMIT: ${OPT_COMMIT} HOOK_COMMIT: ${HOOK_COMMIT}
OPT_DB: ${OPT_DB} HOOK_DB: ${HOOK_DB}
OPT_MAIL: ${OPT_MAIL} HOOK_MAIL: ${HOOK_MAIL}
DRY_RUN: ${DRY_RUN} DRY_RUN: ${DRY_RUN}
*********************************** ***********************************
@ -240,9 +240,9 @@ test -f /etc/evomaintenance.cf && . /etc/evomaintenance.cf
[ -n "${EVOMAINTMAIL}" ] || EVOMAINTMAIL=evomaintenance-$(echo "${HOSTNAME}" | cut -d- -f1)@${REALM} [ -n "${EVOMAINTMAIL}" ] || EVOMAINTMAIL=evomaintenance-$(echo "${HOSTNAME}" | cut -d- -f1)@${REALM}
[ -n "${LOGFILE}" ] || LOGFILE=/var/log/evomaintenance.log [ -n "${LOGFILE}" ] || LOGFILE=/var/log/evomaintenance.log
[ -n "${OPT_COMMIT}" ] || OPT_COMMIT=1 [ -n "${HOOK_COMMIT}" ] || HOOK_COMMIT=1
[ -n "${OPT_DB}" ] || OPT_DB=1 [ -n "${HOOK_DB}" ] || HOOK_DB=1
[ -n "${OPT_MAIL}" ] || OPT_MAIL=1 [ -n "${HOOK_MAIL}" ] || HOOK_MAIL=1
[ -n "${DRY_RUN}" ] || DRY_RUN=0 [ -n "${DRY_RUN}" ] || DRY_RUN=0
[ -n "${VERBOSE}" ] || VERBOSE=0 [ -n "${VERBOSE}" ] || VERBOSE=0
@ -283,27 +283,27 @@ while :; do
;; ;;
--no-commit) --no-commit)
# disable commit hook # disable commit hook
OPT_COMMIT=0 HOOK_COMMIT=0
;; ;;
--commit) --commit)
# enable commit hook # enable commit hook
OPT_COMMIT=1 HOOK_COMMIT=1
;; ;;
--no-db) --no-db)
# disable DB hook # disable DB hook
OPT_DB=0 HOOK_DB=0
;; ;;
--db) --db)
# enable DB hook # enable DB hook
OPT_DB=1 HOOK_DB=1
;; ;;
--no-mail) --no-mail)
# disable mail hook # disable mail hook
OPT_MAIL=0 HOOK_MAIL=0
;; ;;
--mail) --mail)
# enable mail hook # enable mail hook
OPT_MAIL=1 HOOK_MAIL=1
;; ;;
-n|--dry-run) -n|--dry-run)
# disable actual commands # disable actual commands
@ -396,7 +396,7 @@ fi
# Commit hook # Commit hook
if [ "${INTERACTIVE}" = "1" ]; then if [ "${INTERACTIVE}" = "1" ]; then
if test -n "${GIT_STATUSES}" && [ "${OPT_COMMIT}" = "1" ]; then if test -n "${GIT_STATUSES}" && [ "${HOOK_COMMIT}" = "1" ]; then
echo "/!\ There are some uncommited changes." echo "/!\ There are some uncommited changes."
echo "${GIT_STATUSES}" echo "${GIT_STATUSES}"
echo "" echo ""
@ -415,7 +415,7 @@ if [ "${INTERACTIVE}" = "1" ]; then
break break
;; ;;
"" ) "" )
if [ "${OPT_COMMIT}" = "1" ]; then if [ "${HOOK_COMMIT}" = "1" ]; then
hook_commit hook_commit
fi fi
break break
@ -427,14 +427,14 @@ if [ "${INTERACTIVE}" = "1" ]; then
done done
fi fi
else else
if [ "${OPT_COMMIT}" = "1" ]; then if [ "${HOOK_COMMIT}" = "1" ]; then
hook_commit hook_commit
fi fi
fi fi
# Database hook # Database hook
if [ "${INTERACTIVE}" = "1" ]; then if [ "${INTERACTIVE}" = "1" ]; then
if [ "${OPT_DB}" = "1" ]; then if [ "${HOOK_DB}" = "1" ]; then
y="Y"; n="n" y="Y"; n="n"
else else
y="y"; n="N" y="y"; n="N"
@ -452,7 +452,7 @@ if [ "${INTERACTIVE}" = "1" ]; then
break break
;; ;;
"" ) "" )
if [ "${OPT_DB}" = "1" ]; then if [ "${HOOK_DB}" = "1" ]; then
hook_db hook_db
fi fi
break break
@ -463,14 +463,14 @@ if [ "${INTERACTIVE}" = "1" ]; then
esac esac
done done
else else
if [ "${OPT_DB}" = "1" ]; then if [ "${HOOK_DB}" = "1" ]; then
hook_db hook_db
fi fi
fi fi
# Mail hook # Mail hook
if [ "${INTERACTIVE}" = "1" ]; then if [ "${INTERACTIVE}" = "1" ]; then
if [ "${OPT_MAIL}" = "1" ]; then if [ "${HOOK_MAIL}" = "1" ]; then
y="Y"; n="n" y="Y"; n="n"
else else
y="y"; n="N" y="y"; n="N"
@ -495,7 +495,7 @@ if [ "${INTERACTIVE}" = "1" ]; then
fi fi
;; ;;
"" ) "" )
if [ "${OPT_MAIL}" = "1" ]; then if [ "${HOOK_MAIL}" = "1" ]; then
hook_mail hook_mail
fi fi
break break
@ -506,7 +506,7 @@ if [ "${INTERACTIVE}" = "1" ]; then
esac esac
done done
else else
if [ "${OPT_MAIL}" = "1" ]; then if [ "${HOOK_MAIL}" = "1" ]; then
hook_mail hook_mail
fi fi
fi fi