dhcp: 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>
This commit is contained in:
Isaac Hermida 2018-01-30 17:03:38 +01:00
parent 4895148009
commit c0593450b1
2 changed files with 51 additions and 0 deletions

View File

@ -0,0 +1,46 @@
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
}

View File

@ -0,0 +1,5 @@
# Copyright (C) 2018, Digi International Inc.
FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:"
SRC_URI += " file://0001-keep-resolv.conf-rights.patch"