mirror of
https://github.com/tanrax/maza-ad-blocking.git
synced 2024-12-22 09:55:35 +01:00
Update update function
This commit is contained in:
parent
38beec3f34
commit
c2dbfdb04e
16
maza
16
maza
@ -6,6 +6,8 @@ set -e
|
||||
PROGNAME=$(basename $0)
|
||||
CONFIG=($HOME/.maza/)
|
||||
LIST="list"
|
||||
START_TAG="## MAZA - List ad blocking"
|
||||
END_TAG="## END MAZA"
|
||||
|
||||
# FUNCTIONS
|
||||
|
||||
@ -38,7 +40,19 @@ update() {
|
||||
# Download DNS list
|
||||
curl -L -s "https://pgl.yoyo.org/adservers/serverlist.php?showintro=0;hostformat=hosts" -o "$CONFIG/$LIST"
|
||||
# Clear list
|
||||
sed -n "/<pre>/,/<\/pre>/p" list > "$CONFIG/$LIST"
|
||||
## Get PRE tag
|
||||
sed -i .bak -n "/<pre>/,/<\/pre>/p" "$CONFIG/$LIST"
|
||||
## Remove first line
|
||||
sed -i .bak '1d' "$CONFIG/$LIST"
|
||||
## Remove last line
|
||||
sed -i .bak '$ d' "$CONFIG/$LIST"
|
||||
## Add start tag DNS list in first line
|
||||
sed -i .bak "1i\\
|
||||
$START_TAG
|
||||
" "$CONFIG/$LIST"
|
||||
## Add end tag DNS list in first line
|
||||
echo $END_TAG >> "$CONFIG/$LIST"
|
||||
# Notify user
|
||||
echo "Done!"
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user