From 8b5af8b7fae95e92618ea9d8aff5479faac4ecd1 Mon Sep 17 00:00:00 2001 From: Stuart Cardall Date: Mon, 8 Oct 2018 18:55:02 +0000 Subject: [PATCH] remove hard coded paths * use find_binary() instead of hard coded paths --- update-ngxblocker | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/update-ngxblocker b/update-ngxblocker index a79edd98d..f8a9ad617 100755 --- a/update-ngxblocker +++ b/update-ngxblocker @@ -120,7 +120,7 @@ check_dirs() { } find_binary() { - local x= path= bin=$1 bin_paths='/usr/bin /usr/local/bin /usr/sbin /usr/local/sbin /root/bin /root/.bin' + local x= path= bin=$1 bin_paths='/bin /usr/bin /usr/local/bin /usr/sbin /usr/local/sbin /root/bin /root/.bin' for x in $bin_paths; do path="$x/$bin" @@ -221,7 +221,7 @@ check_args() { } check_mail_depends() { - if [ ! -f /usr/bin/mail ] && [ ! -f /bin/mail ]; then # mailx + ssmtp are enough to send emails + if [ -z $(find_binary mail) ]; then # mailx + ssmtp are enough to send emails printf "${BOLDYELLOW}WARN${RESET}: missing mail command => ${BOLDWHITE}disabling emails${RESET}.\n\n" return 1 fi @@ -229,7 +229,7 @@ check_mail_depends() { check_depends() { # centos does not have which by default - if [ ! -x /usr/bin/curl ]; then + if [ -z $(find_binary curl) ]; then printf "${BOLDRED}ERROR${RESET}: $0 requires: 'curl' => ${BOLDWHITE}cannot check remote version.${RESET}\n" exit 1 fi