mirror of
https://github.com/mitchellkrogza/nginx-ultimate-bad-bot-blocker.git
synced 2025-09-04 11:40:22 +00:00
add find_binary()
* centos does not have which installed by default. adds functionality to emulate it. part of the fix for: https://github.com/mitchellkrogza/nginx-ultimate-bad-bot-blocker/issues/213
This commit is contained in:
parent
bcb746137b
commit
ebaaaf3a7a
1 changed files with 15 additions and 2 deletions
|
@ -284,9 +284,22 @@ check_args() {
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
check_depends() {
|
check_depends() {
|
||||||
# centos also does not have which by default
|
# 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"
|
printf "${BOLDRED}ERROR${RESET}: $0 requires: 'curl' => ${BOLDWHITE}cannot check remote version.${RESET}\n"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Add table
Reference in a new issue