From b71cfd241b922b81bca1e2afe8e46fb582ada961 Mon Sep 17 00:00:00 2001 From: Deepankar Chakroborty <35454738+dchakro@users.noreply.github.com> Date: Sun, 10 Mar 2024 08:09:38 -0700 Subject: [PATCH] convert to run on pizero without dropbox --- pull.lists.sh | 40 ++++------------------------------------ set_env.sh | 1 - update.pi.sh | 6 ++---- 3 files changed, 6 insertions(+), 41 deletions(-) diff --git a/pull.lists.sh b/pull.lists.sh index ccd81c5..eb8046d 100755 --- a/pull.lists.sh +++ b/pull.lists.sh @@ -12,18 +12,6 @@ fi [[ -f set_env.sh ]] && source set_env.sh || { echo "set_env.sh not found"; exit 1; } -# Mounting storage -if df | grep -c dropbox > /dev/null; then - umount "${HOME_DIR}/dropbox" || sudo umount "${HOME_DIR}/dropbox" -fi - -if [[ -d "${HOME_DIR}/dropbox" ]]; then - rm -rf "${HOME_DIR}/dropbox" - mkdir "${HOME_DIR}/dropbox" -else - mkdir "${HOME_DIR}/dropbox" -fi -rclone mount --daemon dropbox:blocklist "${HOME_DIR}/dropbox" --volname=dropbox --config="${RCloneConfig}" || { echo "Failed to mount dropbox. Execution terminated!"; exit 1; } cd "${WRK_DIR}/" echo $(date +%d.%m.%y-%H:%M:%S) >| lastpull @@ -56,30 +44,10 @@ echo -e " $(wc -l facebook_block.txt) unique domains. \n" | tee -a "$LOGFILE" echo "Cleaning up..." rm -rf Mirrors rm -f blocklists/MyBlocklist.txt.xz blocklists/facebook_block.txt.xz -mkdir blocklists -mv MyBlocklist.txt blocklists/. -mv facebook_block.txt blocklists/. -#-------- -# Archiving -echo "Compressing blocklists..." -cd "${WRK_DIR}/blocklists/" -# getMD5 "MyBlocklist.txt" >| MyBlocklist.checksum -# getMD5 "facebook_block.txt" >| facebook_block.checksum -sleep 1 -xz -v -T4 MyBlocklist.txt -xz -v -T4 facebook_block.txt -chmod 777 ./* +#------ +# Moving to destination +mv MyBlocklist.txt /home/dietpi/pihole/. +mv facebook_block.txt /home/dietpi/pihole/. -#--------- -# Moving to target -echo "Moving blocklists to destination..." -cd "${WRK_DIR}/" -rsync -a --progress blocklists/* "${HOME_DIR}/dropbox/" | tee -a "$LOGFILE" -echo "Final clean up..." -umount "${HOME_DIR}/dropbox" || sudo umount "${HOME_DIR}/dropbox" -rm -rf "${HOME_DIR}/dropbox" -rm -rf "blocklists" - -echo "Done!" \ No newline at end of file diff --git a/set_env.sh b/set_env.sh index f3cfe58..e0d5876 100644 --- a/set_env.sh +++ b/set_env.sh @@ -43,7 +43,6 @@ elif [ "$(uname)" == "Linux" ]; then # echo "$(md5sum ${1} | cut -c -32)" # } HOME_DIR=/home/dietpi - RCloneConfig=/home/dietpi/.config/rclone/rclone.conf else echo "Only MacOS and Linux are supported." exit 1 diff --git a/update.pi.sh b/update.pi.sh index aeaa539..544ba27 100755 --- a/update.pi.sh +++ b/update.pi.sh @@ -38,10 +38,8 @@ 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 -o ./blocklist.zip -x / -rm ./blocklist.zip -xz -fd MyBlocklist.txt.xz -xz -fd facebook_block.txt.xz + +# Blocklists exist from pull_lists curl -OJL 'https://gitlab.com/robocopAlpha/pihole_lists/-/raw/main/whitelist.txt' grep "^[^#]" whitelist.txt | sort -u | uniq | tr '\r\n' ' ' >| whitelist