From 0187170776e528add2583802784a9b226d7d348b Mon Sep 17 00:00:00 2001 From: Stuart Cardall Date: Mon, 26 Feb 2018 21:57:04 +0000 Subject: [PATCH] check vhosts before testing connectivity * check the repo is online after configuration checks --- setup-ngxblocker | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/setup-ngxblocker b/setup-ngxblocker index 8d37cf0b0..d9c19581a 100755 --- a/setup-ngxblocker +++ b/setup-ngxblocker @@ -344,9 +344,13 @@ main() { get_options $@ check_depends - include_url=$REPO/include_filelist.txt + # check vhosts + file_list=$(find_vhosts) + check_config $file_list # check repo is online & source includes + include_url=$REPO/include_filelist.txt + printf "Checking url: $include_url\n" if [ -n "$(check_online $include_url)" ]; then local tmp=$(mktemp) @@ -370,11 +374,6 @@ main() { n*|N*) VHOST_INCLUDES=$(echo $VHOST_INCLUDES | sed 's|ddos.conf||');; esac - # gather vhosts - file_list=$(find_vhosts) - check_config $file_list - col_size=$(( $(longest_str $CONF_FILES) + $(echo $CONF_DIR | wc -m) + 10 )) - # by default do not change any files if [ -z "$DRY_RUN" ]; then printf "\n** Dry Run ** | not updating files | run as '$(basename $0) -x' to setup files.\n\n" @@ -382,6 +381,9 @@ main() { printf "\n" fi + # calculate column size for better message printing + col_size=$(( $(longest_str $CONF_FILES) + $(echo $CONF_DIR | wc -m) + 10 )) + # update main config line=$(find_includes $MAIN_CONF include last http first '\}' last ) if [ -n "$(check_wildcard $MAIN_CONF $CONF_DIR)" ]; then # also recalculate column width