diff options
author | Mohit Mehta <mohit.mehta@vyatta.com> | 2008-08-08 22:53:05 +0000 |
---|---|---|
committer | Mohit Mehta <mohit.mehta@vyatta.com> | 2008-08-08 22:53:05 +0000 |
commit | ee955bd93bd5199d885c1d6c4c4b18a059ea4c38 (patch) | |
tree | 877f71adcf55f655dc3f322ad42aade56bfda397 /templates | |
parent | 6567750f6bf6d721432d57ef737b72070e697f64 (diff) | |
download | vyatta-cfg-system-ee955bd93bd5199d885c1d6c4c4b18a059ea4c38.tar.gz vyatta-cfg-system-ee955bd93bd5199d885c1d6c4c4b18a059ea4c38.zip |
tighten the checks for checking the existence or removal or nameservers
Diffstat (limited to 'templates')
-rw-r--r-- | templates/system/name-server/node.def | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/templates/system/name-server/node.def b/templates/system/name-server/node.def index b5f38527..fce5cac9 100644 --- a/templates/system/name-server/node.def +++ b/templates/system/name-server/node.def @@ -1,22 +1,22 @@ multi: type: ipv4 help: Set Domain Name Server (DNS) -update:expression: "sudo sh -c \"touch /etc/resolv.conf && \ -if grep -q '$VAR(@)' /etc/resolv.conf; then \ - exit 0; \ -else \ - mv -f /etc/resolv.conf /etc/old_resolv.conf && \ - echo \\\"nameserver\t $VAR(@)\\\" >> /etc/resolv.conf && \ - cat /etc/old_resolv.conf >> /etc/resolv.conf; \ -fi && \ -if [ -d /opt/vyatta/config/active/service/dns/forwarding ]; then \ - /opt/vyatta/sbin/vyatta-dns-forwarding.pl --update-dnsforwarding >&/dev/null; \ -fi && \ -if [ -f /etc/ntp.conf ] && grep -q 'server' /etc/ntp.conf; then \ - /usr/sbin/invoke-rc.d ntp restart >&/dev/null; \ -fi\" " +update: sudo sh -c "touch /etc/resolv.conf && +if grep -q \"$VAR(@)\($\|[[:space:]]\)\" /etc/resolv.conf; then + exit 0; +else + mv -f /etc/resolv.conf /etc/old_resolv.conf && + echo \"nameserver $VAR(@)\" >> /etc/resolv.conf && + cat /etc/old_resolv.conf >> /etc/resolv.conf; +fi && +if [ -d /opt/vyatta/config/active/service/dns/forwarding ]; then + /opt/vyatta/sbin/vyatta-dns-forwarding.pl --update-dnsforwarding >&/dev/null; +fi && +if [ -f /etc/ntp.conf ] && grep -q 'server' /etc/ntp.conf; then + /usr/sbin/invoke-rc.d ntp restart >&/dev/null; +fi" delete:expression: "sudo sh -c \"touch /etc/resolv.conf && \ -sed -i '/$VAR(@)/d' /etc/resolv.conf && \ +sed -i '/$VAR(@)$/d' /etc/resolv.conf && \ if [ -f /etc/ntp.conf ] && grep -q 'server' /etc/ntp.conf; then \ /usr/sbin/invoke-rc.d ntp restart >&/dev/null; \ fi && \ |