aboutsummaryrefslogtreecommitdiff
path: root/examples/udhcp/sample.renew
diff options
context:
space:
mode:
Diffstat (limited to 'examples/udhcp/sample.renew')
-rwxr-xr-xexamples/udhcp/sample.renew18
1 files changed, 11 insertions, 7 deletions
diff --git a/examples/udhcp/sample.renew b/examples/udhcp/sample.renew
index ea368fc9e..4dce8486a 100755
--- a/examples/udhcp/sample.renew
+++ b/examples/udhcp/sample.renew
@@ -22,10 +22,14 @@ then
done
fi
-echo -n > $RESOLV_CONF
-[ -n "$domain" ] && echo domain $domain >> $RESOLV_CONF
-for i in $dns
-do
- echo adding dns $i
- echo nameserver $i >> $RESOLV_CONF
-done
+# Only replace resolv.conf is we have at least one DNS server
+if [ -n "$dns" ]
+then
+ echo -n > $RESOLV_CONF
+ [ -n "$domain" ] && echo domain $domain >> $RESOLV_CONF
+ for i in $dns
+ do
+ echo adding dns $i
+ echo nameserver $i >> $RESOLV_CONF
+ done
+fi