From 595681409473850eadfb6cf2da38f7b79bbb4ab8 Mon Sep 17 00:00:00 2001 From: Mitchell Krog Date: Wed, 20 Sep 2017 12:56:22 +0200 Subject: [PATCH] PATCH: Revert to Previous Install, Setup and Update Scripts --- install-ngxblocker | 15 ----------- patch.diff | 64 ++++++++++++++++++++++++++++++++++++++++++++++ setup-ngxblocker | 5 ++-- update-ngxblocker | 4 +-- 4 files changed, 68 insertions(+), 20 deletions(-) create mode 100644 patch.diff diff --git a/install-ngxblocker b/install-ngxblocker index 2ca0f621c..4ebb34a12 100755 --- a/install-ngxblocker +++ b/install-ngxblocker @@ -141,16 +141,6 @@ download_files() { fi } -set_mode() { - local mode=$1 dir=$2 file= - local file_list="$(echo $@ | awk '{$1=$2=""; print}' | sed -e 's/^[ \t]*//')" - - for file in $file_list; do - printf "Setting mode: $mode => $dir/$file\n" - chmod $mode $dir/$file - done -} - check_config() { local x= dirs="$*" @@ -293,11 +283,6 @@ main() { download_files conf.d $CONF_DIR $CONF_FILES download_files bots.d $BOTS_DIR $BOT_FILES download_files / $SCRIPT_DIR $SCRIPT_FILES - - # ensures scripts are executable - if [ "$DRY_RUN" = "N" ]; then - set_mode 700 $SCRIPT_DIR $SCRIPT_FILES - fi } ## START ## diff --git a/patch.diff b/patch.diff new file mode 100644 index 000000000..058d56cb4 --- /dev/null +++ b/patch.diff @@ -0,0 +1,64 @@ +diff --git a/install-ngxblocker b/install-ngxblocker +index 2ca0f62..4ebb34a 100755 +--- a/install-ngxblocker ++++ b/install-ngxblocker +@@ -141,16 +141,6 @@ download_files() { + fi + } + +-set_mode() { +- local mode=$1 dir=$2 file= +- local file_list="$(echo $@ | awk '{$1=$2=""; print}' | sed -e 's/^[ \t]*//')" +- +- for file in $file_list; do +- printf "Setting mode: $mode => $dir/$file\n" +- chmod $mode $dir/$file +- done +-} +- + check_config() { + local x= dirs="$*" + +@@ -293,11 +283,6 @@ main() { + download_files conf.d $CONF_DIR $CONF_FILES + download_files bots.d $BOTS_DIR $BOT_FILES + download_files / $SCRIPT_DIR $SCRIPT_FILES +- +- # ensures scripts are executable +- if [ "$DRY_RUN" = "N" ]; then +- set_mode 700 $SCRIPT_DIR $SCRIPT_FILES +- fi + } + + ## START ## +diff --git a/setup-ngxblocker b/setup-ngxblocker +index 30f24d7..c84e552 100755 +--- a/setup-ngxblocker ++++ b/setup-ngxblocker +@@ -186,9 +186,8 @@ find_line() { + local file=$1 find_str=$2 first_last=$3 + + case "$first_last" in +- # ignore file #comments +- first) grep -nE "^[ ]+$find_str" $file | head -n1 | awk -F: '{print $1}' +- last) grep -nE "^[ ]+$find_str" $file | tail -n1 | awk -F: '{print $1}' ++ first) awk "/$find_str/{ print NR; exit }" $file;; ++ last) awk "/$find_str/{ print NR }" $file | tail -n1;; + esac + } + +diff --git a/update-ngxblocker b/update-ngxblocker +index b3869e5..186a513 100755 +--- a/update-ngxblocker ++++ b/update-ngxblocker +@@ -194,8 +194,8 @@ check_args() { + } + + check_mail_depends() { +- if [ ! -f /usr/bin/mail ] && [ ! -f /bin/mail ]; then # mailx + ssmtp are enough to send emails +- printf "${BOLDYELLOW}WARN${RESET}: missing mail command => ${BOLDWHITE}disabling emails${RESET}.\n\n" ++ if [ ! -f /usr/bin/mail ]; then # mailx + ssmtp are enough to send emails ++ printf "${BOLDYELLOW}WARN${RESET}: missing /usr/bin/mail => ${BOLDWHITE}disabling emails${RESET}.\n\n" + SEND_EMAIL="N" + fi + } diff --git a/setup-ngxblocker b/setup-ngxblocker index 30f24d79a..c84e5527f 100755 --- a/setup-ngxblocker +++ b/setup-ngxblocker @@ -186,9 +186,8 @@ find_line() { local file=$1 find_str=$2 first_last=$3 case "$first_last" in - # ignore file #comments - first) grep -nE "^[ ]+$find_str" $file | head -n1 | awk -F: '{print $1}' - last) grep -nE "^[ ]+$find_str" $file | tail -n1 | awk -F: '{print $1}' + first) awk "/$find_str/{ print NR; exit }" $file;; + last) awk "/$find_str/{ print NR }" $file | tail -n1;; esac } diff --git a/update-ngxblocker b/update-ngxblocker index b3869e5da..186a513d7 100755 --- a/update-ngxblocker +++ b/update-ngxblocker @@ -194,8 +194,8 @@ check_args() { } check_mail_depends() { - if [ ! -f /usr/bin/mail ] && [ ! -f /bin/mail ]; then # mailx + ssmtp are enough to send emails - printf "${BOLDYELLOW}WARN${RESET}: missing mail command => ${BOLDWHITE}disabling emails${RESET}.\n\n" + if [ ! -f /usr/bin/mail ]; then # mailx + ssmtp are enough to send emails + printf "${BOLDYELLOW}WARN${RESET}: missing /usr/bin/mail => ${BOLDWHITE}disabling emails${RESET}.\n\n" SEND_EMAIL="N" fi }