From d3a5f408c788903a8d19f8fcdb37003b03b3b34c Mon Sep 17 00:00:00 2001 From: Stuart Cardall Date: Mon, 8 Oct 2018 18:34:02 +0000 Subject: [PATCH] add find_binary() * emulates `which` as centos does not have it by default --- update-ngxblocker | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/update-ngxblocker b/update-ngxblocker index 424b355d6..a79edd98d 100755 --- a/update-ngxblocker +++ b/update-ngxblocker @@ -119,6 +119,19 @@ check_dirs() { done } +find_binary() { + local x= path= bin=$1 bin_paths='/usr/bin /usr/local/bin /usr/sbin /usr/local/sbin /root/bin /root/.bin' + + for x in $bin_paths; do + path="$x/$bin" + + if [ -x $path ]; then + echo $path + return + fi + done +} + update_paths() { # variables in nginx include files not currently possible # updates hard coded bots.d path in globalblacklist.conf