2023-07-21 21:37:00 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2023-08-08 17:33:14 +00:00
|
|
|
echo '' > pre-adblock.txt
|
2023-07-27 15:56:51 +00:00
|
|
|
touch errors.log
|
|
|
|
|
|
|
|
date=$(date '+%a, %d %b %Y %H:%M:%S %z')
|
2023-07-26 13:55:30 +00:00
|
|
|
|
|
|
|
#Adblock lists download
|
2023-08-09 17:24:37 +00:00
|
|
|
while read -r p; do
|
2023-07-26 13:55:30 +00:00
|
|
|
echo "#!MARKER- Begin of $p" >> pre-adblock.txt
|
2023-07-27 15:56:51 +00:00
|
|
|
|
2023-08-09 17:24:37 +00:00
|
|
|
wget -qO - "$p" >> pre-adblock.txt || echo "$date - Download failed: $p" >> errors.log
|
2023-07-26 13:55:30 +00:00
|
|
|
sleep 2
|
2023-07-21 21:37:00 +00:00
|
|
|
done <adblocklists.txt
|
|
|
|
|
2023-07-26 13:55:30 +00:00
|
|
|
# Breaking before will cause trouble if a URL is not reachable
|
|
|
|
set -e -u
|
|
|
|
|
2023-08-08 17:33:14 +00:00
|
|
|
#Remove comments in lists and change marker to comment
|
|
|
|
sed -i -e 's/^!.*$//g' -e 's/#!MARKER-/!MARKER-/g' pre-adblock.txt
|
2023-07-26 13:55:30 +00:00
|
|
|
|
2023-10-14 15:12:46 +00:00
|
|
|
echo '' > compiled/all-adblock.txt
|
2023-07-24 21:03:45 +00:00
|
|
|
|
2023-08-08 17:33:14 +00:00
|
|
|
{
|
|
|
|
#Create Header
|
|
|
|
echo '! Title: Mainboarder compiled
|
2023-07-21 21:37:00 +00:00
|
|
|
! Description: Filters optimized for uBlock, for single list use, deduplicated
|
|
|
|
! Expires: 2 days
|
|
|
|
! Last modified: '"$date"'
|
2023-07-24 20:48:53 +00:00
|
|
|
! Homepage: https://git.mainboarder.de/Public/Adblocker
|
2023-08-08 17:33:14 +00:00
|
|
|
!'
|
2023-07-21 21:37:00 +00:00
|
|
|
|
2023-08-08 17:33:14 +00:00
|
|
|
#Add own rules
|
|
|
|
cat own-rules.txt
|
2023-07-24 21:03:45 +00:00
|
|
|
|
2023-08-08 17:33:14 +00:00
|
|
|
#Remove duplicate lines
|
|
|
|
awk '!seen[$0]++' pre-adblock.txt
|
2023-10-14 15:12:46 +00:00
|
|
|
} >> compiled/all-adblock.txt
|
|
|
|
|
|
|
|
cd compiled
|
|
|
|
git add all-adblock.txt
|
|
|
|
git commit -m "$date" > /dev/null
|
|
|
|
git push > /dev/null 2>&1
|