From: Isaac Hermida <isaac.hermida@digi.com>
Date: Tue, 30 Jan 2018 17:00:29 +0100
Subject: [PATCH] keep resolv.conf rights

Option --reference does not exist for busybox chmod/chown, so you get an ugly
error and file rights are modified.

https://jira.digi.com/browse/DEL-5642

Signed-off-by: Isaac Hermida <isaac.hermida@digi.com>
---
 client/scripts/linux | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/client/scripts/linux b/client/scripts/linux
index 1712d7d195a3..7e3d217a7b95 100755
--- a/client/scripts/linux
+++ b/client/scripts/linux
@@ -73,11 +73,8 @@ make_resolv_conf() {
             sed -n /^\w*[Nn][Aa][Mm][Ee][Ss][Ee][Rr][Vv][Ee][Rr]/p /etc/resolv.conf >>$new_resolv_conf
         fi
 
-	if [ -f /etc/resolv.conf ]; then
-	    chown --reference=/etc/resolv.conf $new_resolv_conf
-	    chmod --reference=/etc/resolv.conf $new_resolv_conf
-	fi
-        mv -f $new_resolv_conf /etc/resolv.conf
+        cat $new_resolv_conf > /etc/resolv.conf
+        rm -f $new_resolv_conf
     # DHCPv6
     elif [ -n "$new_dhcp6_domain_search" ] || [ -n "$new_dhcp6_name_servers" ]; then
         new_resolv_conf=/etc/resolv.conf.dhclient-new
@@ -100,11 +97,8 @@ make_resolv_conf() {
             sed -n /^\w*[Nn][Aa][Mm][Ee][Ss][Ee][Rr][Vv][Ee][Rr]/p /etc/resolv.conf >>$new_resolv_conf
         fi
 
-	if [ -f /etc/resolv.conf ]; then
-            chown --reference=/etc/resolv.conf $new_resolv_conf
-            chmod --reference=/etc/resolv.conf $new_resolv_conf
-	fi
-        mv -f $new_resolv_conf /etc/resolv.conf
+        cat $new_resolv_conf > /etc/resolv.conf
+        rm -f $new_resolv_conf
     fi
 }
 
