convert to run on pizero without dropbox

This commit is contained in:
Deepankar Chakroborty 2024-03-10 08:09:38 -07:00
parent 75dd279630
commit b71cfd241b
3 changed files with 6 additions and 41 deletions

View file

@ -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!"

View file

@ -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

View file

@ -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