udhcpc: use readlink rather than realpath
authorMike Frysinger <vapier@gentoo.org>
Tue, 12 Mar 2013 14:48:09 +0000 (10:48 -0400)
committerMike Frysinger <vapier@gentoo.org>
Tue, 12 Mar 2013 14:48:09 +0000 (10:48 -0400)
The realpath utility requires all paths exist when canonicalizing
symlinks.  If /etc/resolv.conf points to a tmpfs, then it might
not exist initially.  Use `readlink -f` so that we follow all
symlinks that are available.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
examples/udhcp/simple.script

index 0397e506c60a8db1b7e9b41695866e1a29d9cfdd..2a917eb6ce87e2b2e760f2314a3f2bcb398736b7 100755 (executable)
@@ -37,7 +37,7 @@ case "$1" in
                echo "Recreating $RESOLV_CONF"
                # If the file is a symlink somewhere (like /etc/resolv.conf
                # pointing to /run/resolv.conf), make sure things work.
-               realconf=$(realpath "$RESOLV_CONF" 2>/dev/null || echo "$RESOLV_CONF")
+               realconf=$(readlink -f "$RESOLV_CONF" 2>/dev/null || echo "$RESOLV_CONF")
                tmpfile="$realconf-$$"
                > "$tmpfile"
                [ -n "$domain" ] && echo "search $domain" >> "$tmpfile"