mirror of
https://gitlab.com/robocopAlpha/pihole_lists.git
synced 2026-05-18 02:42:25 -07:00
convert to run on pizero without dropbox
This commit is contained in:
parent
75dd279630
commit
b71cfd241b
3 changed files with 6 additions and 41 deletions
|
|
@ -12,18 +12,6 @@ fi
|
||||||
|
|
||||||
[[ -f set_env.sh ]] && source set_env.sh || { echo "set_env.sh not found"; exit 1; }
|
[[ -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}/"
|
cd "${WRK_DIR}/"
|
||||||
echo $(date +%d.%m.%y-%H:%M:%S) >| lastpull
|
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..."
|
echo "Cleaning up..."
|
||||||
rm -rf Mirrors
|
rm -rf Mirrors
|
||||||
rm -f blocklists/MyBlocklist.txt.xz blocklists/facebook_block.txt.xz
|
rm -f blocklists/MyBlocklist.txt.xz blocklists/facebook_block.txt.xz
|
||||||
mkdir blocklists
|
|
||||||
mv MyBlocklist.txt blocklists/.
|
|
||||||
mv facebook_block.txt blocklists/.
|
|
||||||
|
|
||||||
#--------
|
#------
|
||||||
# Archiving
|
# Moving to destination
|
||||||
echo "Compressing blocklists..."
|
mv MyBlocklist.txt /home/dietpi/pihole/.
|
||||||
cd "${WRK_DIR}/blocklists/"
|
mv facebook_block.txt /home/dietpi/pihole/.
|
||||||
# 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 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!"
|
|
||||||
|
|
@ -43,7 +43,6 @@ elif [ "$(uname)" == "Linux" ]; then
|
||||||
# echo "$(md5sum ${1} | cut -c -32)"
|
# echo "$(md5sum ${1} | cut -c -32)"
|
||||||
# }
|
# }
|
||||||
HOME_DIR=/home/dietpi
|
HOME_DIR=/home/dietpi
|
||||||
RCloneConfig=/home/dietpi/.config/rclone/rclone.conf
|
|
||||||
else
|
else
|
||||||
echo "Only MacOS and Linux are supported."
|
echo "Only MacOS and Linux are supported."
|
||||||
exit 1
|
exit 1
|
||||||
|
|
|
||||||
|
|
@ -38,10 +38,8 @@ if [ ! -f "$LOGFILE" ] ; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "pihole being udpdated on: $(date)" | tee -a "$LOGFILE"
|
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
|
# Blocklists exist from pull_lists
|
||||||
xz -fd MyBlocklist.txt.xz
|
|
||||||
xz -fd facebook_block.txt.xz
|
|
||||||
|
|
||||||
curl -OJL 'https://gitlab.com/robocopAlpha/pihole_lists/-/raw/main/whitelist.txt'
|
curl -OJL 'https://gitlab.com/robocopAlpha/pihole_lists/-/raw/main/whitelist.txt'
|
||||||
grep "^[^#]" whitelist.txt | sort -u | uniq | tr '\r\n' ' ' >| whitelist
|
grep "^[^#]" whitelist.txt | sort -u | uniq | tr '\r\n' ' ' >| whitelist
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue