explicite dependencies + safeguard missing commands
This commit is contained in:
parent
13885a4743
commit
22635267fe
3
debian/control
vendored
3
debian/control
vendored
|
@ -7,8 +7,7 @@ Standards-Version: 3.8.0
|
|||
|
||||
Package: evomaintenance
|
||||
Architecture: all
|
||||
Depends: postgresql-client, sudo
|
||||
Depends: coreutils, sudo, sed, hostname, postfix, git, postgresql-client
|
||||
Description: script for Evolix maintenance
|
||||
This package contains the script evomaintenance.sh
|
||||
which sends a mail for each intervention on a Pack Evolix server.
|
||||
|
||||
|
|
|
@ -199,8 +199,8 @@ hook_db() {
|
|||
if [ "${VERBOSE}" = "1" ]; then
|
||||
printf "\n********** DB query **************\n%s\n***********************************\n" "${PG_QUERY}"
|
||||
fi
|
||||
if [ "${DRY_RUN}" != "1" ]; then
|
||||
echo "${PG_QUERY}" | psql "${PGDB}" "${PGTABLE}" -h "${PGHOST}"
|
||||
if [ "${DRY_RUN}" != "1" ] && [ -x "${PSQL_BIN}" ]; then
|
||||
echo "${PG_QUERY}" | ${PSQL_BIN} "${PGDB}" "${PGTABLE}" -h "${PGHOST}"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -256,7 +256,7 @@ hook_mail() {
|
|||
if [ "${VERBOSE}" = "1" ]; then
|
||||
printf "\n********** Mail *******************\n%s\n***********************************\n" "${MAIL_CONTENT}"
|
||||
fi
|
||||
if [ "${DRY_RUN}" != "1" ]; then
|
||||
if [ "${DRY_RUN}" != "1" ] && [ -x "${SENDMAIL_BIN}" ]; then
|
||||
echo "${MAIL_CONTENT}" | ${SENDMAIL_BIN} -oi -t -f "${FROM}"
|
||||
fi
|
||||
}
|
||||
|
@ -396,9 +396,21 @@ PATH=${PATH}:/usr/sbin
|
|||
|
||||
SENDMAIL_BIN=$(command -v sendmail)
|
||||
readonly SENDMAIL_BIN
|
||||
if [ -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
|
||||
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
|
||||
echo "No \`psql' command has been found, can't save to the database." 2>&1
|
||||
fi
|
||||
|
||||
GIT_REPOSITORIES="/etc /etc/bind"
|
||||
|
||||
|
|
Loading…
Reference in a new issue