redundanten Code entfernt

This commit is contained in:
Robin Kloppe 2023-08-08 19:33:14 +02:00
parent 677259ebdd
commit 283c577b87

View file

@ -1,6 +1,6 @@
#!/bin/bash
touch pre-adblock.txt
echo '' > pre-adblock.txt
touch errors.log
date=$(date '+%a, %d %b %Y %H:%M:%S %z')
@ -19,22 +19,23 @@ done <adblocklists.txt
# Breaking before will cause trouble if a URL is not reachable
set -e -u
#Remove comments in lists
sed -i 's/^!.*$//g' pre-adblock.txt
#Remove comments in lists and change marker to comment
sed -i -e 's/^!.*$//g' -e 's/#!MARKER-/!MARKER-/g' pre-adblock.txt
#Change marker to comment
sed -i 's/#!MARKER-/!/g' pre-adblock.txt
echo '' > all-adblock.txt
#Create Header
echo '! Title: Mainboarder compiled
{
#Create Header
echo '! Title: Mainboarder compiled
! 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
!'
#Add own rules
cat own-rules.txt >> all-adblock.txt
#Add own rules
cat own-rules.txt
#Remove duplicate lines
awk '!seen[$0]++' pre-adblock.txt >> all-adblock.txt
#Remove duplicate lines
awk '!seen[$0]++' pre-adblock.txt
} >> all-adblock.txt