examples/udhcp: do not rewrite resolv.conf if no DNS servers. Closes 6788

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2014-01-13 13:38:53 +01:00
parent d74f8435ea
commit 2e66daca65
2 changed files with 22 additions and 14 deletions

View File

@ -22,10 +22,14 @@ then
done
fi
echo -n > $RESOLV_CONF
[ -n "$domain" ] && echo domain $domain >> $RESOLV_CONF
for i in $dns
do
# 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
done
fi

View File

@ -22,10 +22,14 @@ then
done
fi
echo -n > $RESOLV_CONF
[ -n "$domain" ] && echo domain $domain >> $RESOLV_CONF
for i in $dns
do
# 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
done
fi