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
********** Options ****************
MESSAGE: ${MESSAGE}
OPT_COMMIT: ${OPT_COMMIT}
OPT_DB: ${OPT_DB}
OPT_MAIL: ${OPT_MAIL}
HOOK_COMMIT: ${HOOK_COMMIT}
HOOK_DB: ${HOOK_DB}
HOOK_MAIL: ${HOOK_MAIL}
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 "${LOGFILE}" ] || LOGFILE=/var/log/evomaintenance.log
[ -n "${OPT_COMMIT}" ] || OPT_COMMIT=1
[ -n "${OPT_DB}" ] || OPT_DB=1
[ -n "${OPT_MAIL}" ] || OPT_MAIL=1
[ -n "${HOOK_COMMIT}" ] || HOOK_COMMIT=1
[ -n "${HOOK_DB}" ] || HOOK_DB=1
[ -n "${HOOK_MAIL}" ] || HOOK_MAIL=1
[ -n "${DRY_RUN}" ] || DRY_RUN=0
[ -n "${VERBOSE}" ] || VERBOSE=0
@ -283,27 +283,27 @@ while :; do
;;
--no-commit)
# disable commit hook
OPT_COMMIT=0
HOOK_COMMIT=0
;;
--commit)
# enable commit hook
OPT_COMMIT=1
HOOK_COMMIT=1
;;
--no-db)
# disable DB hook
OPT_DB=0
HOOK_DB=0
;;
--db)
# enable DB hook
OPT_DB=1
HOOK_DB=1
;;
--no-mail)
# disable mail hook
OPT_MAIL=0
HOOK_MAIL=0
;;
--mail)
# enable mail hook
OPT_MAIL=1
HOOK_MAIL=1
;;
-n|--dry-run)
# disable actual commands
@ -396,7 +396,7 @@ fi
# Commit hook
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 "${GIT_STATUSES}"
echo ""
@ -415,7 +415,7 @@ if [ "${INTERACTIVE}" = "1" ]; then
break
;;
"" )
if [ "${OPT_COMMIT}" = "1" ]; then
if [ "${HOOK_COMMIT}" = "1" ]; then
hook_commit
fi
break
@ -427,14 +427,14 @@ if [ "${INTERACTIVE}" = "1" ]; then
done
fi
else
if [ "${OPT_COMMIT}" = "1" ]; then
if [ "${HOOK_COMMIT}" = "1" ]; then
hook_commit
fi
fi
# Database hook
if [ "${INTERACTIVE}" = "1" ]; then
if [ "${OPT_DB}" = "1" ]; then
if [ "${HOOK_DB}" = "1" ]; then
y="Y"; n="n"
else
y="y"; n="N"
@ -452,7 +452,7 @@ if [ "${INTERACTIVE}" = "1" ]; then
break
;;
"" )
if [ "${OPT_DB}" = "1" ]; then
if [ "${HOOK_DB}" = "1" ]; then
hook_db
fi
break
@ -463,14 +463,14 @@ if [ "${INTERACTIVE}" = "1" ]; then
esac
done
else
if [ "${OPT_DB}" = "1" ]; then
if [ "${HOOK_DB}" = "1" ]; then
hook_db
fi
fi
# Mail hook
if [ "${INTERACTIVE}" = "1" ]; then
if [ "${OPT_MAIL}" = "1" ]; then
if [ "${HOOK_MAIL}" = "1" ]; then
y="Y"; n="n"
else
y="y"; n="N"
@ -495,7 +495,7 @@ if [ "${INTERACTIVE}" = "1" ]; then
fi
;;
"" )
if [ "${OPT_MAIL}" = "1" ]; then
if [ "${HOOK_MAIL}" = "1" ]; then
hook_mail
fi
break
@ -506,7 +506,7 @@ if [ "${INTERACTIVE}" = "1" ]; then
esac
done
else
if [ "${OPT_MAIL}" = "1" ]; then
if [ "${HOOK_MAIL}" = "1" ]; then
hook_mail
fi
fi