simplified updates

as the idea is to generate blocklists daily, the update package will be downloaded daily without checksum. Easier this way.
Can implement checksum of the update package if needed.
This commit is contained in:
robocopAlpha 2021-07-16 03:40:56 +03:00
parent fb0c673e48
commit 4e52559f79
4 changed files with 25 additions and 40 deletions

View file

@ -1,14 +1,13 @@
# dump.whitelist # dump.whitelist
https://gitlab.com/robocopAlpha/pihole_lists/-/raw/main/whitelist.txt https://gitlab.com/robocopAlpha/pihole_lists/-/raw/main/whitelist.txt
# Facebook checksum # blocklist pack
https://www.dropbox.com/s/dl/bxwqegi7umy4io1/facebook_block.checksum https://www.dropbox.com/sh/oyjii6ndqduixt8/AADn57717lc0TE4AW5dxB0p4a?dl=1
# Facebook Blocklist
https://www.dropbox.com/s/dl/xrsg5gswmzfsdd9/facebook_block.txt.xz
# Blocklist checksum
https://www.dropbox.com/s/dl/78gc475jdil8cx7/MyBlocklist.checksum
# Blocklist sudo -s
https://www.dropbox.com/s/dl/yh3y87ue0x3a8ac/MyBlocklist.txt.xz curl -L "https://gitlab.com/robocopAlpha/pihole_lists/-/raw/master/update.pi.sh" >| /usr/local/bin/updatepi
chmod +x /usr/local/bin/updatepi
echo '5 3 * * * root PATH="$PATH:/usr/sbin:/usr/local/bin/" updatepi' >| /etc/cron.d/updatepi
exit

View file

@ -51,8 +51,8 @@ mv facebook_block.txt blocklists/.
# Archiving # Archiving
echo "Compressing blocklists..." echo "Compressing blocklists..."
cd "${WRK_DIR}/blocklists/" cd "${WRK_DIR}/blocklists/"
getMD5 "MyBlocklist.txt" >| MyBlocklist.checksum # getMD5 "MyBlocklist.txt" >| MyBlocklist.checksum
getMD5 "facebook_block.txt" >| facebook_block.checksum # getMD5 "facebook_block.txt" >| facebook_block.checksum
sleep 1 sleep 1
xz -v -T4 MyBlocklist.txt xz -v -T4 MyBlocklist.txt
xz -v -T4 facebook_block.txt xz -v -T4 facebook_block.txt

View file

@ -28,19 +28,19 @@ fi
#--- Set parameters based on Distribution #--- Set parameters based on Distribution
if [ "$(uname)" == "Darwin" ]; then if [ "$(uname)" == "Darwin" ]; then
# echo "Setting params for Darwin..." # echo "Setting params for Darwin..."
getMD5(){ # getMD5(){
# usage: getMD5 'filename' > outfile # # usage: getMD5 'filename' > outfile
echo "$(md5 -q ${1})" # echo "$(md5 -q ${1})"
} # }
HOME_DIR=/Users/deepankar/OneDrive\ -\ O365\ Turun\ yliopisto/Git/Gitlab.DC HOME_DIR=/Users/deepankar/OneDrive\ -\ O365\ Turun\ yliopisto/Git/Gitlab.DC
elif [ "$(uname)" == "Linux" ]; then elif [ "$(uname)" == "Linux" ]; then
# echo "Setting params for Linux..." # echo "Setting params for Linux..."
getMD5() # getMD5()
{ # {
# usage: getMD5 'filename' > outfile # # usage: getMD5 'filename' > outfile
echo "$(md5sum ${1} | cut -c -32)" # echo "$(md5sum ${1} | cut -c -32)"
} # }
HOME_DIR=/home/dietpi HOME_DIR=/home/dietpi
else else
echo "Only MacOS and Linux are supported." echo "Only MacOS and Linux are supported."

View file

@ -38,25 +38,10 @@ 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 ./blocklist.zip
chksum_web=$(curl -sL 'https://www.dropbox.com/s/dl/78gc475jdil8cx7/MyBlocklist.checksum') rm ./blocklist.zip
chksum_local=$(md5sum MyBlocklist.txt | cut -c -32) xz -fd MyBlocklist.txt.xz
if [ -f MyBlocklist.txt ] && [ "$chksum_web" == "$chksum_local" ]; then xz -fd facebook_block.txt.xz
echo "${GREEN}MyBlocklist Unchanged. Skipping download.${NC}" 2>&1 | tee -a "$LOGFILE"
else
echo "${CYAN}Getting Myblocklist${NC}" 2>&1 | tee -a "$LOGFILE"
curl -OJL 'https://www.dropbox.com/s/dl/yh3y87ue0x3a8ac/MyBlocklist.txt.xz'
xz -fd MyBlocklist.txt.xz
fi
chksum_web=$(curl -sL 'https://www.dropbox.com/s/dl/bxwqegi7umy4io1/facebook_block.checksum')
chksum_local=$(md5sum facebook_block.txt | cut -c -32)
if [ "$chksum_web" == "$chksum_local" ] && [ -f facebook_block.txt ]; then
echo "${GREEN}Facebook blocklist Unchanged. Skipping download.${NC}" 2>&1 | tee -a "$LOGFILE"
else
echo "${CYAN}Getting Facebook blocklist${NC}" 2>&1 | tee -a "$LOGFILE"
curl -OJL 'https://www.dropbox.com/s/dl/xrsg5gswmzfsdd9/facebook_block.txt.xz'
xz -fd facebook_block.txt.xz
fi
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
@ -64,6 +49,7 @@ rm -f whitelist.txt
$(command -v pihole) -w --nuke > /dev/null 2>&1 | tee -a "$LOGFILE" $(command -v pihole) -w --nuke > /dev/null 2>&1 | tee -a "$LOGFILE"
$(command -v pihole) -w -q -nr $(cat whitelist) 2>&1 | tee -a "$LOGFILE" $(command -v pihole) -w -q -nr $(cat whitelist) 2>&1 | tee -a "$LOGFILE"
rm whitelist rm whitelist
$(command -v pihole) updateGravity 2>&1 | tee -a "$LOGFILE" $(command -v pihole) updateGravity 2>&1 | tee -a "$LOGFILE"
# Add these to pihole adlist # Add these to pihole adlist