mirror of
https://github.com/trailofbits/algo.git
synced 2025-06-05 22:54:01 +02:00
* Update script to restart the dnsmasq service using systemctl(systemd) command instead of service(Upstart) * Use instead of legacy REF: https://github.com/koalaman/shellcheck/wiki/SC2006 * Replace non-standard egrep(deprecated) for grep -E. REF: https://github.com/koalaman/shellcheck/wiki/SC2196
This commit is contained in:
parent
bd4ea1235f
commit
07a1c70bf4
1 changed files with 6 additions and 4 deletions
|
@ -1,8 +1,8 @@
|
|||
#!/bin/sh
|
||||
# Block ads, malware, etc..
|
||||
|
||||
TEMP=`mktemp`
|
||||
TEMP_SORTED=`mktemp`
|
||||
TEMP="$(mktemp)"
|
||||
TEMP_SORTED="$(mktemp)"
|
||||
DNSMASQ_WHITELIST="/var/lib/dnsmasq/white.list"
|
||||
DNSMASQ_BLACKLIST="/var/lib/dnsmasq/black.list"
|
||||
DNSMASQ_BLOCKHOSTS="{{ config_prefix|default('/') }}etc/dnsmasq.d/block.hosts.conf"
|
||||
|
@ -33,11 +33,13 @@ then
|
|||
#Filter the blacklist, suppressing whitelist matches
|
||||
# This is relatively slow =-(
|
||||
echo 'Filtering white list...'
|
||||
egrep -v "^[[:space:]]*$" $DNSMASQ_WHITELIST | awk '/^[^#]/ {sub(/\r$/,"");print $1}' | grep -vf - "$TEMP_SORTED" > $DNSMASQ_BLOCKHOSTS
|
||||
grep -v -E "^[[:space:]]*$" $DNSMASQ_WHITELIST | awk '/^[^#]/ {sub(/\r$/,"");print $1}' | grep -vf - "$TEMP_SORTED" > $DNSMASQ_BLOCKHOSTS
|
||||
else
|
||||
cat "$TEMP_SORTED" > $DNSMASQ_BLOCKHOSTS
|
||||
fi
|
||||
|
||||
service dnsmasq restart
|
||||
echo 'Restarting dnsmasq service...'
|
||||
#Restart the dnsmasq service
|
||||
systemctl restart dnsmasq.service
|
||||
|
||||
exit 0
|
||||
|
|
Loading…
Add table
Reference in a new issue