Adblocker/create-adblock.sh
2023-07-24 23:03:45 +02:00

28 lines
691 B
Bash
Executable file

#!/bin/bash
cd /var/www/DOMAIN/adblocker/
#Adblock Listen herunterladen
while read p; do
wget -qO - $p >> all-adblock.txt
done <adblocklists.txt
date=$(date '+%a, %d %b %Y %H:%M:%S %z')
#Kommentare in den Listen löschen
sed 's/^!.*$//g' all-adblock.txt > allfilters.txt
#Header erstellen
echo '! Title: Mainboarder kompiliert
! Description: Filters optimized for uBlock, for single list use, deduplicated
! Expires: 2 days
! Last modified: '"$date"'
! Homepage: https://git.mainboarder.de/Public/Adblocker
!' > all-adblock.txt
#Eigene Regeln hinzufügen
cat own-rules.txt >> all-adblock.txt
#Duplikate entfernen
awk '!seen[$0]++' allfilters.txt >> all-adblock.txt
rm allfilters.txt