summaryrefslogtreecommitdiffstats
path: root/meta/recipes-connectivity/dhcp/dhcp
diff options
context:
space:
mode:
authorHaris Okanovic <haris.okanovic@ni.com>2019-11-08 15:46:31 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-11-14 13:20:59 +0000
commit41647c59170272a7b8f69a048f752d0076e777e3 (patch)
tree6767da83f7d9cfac9fe539abfe92bb18267f974e /meta/recipes-connectivity/dhcp/dhcp
parent1729e1db7820bc090fd4933360ae47dacae58414 (diff)
downloadpoky-41647c59170272a7b8f69a048f752d0076e777e3.tar.gz
dhcp: Workaround busybox limitation in Linux dhclient-script
Busybox's implementation of chown and chmod doesn't provide a "--reference" option used in the latest version of dhclient-script. This change works around that limitation by using stat to read ownership and permissions flags and simple chown/chmod calls supported in both coreutils and busybox. Patch submitted upstream to ISC, tracked as bug 48771. (From OE-Core rev: a311013e1fd0e7b874dfe11bb3cdf4839cd91c9f) Signed-off-by: Haris Okanovic <haris.okanovic@ni.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-connectivity/dhcp/dhcp')
-rw-r--r--meta/recipes-connectivity/dhcp/dhcp/0001-workaround-busybox-limitation-in-linux-dhclient-script.patch65
1 files changed, 65 insertions, 0 deletions
diff --git a/meta/recipes-connectivity/dhcp/dhcp/0001-workaround-busybox-limitation-in-linux-dhclient-script.patch b/meta/recipes-connectivity/dhcp/dhcp/0001-workaround-busybox-limitation-in-linux-dhclient-script.patch
new file mode 100644
index 0000000000..2359381b93
--- /dev/null
+++ b/meta/recipes-connectivity/dhcp/dhcp/0001-workaround-busybox-limitation-in-linux-dhclient-script.patch
@@ -0,0 +1,65 @@
1From eec0503cfc36f63d777f5cb3f2719cecedcb8468 Mon Sep 17 00:00:00 2001
2From: Haris Okanovic <haris.okanovic@ni.com>
3Date: Mon, 7 Jan 2019 13:22:09 -0600
4Subject: [PATCH] Workaround busybox limitation in Linux dhclient-script
5
6Busybox is a lightweight implementation of coreutils commonly used on
7space-constrained embedded Linux distributions. It's implementation of
8chown and chmod doesn't provide a "--reference" option added to
9client/scripts/linux as of commit 9261cb14. This change works around
10that limitation by using stat to read ownership and permissions flags
11and simple chown/chmod calls supported in both coreutils and busybox.
12
13 modified: client/scripts/linux
14
15Signed-off-by: Haris Okanovic <haris.okanovic@ni.com>
16Upstream-Status: Pending [ISC-Bugs #48771]
17---
18 client/scripts/linux | 17 +++++++++++++----
19 1 file changed, 13 insertions(+), 4 deletions(-)
20
21diff --git a/client/scripts/linux b/client/scripts/linux
22index 0c429697..2435a44b 100755
23--- a/client/scripts/linux
24+++ b/client/scripts/linux
25@@ -32,6 +32,17 @@
26 # if your system holds ip tool in a non-standard location.
27 ip=/sbin/ip
28
29+chown_chmod_by_reference() {
30+ local reference_file="$1"
31+ local target_file="$2"
32+
33+ local owner=$(stat -c "%u:%g" "$reference_file")
34+ local perm=$(stat -c "%a" "$reference_file")
35+
36+ chown "$owner" "$target_file"
37+ chmod "$perm" "$target_file"
38+}
39+
40 # update /etc/resolv.conf based on received values
41 # This updated version mostly follows Debian script by Andrew Pollock et al.
42 make_resolv_conf() {
43@@ -74,8 +85,7 @@ make_resolv_conf() {
44 fi
45
46 if [ -f /etc/resolv.conf ]; then
47- chown --reference=/etc/resolv.conf $new_resolv_conf
48- chmod --reference=/etc/resolv.conf $new_resolv_conf
49+ chown_chmod_by_reference /etc/resolv.conf $new_resolv_conf
50 fi
51 mv -f $new_resolv_conf /etc/resolv.conf
52 # DHCPv6
53@@ -101,8 +111,7 @@ make_resolv_conf() {
54 fi
55
56 if [ -f /etc/resolv.conf ]; then
57- chown --reference=/etc/resolv.conf $new_resolv_conf
58- chmod --reference=/etc/resolv.conf $new_resolv_conf
59+ chown_chmod_by_reference /etc/resolv.conf $new_resolv_conf
60 fi
61 mv -f $new_resolv_conf /etc/resolv.conf
62 fi
63--
642.20.0
65