verify command presence only if needed

This commit is contained in:
Jérémy Lecour 2019-08-21 15:37:10 +02:00 committed by Jérémy Lecour
parent 0503838b5b
commit a3fb426ecf
1 changed files with 5 additions and 5 deletions

View File

@ -454,29 +454,29 @@ PATH=${PATH}:/usr/sbin
SENDMAIL_BIN=$(command -v sendmail)
readonly SENDMAIL_BIN
if [ -z "${SENDMAIL_BIN}" ]; then
if [ "${HOOK_MAIL}" = "1" ] && [ -z "${SENDMAIL_BIN}" ]; then
echo "No \`sendmail' command has been found, can't send mail." 2>&1
fi
GIT_BIN=$(command -v git)
readonly GIT_BIN
if [ -z "${GIT_BIN}" ]; then
if [ "${HOOK_COMMIT}" = "1" ] && [ -z "${GIT_BIN}" ]; then
echo "No \`git' command has been found, can't commit changes" 2>&1
fi
PSQL_BIN=$(command -v psql)
readonly PSQL_BIN
if [ -z "${PSQL_BIN}" ]; then
if [ "${HOOK_DB}" = "1" ] && [ -z "${PSQL_BIN}" ]; then
echo "No \`psql' command has been found, can't save to the database." 2>&1
fi
CURL_BIN=$(command -v curl)
readonly CURL_BIN
if [ -z "${CURL_BIN}" ]; then
if [ "${HOOK_API}" = "1" ] && [ -z "${CURL_BIN}" ]; then
echo "No \`curl' command has been found, can't call the API." 2>&1
fi
if [ -z "${API_ENDPOINT}" ]; then
if [ "${HOOK_API}" = "1" ] && [ -z "${API_ENDPOINT}" ]; then
echo "No API endpoint specified, can't call the API." 2>&1
fi