From a5c36eb22154a2f17bba4329ee85627eeb64b664 Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Thu, 1 Oct 2015 10:21:43 -0300 Subject: Introduce read_xml_tag.sh Create /usr/local/sbin/read_xml_tag.sh, that will read a xml tag from config file using xmllint. Replace all direct read using cat, grep, sed, ... by this script --- src/sbin/dhclient-script | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/sbin/dhclient-script') diff --git a/src/sbin/dhclient-script b/src/sbin/dhclient-script index 9d71aaf..98e4aa8 100755 --- a/src/sbin/dhclient-script +++ b/src/sbin/dhclient-script @@ -268,12 +268,12 @@ add_new_resolv_conf() { fi if [ -n "$new_domain_name_servers" ]; then /bin/rm -f /var/etc/nameserver_$interface - ALLOWOVERRIDE=`/usr/bin/grep dnsallowoverride /conf/config.xml | /usr/bin/wc -l` + ALLOWOVERRIDE=$(/usr/local/sbin/read_xml_tag.sh boolean system/dnsallowoverride) for nameserver in $new_domain_name_servers; do # Add a route to the nameserver out the correct interface # so that mulitple wans work correctly with multiple dns # also backup the nameserver for later route removal - if [ $ALLOWOVERRIDE -gt 0 ]; then + if [ "$ALLOWOVERRIDE" = "true" ]; then echo $nameserver >>/var/etc/nameserver_$interface $ROUTE add $nameserver -iface $interface fi -- cgit v1.1