Release openresolv-3.7.1
[openresolv] / pdnsd.in
index 8be0f9a0d006a4b7276dae187d97f77b7cc04099..59a4755aff16b9f530c2b5dbf40219955c7cd68f 100644 (file)
--- a/pdnsd.in
+++ b/pdnsd.in
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (c) 2010-2011 Roy Marples
+# Copyright (c) 2010-2013 Roy Marples
 # All rights reserved
 
 # pdnsd subscriber for resolvconf
@@ -29,7 +29,7 @@
 [ -f "@SYSCONFDIR@"/resolvconf.conf ] || exit 0
 . "@SYSCONFDIR@/resolvconf.conf" || exit 1
 [ -z "$pdnsd_conf" -a -z "$pdnsd_resolv" ] && exit 0
-[ -z "$RESOLVCONF" ] && eval "$(@PREFIX@/sbin/resolvconf -v)"
+[ -z "$RESOLVCONF" ] && eval "$(@SBINDIR@/resolvconf -v)"
 NL="
 "
 
@@ -48,7 +48,7 @@ remove_markers()
                sed "/^$m1/,/^$m2/d" $@
        else
                for x; do
-                       while read line; do
+                       while read -r line; do
                                case "$line" in
                                "$m1"*) in_marker=1;;
                                "$m2"*) in_marker=0;;
@@ -82,19 +82,19 @@ change_file()
        return 0
 }
 
-newresolv="# Generated by resolvconf\n"
+newresolv="# Generated by resolvconf$NL"
 changed=false
 
 # Try to ensure that config dirs exist
 if type config_mkdirs >/dev/null 2>&1; then
        config_mkdirs "$pdnsd_resolv" "$pdnsd_conf"
 else
-       @PREFIX@/sbin/resolvconf -D "$pdnsd_resolv" "$pdnsd_conf"
+       @SBINDIR@/resolvconf -D "$pdnsd_resolv" "$pdnsd_conf"
 fi
 
 if [ -n "$pdnsd_resolv" ]; then
        for n in $NAMESERVERS; do
-               newresolv="${newresolv}nameserver $n\n"
+               newresolv="${newresolv}nameserver $n$NL"
        done
 fi
 
@@ -146,7 +146,7 @@ if [ -w "$pdnsd_conf" ]; then
        fi
        if change_file "$pdnsd_conf" "$cf"; then
                changed=true
-       fi      
+       fi
 fi
 
 if [ -n "$pdnsd_resolv" ]; then