-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.sh
executable file
·41 lines (34 loc) · 1.48 KB
/
build.sh
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
33
34
35
36
37
38
39
40
41
#!/bin/bash
timestamp() {
date +"%Y/%m/%d %H:%M:%S"
}
# fetch git
git pull
# build lists, and sort them
# hostlist-compiler -c lostad_filter.json -o lostad_filter.txt
docker run --rm -t -v ~/lostad:/app lennihein/hostlist-compiler hostlist-compiler -c lostad_filter.json -o lostad_filter.txt
sort -o lostad_filter.txt{,}
# hostlist-compiler -c lostad_dns.json -o lostad_dns.txt
docker run --rm -t -v ~/lostad:/app lennihein/hostlist-compiler hostlist-compiler -c lostad_dns.json -o lostad_dns.txt
sort -o lostad_dns.txt{,}
# hostlist-compiler -c lostad.json -o lostad.txt
docker run --rm -t -v ~/lostad:/app lennihein/hostlist-compiler hostlist-compiler -c lostad.json -o lostad.txt
sort -o lostad.txt{,}
# remove empty lines and comments
sed -i '/^$/d' lostad*.txt
sed -i '/^!/d' lostad*.txt
# add update frequency
echo -e "!\n! Expires: 1 day\n!\n$(cat lostad.txt)" > lostad.txt
echo -e "!\n! Expires: 1 day\n!\n$(cat lostad_dns.txt)" > lostad_dns.txt
echo -e "!\n! Expires: 1 day\n!\n$(cat lostad_filter.txt)" > lostad_filter.txt
# add names
echo -e "!\n! Name: LostAd Full\n$(cat lostad.txt)" > lostad.txt
echo -e "!\n! Name: LostAd DNS\n$(cat lostad_dns.txt)" > lostad_dns.txt
echo -e "!\n! Name: LostAd Filter\n$(cat lostad_filter.txt)" > lostad_filter.txt
# add ABP2.0 format
echo -e "[Adblock Plus 2.0]\n$(cat lostad.txt)" > lostad.txt
echo -e "[Adblock Plus 2.0]\n$(cat lostad_filter.txt)" > lostad_filter.txt
# push changes to git
git stage lost*
git commit -m "Build $(timestamp) UTC"
git push