add pidof to required depends

Centos may not have sysvinit-tools installed by default. Adds a check
for pidof being available.

Fixes:

https://github.com/mitchellkrogza/nginx-ultimate-bad-bot-blocker/issues/321#issuecomment-578514104
This commit is contained in:
Stuart Cardall 2020-01-28 10:23:19 +00:00
parent 1811d264d7
commit 6b0ee8b283
No known key found for this signature in database
GPG key ID: AEB857F1C891D0C6

View file

@ -258,13 +258,20 @@ find_binary() {
check_depends() {
# some distros do not have these tools installed by default
if [ -z $(find_binary wget) ]; then
printf "$0 requires: 'wget' \n"
local x= depends_list="wget curl"
for x in $depends_list; do
if [ -z $(find_binary $x) ]; then
printf "$0 requires: '$x' \n"
exit 1
fi
done
if [ -z $(find_binary curl) ]; then
printf "$0 requires 'curl' \n"
# give a helpful message for missing pidof
if [ -z $(find_binary pidof) ]; then
printf "$0 requires 'pidof' \n\n"
printf "In Debian: apt install sysvinit-utils\n"
printf "In Centos: yum install sysvinit-tools\n"
exit 1
fi
}