Remove old exceptions

This commit is contained in:
Frank Denis
2012-09-28 00:47:33 +02:00
parent 5e16b57247
commit 3b6db0ef37
@@ -22,6 +22,23 @@ get_dhcp_dns() {
cat "${STATES_DIR}/dhcp-dns" 2> /dev/null
}
remove_old_exceptions() {
local found
find -x "$RESOLVER_DIR" -type f -print | {
while read file; do
found='no'
for domain in $DOMAINS_EXCEPTIONS; do
[ "$file" = "${RESOLVER_DIR}/${domain}" ] && found='yes' && break
done
[ "$found" = 'no' ] || continue
fgrep -ci 'automatically generated by the dnscrypt user interface' \
$file > /dev/null 2>&1 || continue
rm -f "$file"
done
}
}
name_servers=$(get_dhcp_dns || get_gw)
[ x"$name_servers" = 'x' ] && exit 0
@@ -29,6 +46,9 @@ name_servers=$(get_dhcp_dns || get_gw)
default_domain=$(./get-current-default-domain.sh)
mkdir -p "$RESOLVER_DIR" || exit 1
remove_old_exceptions
name_server="$gw"
for domain in $DOMAINS_EXCEPTIONS; do
if [ x"$default_domain" != 'x' ]; then