From 0618eb090956c64e974ad8b350077daf8844814d Mon Sep 17 00:00:00 2001 From: Stuart Cardall Date: Sat, 26 Aug 2017 19:26:47 +0000 Subject: [PATCH] setup-ngxblocker: add check_depends() --- setup-ngxblocker | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/setup-ngxblocker b/setup-ngxblocker index 9aa63fff2..c84e5527f 100755 --- a/setup-ngxblocker +++ b/setup-ngxblocker @@ -251,6 +251,26 @@ check_args() { esac } +check_depends() { + # centos does not have wget installed by default + if ! wget --help >/dev/null 2>&1; then + printf "${BOLDRED}ERROR${RESET}: $0 requires: 'wget' => ${BOLDWHITE}cannot download files.${RESET}\n" + exit 1 + fi + + # centos also does not have which by default + if [ ! -x /usr/bin/curl ]; then + printf "${BOLDRED}ERROR${RESET}: $0 requires: 'curl' => ${BOLDWHITE}cannot check remote version.${RESET}\n" + exit 1 + fi + + # install-ngxblocker downloads missing scripts / includes as part of the update process + if [ ! -x $INSTALLER ]; then + printf "${BOLDRED}ERROR${RESET}: $0 requires: '$INSTALLER' => ${BOLDWHITE}cannot update includes.${RESET}\n" + exit 1 + fi +} + get_options() { local arg= opts= @@ -315,6 +335,8 @@ main() { exit 1 fi + check_depends + # parse command line get_options $@ include_url=$REPO/include_filelist.txt