aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xexamples/udhcp/simple.script12
1 files changed, 8 insertions, 4 deletions
diff --git a/examples/udhcp/simple.script b/examples/udhcp/simple.script
index 40ee73822..d42f2d3d5 100755
--- a/examples/udhcp/simple.script
+++ b/examples/udhcp/simple.script
@@ -34,13 +34,17 @@ case "$1" in
34 fi 34 fi
35 35
36 echo "Recreating $RESOLV_CONF" 36 echo "Recreating $RESOLV_CONF"
37 echo -n > $RESOLV_CONF-$$ 37 # If the file is a symlink somewhere (like /etc/resolv.conf
38 [ -n "$domain" ] && echo "search $domain" >> $RESOLV_CONF-$$ 38 # pointing to /run/resolv.conf), make sure things work.
39 realconf=$(realpath "$RESOLV_CONF" 2>/dev/null || echo "$RESOLV_CONF")
40 tmpfile="$realconf-$$"
41 > "$tmpfile"
42 [ -n "$domain" ] && echo "search $domain" >> "$tmpfile"
39 for i in $dns ; do 43 for i in $dns ; do
40 echo " Adding DNS server $i" 44 echo " Adding DNS server $i"
41 echo "nameserver $i" >> $RESOLV_CONF-$$ 45 echo "nameserver $i" >> "$tmpfile"
42 done 46 done
43 mv $RESOLV_CONF-$$ $RESOLV_CONF 47 mv "$tmpfile" "$realconf"
44 ;; 48 ;;
45esac 49esac
46 50