Skip to content
Snippets Groups Projects
Commit bd0d9057 authored by Michael Tokarev's avatar Michael Tokarev
Browse files

udhcpc/default.script: recognize $search dhcp parameter too, in addition to...

udhcpc/default.script: recognize $search dhcp parameter too, in addition to $domain (and simplify these parts a bit)
parent aaaf5deb
No related branches found
No related tags found
No related merge requests found
Pipeline #670140 waiting for manual action
......@@ -8,17 +8,14 @@ comma_separate() {
}
do_resolv_conf() {
local cfg=/etc/resolv.conf
if [ -n "$domain" ] || [ -n "$dns" ]; then
echo -n > $cfg
if [ -n "$domain" ]; then
echo search $domain >> $cfg
fi
if [ -n "$domain$search$dns" ]; then
{
[ ! "$domain" ] || echo domain $domain
[ ! "$search" ] || echo search $search
for i in $dns ; do
echo nameserver $i >> $cfg
echo nameserver $i
done
} > /etc/resolv.conf
fi
}
......
......@@ -37,12 +37,13 @@ case $1 in
fi
# Update resolver configuration file
[ -n "$domain" ] && R="domain $domain" || R=""
for i in $dns; do
R="$R
nameserver $i"
done
R="$(
[ ! "$domain" ] || echo domain $domain
[ ! "$search" ] || echo search $search
for i in $dns; do
echo nameserver $i
done
)"
if [ -x /sbin/resolvconf ]; then
echo "$R" | resolvconf -a "$interface.udhcpc"
else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment