From af197cb559bfc86b8eba332bcf20d17aa2dc70f8 Mon Sep 17 00:00:00 2001 From: Stuart Cardall Date: Wed, 20 Sep 2017 13:36:15 +0000 Subject: [PATCH] update-ngxblocker: detect /bin/mail in centos / add -m cmd line switch for mail * also detect /bin/mail in centos * adds -m command line switch to specify an email address (to avoid confusion with -e used in setup-ngxblocker to specify vhost file extensions) -e can still be used to specify an email address to avoid breakage with current cron jobs --- update-ngxblocker | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/update-ngxblocker b/update-ngxblocker index 186a513d7..0f15af31d 100755 --- a/update-ngxblocker +++ b/update-ngxblocker @@ -53,7 +53,7 @@ Usage: $script [OPTIONS] [ -b ] : NGINX bots directory (default: $BOTS_DIR) [ -i ] : Change installer path (default: $INSTALLER) [ -r ] : Change repo url (default: $REPO) - [ -e ] : Change email address (default: $EMAIL) + [ -m ] : Change email address (default: $EMAIL) [ -n ] : Do not send email report (default: $SEND_EMAIL) [ -v ] : Print blacklist version [ -h ] : this help message @@ -194,8 +194,8 @@ check_args() { } check_mail_depends() { - if [ ! -f /usr/bin/mail ]; then # mailx + ssmtp are enough to send emails - printf "${BOLDYELLOW}WARN${RESET}: missing /usr/bin/mail => ${BOLDWHITE}disabling emails${RESET}.\n\n" + if [ ! -f /usr/bin/mail ] && [ ! -f /bin/mail ]; then # mailx + ssmtp are enough to send emails + printf "${BOLDYELLOW}WARN${RESET}: missing mail command => ${BOLDWHITE}disabling emails${RESET}.\n\n" SEND_EMAIL="N" fi } @@ -223,7 +223,7 @@ check_depends() { get_options() { local arg= opts= - while getopts :c:b:u:r:e:nvh opts "$@" + while getopts :c:b:u:r:e:m:nvh opts "$@" do if [ -n "${OPTARG}" ]; then case "$opts" in @@ -239,6 +239,7 @@ get_options() { i) INSTALLER=$arg; check_args $opts script $arg ;; r) REPO=$arg; check_args $opts url $arg ;; e) EMAIL=$arg; check_args $opts email $arg ;; + m) EMAIL=$arg; check_args $opts email $arg ;; n) SEND_EMAIL=N ;; v) check_depends; check_version ;; h) usage ;;