2016-11-30 21:06:11 +08:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Prepend resolver options to /etc/resolv.conf after dhclient`
|
|
|
|
# regenerates the file. See man (5) resolver for more details.
|
|
|
|
#
|
|
|
|
if [ $reason = "BOUND" ]; then
|
|
|
|
if [ -n "$new_domain_search" -o -n "$new_domain_name_servers" ]; then
|
2016-12-13 22:43:05 +08:00
|
|
|
RESOLV_CONF=$(cat /etc/resolv.conf | sed -r '/^options (timeout|attempts|ndots).*$/d')
|
2022-09-24 01:28:26 +08:00
|
|
|
OPTIONS="options timeout:{{ dns_timeout|default('2') }} attempts:{{ dns_attempts|default('2') }} ndots:{{ ndots }}"
|
2016-11-30 21:06:11 +08:00
|
|
|
|
|
|
|
printf "%b\n" "$RESOLV_CONF\n$OPTIONS" > /etc/resolv.conf
|
|
|
|
fi
|
|
|
|
fi
|