From 808b31d0d199473fadc2f67c7fc57d9ed3c10ca6 Mon Sep 17 00:00:00 2001 From: robocopAlpha Date: Fri, 16 Jul 2021 04:40:34 +0300 Subject: [PATCH] minor changes - logs the number of items in individual blocklists (easier to troubleshoot) - seting logfile in set_env - unzip overwrites files while updating. --- get_blocklists.sh | 2 +- pull.lists.sh | 5 ----- set_env.sh | 9 +++++++-- update.pi.sh | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/get_blocklists.sh b/get_blocklists.sh index cd4e1d8..aace81d 100755 --- a/get_blocklists.sh +++ b/get_blocklists.sh @@ -65,7 +65,7 @@ if ping -c 1 -W 2 www.google.fi &> /dev/null ; then rm -f tmp2.txt #-------- echo " #Lines FileName" - wc -l *.txt + wc -l *.txt | tee -a "$LOGFILE" #-------- else echo "\n[!]Can't connect to the internet. Check your connectivity and try again.\n" diff --git a/pull.lists.sh b/pull.lists.sh index b9d515f..bd57590 100755 --- a/pull.lists.sh +++ b/pull.lists.sh @@ -1,11 +1,6 @@ #!/usr/bin/env bash [[ -f set_env.sh ]] && source set_env.sh || { echo "set_env.sh not found"; exit 1; } -LOGFILE="${WRK_DIR}/pull.log" -if [ ! -f "$LOGFILE" ] ; then - touch "$LOGFILE" -fi - # Mounting storage if df | grep -c dropbox > /dev/null; then umount "${HOME_DIR}/dropbox" || sudo umount "${HOME_DIR}/dropbox" diff --git a/set_env.sh b/set_env.sh index db848d6..0843c93 100644 --- a/set_env.sh +++ b/set_env.sh @@ -5,13 +5,13 @@ fetch_hosts(){ URL=$1 FNAME=$2 - curl -sSL "${URL}" | rg -INv "^[#]|localhost" | sd '\s+$' '' | sd "^0\\.0\\.0\\.0 |^127\\.0\\.0\\.1 " "" | sd "\\#.*" "" >| ${FNAME} + curl -sSL "${URL}" | rg -INv "^[#<]|localhost" | sd '\s+$' '' | sd "^0\\.0\\.0\\.0 |^127\\.0\\.0\\.1 " "" | sd "\\#.*" "" >| ${FNAME} } fetch_blocklist(){ URL=$1 FNAME=$2 - curl -sSL "${URL}" | rg -INv "^[#]|localhost" | sd '\s+$' '' | sd "\\#.*" "" >| ${FNAME} + curl -sSL "${URL}" | rg -INv "^[#<]|localhost" | sd '\s+$' '' | sd "\\#.*" "" >| ${FNAME} } @@ -48,3 +48,8 @@ else fi WRK_DIR=${HOME_DIR}/pihole_lists + +LOGFILE="${WRK_DIR}/pull.log" +if [ ! -f "$LOGFILE" ] ; then + touch "$LOGFILE" +fi \ No newline at end of file diff --git a/update.pi.sh b/update.pi.sh index 81b09f0..c9c1b15 100755 --- a/update.pi.sh +++ b/update.pi.sh @@ -38,7 +38,7 @@ if [ ! -f "$LOGFILE" ] ; then fi echo "pihole being udpdated on: $(date)" | tee -a "$LOGFILE" -curl -L 'https://www.dropbox.com/sh/oyjii6ndqduixt8/AADn57717lc0TE4AW5dxB0p4a?dl=1' --output ./blocklist.zip && unzip ./blocklist.zip +curl -L 'https://www.dropbox.com/sh/oyjii6ndqduixt8/AADn57717lc0TE4AW5dxB0p4a?dl=1' --output ./blocklist.zip && unzip -o ./blocklist.zip rm ./blocklist.zip xz -fd MyBlocklist.txt.xz xz -fd facebook_block.txt.xz