-
-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathcompile-hostlist
executable file
·32 lines (22 loc) · 950 Bytes
/
compile-hostlist
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env bash
. /var/www/ppfeufer/.bashrc
cd /var/www/ppfeufer/adguard-filter-list
# Make sure the local git repo is up to date
git pull
# Get OISD list, since the HostlistCompiler can't fetch it for whatever reason » https://github.com/AdguardTeam/HostlistCompiler/issues/58
curl https://big.oisd.nl/ -o ../oisd.txt
# Create compiled blocklist
time /usr/local/bin/hostlist-compiler -v -c hostlist-compiler-config.json -o blocklist
# Remove all whitelisted entries, this is a blocklist after all
sed -i '/^@@/d' blocklist
# Remove empty lines
sed -i '/^$/d' blocklist
# Remove rules that are too long as these are most likely non DNS related rules, see https://github.com/AdguardTeam/AdGuardHome/issues/6003
#sed -i '/^.\{1024\}./d' blocklist
# Date and time
currentDate=`/bin/date '+%Y-%m-%d'`
currentTime=`/bin/date '+%H:%M:%S'`
# Push it to GitHub
git add *
git commit -m "Blocklist update ${currentDate} ${currentTime}"
git push