From: Roy Marples Date: Wed, 13 Aug 2008 15:39:34 +0000 (+0000) Subject: Support head and tail files for resolv.conf X-Git-Tag: v4.0.2~46 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b4b41529500740d30fbecebd4c5665bca1f18948;p=thirdparty%2Fdhcpcd.git Support head and tail files for resolv.conf --- diff --git a/dhcpcd-hooks/20-resolv.conf b/dhcpcd-hooks/20-resolv.conf index 437c1167..b86d5837 100644 --- a/dhcpcd-hooks/20-resolv.conf +++ b/dhcpcd-hooks/20-resolv.conf @@ -8,7 +8,7 @@ make_resolv_conf() -z "${new_domain_search}" ]; then return 0 fi - local x= conf="${signature}\n" + local x= conf="${signature}\n" cf="/etc/resolv.conf.${interface}" if [ -n "${new_domain_search}" ]; then conf="${conf}search ${new_domain_search}\n" elif [ -n "${new_domain_name}" ]; then @@ -20,8 +20,16 @@ make_resolv_conf() if type resolvconf >/dev/null 2>&1; then printf "${conf}" | resolvconf -a "${interface}" else + rm -f "${cf}" + if [ -f /etc/resolv.conf.head ]; then + cat /etc/resolv.conf.head > "${cf}" + fi + printf "${conf}" >> "${cf}" + if [ -f /etc/resolv.conf.tail ]; then + cat /etc/resolv.conf.tail >> "${cf}" + fi save_conf /etc/resolv.conf - printf "${conf}" > /etc/resolv.conf + mv -f "${cf}" /etc/resolv.conf fi }