Remove old exceptions
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user