#!/bin/sh -e

BLOCKS="/etc/firewalld/blocks.conf"
URL="https://pgl.yoyo.org/adservers/serverlist.php?hostformat=dnsmasq&showintro=0&mimetype=plaintext"

curl -s ${URL} | sed -e 's,127.0.0.1,,' >${BLOCKS}.tmp
mv ${BLOCKS}.tmp ${BLOCKS}

systemctl is-active --quiet dnsmasq.service
if [ $? -eq 0 ]; then
	systemctl reload dnsmasq.service
fi
