init-ifupdown: fix script when '/etc/resolv.conf' is a file

The readlink command on a real file was expanding to nothing and then
the '/etc/resolv.conf' file was not being updated with the nameservers.
With this change we only run the 'readlink' link command after checking
that the file is actually a symbolic link.

Signed-off-by: Javier Viguera <javier.viguera@digi.com>
This commit is contained in:
Javier Viguera 2017-06-01 20:09:39 +02:00
parent d3baa9b2b1
commit 5d955b86af
1 changed files with 4 additions and 1 deletions

View File

@ -18,7 +18,10 @@
# Only for static method
[ "${METHOD}" != "static" ] && exit 0
RESOLVCONF="$(readlink /etc/resolv.conf)"
RESOLVCONF="/etc/resolv.conf"
# For symlinks reset to the destination file
[ -h "${RESOLVCONF}" ] && RESOLVCONF="$(readlink ${RESOLVCONF})"
NAMESERVERS=""
for NS in ${IF_DNS_NAMESERVER} ${IF_DNS_NAMESERVERS}; do