summaryrefslogtreecommitdiffstats
path: root/meta/recipes-connectivity
diff options
context:
space:
mode:
authorHongxu Jia <hongxu.jia@windriver.com>2014-03-05 16:38:29 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-03-07 14:58:46 +0000
commit45bbd217c23c00145f209abc9ec02ae82f14eaba (patch)
tree2fa62c11391509cc2f5b65ec2a3bef84f31a0fde /meta/recipes-connectivity
parent41917e83b5afbf282a966361c0bb60d06a7a231e (diff)
downloadpoky-45bbd217c23c00145f209abc9ec02ae82f14eaba.tar.gz
dhcp-client: fix invoke dhclient-script failed on Read-only file system
In read-only file system, '/etc' is on the readonly partition, and '/etc/resolv.conf' is symlinked to a separate writable partition. In this situation, we should use shell variable to instead of the temp file '/etc/resolv.conf.dhclient'. [YOCTO #5624] (From OE-Core rev: df793f4356b411cbb92445c4559c9b21eb6d99fc) Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-connectivity')
-rw-r--r--meta/recipes-connectivity/dhcp/dhcp/dhclient-script-drop-resolv.conf.dhclient.patch70
-rw-r--r--meta/recipes-connectivity/dhcp/dhcp_4.2.5-P1.bb1
2 files changed, 71 insertions, 0 deletions
diff --git a/meta/recipes-connectivity/dhcp/dhcp/dhclient-script-drop-resolv.conf.dhclient.patch b/meta/recipes-connectivity/dhcp/dhcp/dhclient-script-drop-resolv.conf.dhclient.patch
new file mode 100644
index 0000000000..47ea5554b8
--- /dev/null
+++ b/meta/recipes-connectivity/dhcp/dhcp/dhclient-script-drop-resolv.conf.dhclient.patch
@@ -0,0 +1,70 @@
1dhcp-client: fix invoke dhclient-script failed on Read-only file system
2
3In read-only file system, '/etc' is on the readonly partition,
4and '/etc/resolv.conf' is symlinked to a separate writable
5partition.
6
7In this situation, we should use shell variable to instead of
8temp files '/etc/resolv.conf.dhclient' and '/etc/resolv.conf.dhclient6'.
9
10Upstream-Status: Pending
11Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
12---
13 client/scripts/linux | 20 +++++++++-----------
14 1 file changed, 9 insertions(+), 11 deletions(-)
15
16diff --git a/client/scripts/linux b/client/scripts/linux
17--- a/client/scripts/linux
18+++ b/client/scripts/linux
19@@ -27,27 +27,25 @@ ip=/sbin/ip
20
21 make_resolv_conf() {
22 if [ x"$new_domain_name_servers" != x ]; then
23- cat /dev/null > /etc/resolv.conf.dhclient
24- chmod 644 /etc/resolv.conf.dhclient
25+ resolv_conf=""
26 if [ x"$new_domain_search" != x ]; then
27- echo search $new_domain_search >> /etc/resolv.conf.dhclient
28+ resolv_conf="search ${new_domain_search}\n"
29 elif [ x"$new_domain_name" != x ]; then
30 # Note that the DHCP 'Domain Name Option' is really just a domain
31 # name, and that this practice of using the domain name option as
32 # a search path is both nonstandard and deprecated.
33- echo search $new_domain_name >> /etc/resolv.conf.dhclient
34+ resolv_conf="search ${new_domain_name}\n"
35 fi
36 for nameserver in $new_domain_name_servers; do
37- echo nameserver $nameserver >>/etc/resolv.conf.dhclient
38+ resolv_conf="${resolv_conf}nameserver ${nameserver}\n"
39 done
40
41- mv /etc/resolv.conf.dhclient /etc/resolv.conf
42+ echo -e "${resolv_conf}" > /etc/resolv.conf
43 elif [ "x${new_dhcp6_name_servers}" != x ] ; then
44- cat /dev/null > /etc/resolv.conf.dhclient6
45- chmod 644 /etc/resolv.conf.dhclient6
46+ resolv_conf=""
47
48 if [ "x${new_dhcp6_domain_search}" != x ] ; then
49- echo search ${new_dhcp6_domain_search} >> /etc/resolv.conf.dhclient6
50+ resolv_conf="search ${new_dhcp6_domain_search}\n"
51 fi
52 shopt -s nocasematch
53 for nameserver in ${new_dhcp6_name_servers} ; do
54@@ -59,11 +57,11 @@ make_resolv_conf() {
55 else
56 zone_id=
57 fi
58- echo nameserver ${nameserver}$zone_id >> /etc/resolv.conf.dhclient6
59+ resolv_conf="${resolv_conf}nameserver ${nameserver}$zone_id\n"
60 done
61 shopt -u nocasematch
62
63- mv /etc/resolv.conf.dhclient6 /etc/resolv.conf
64+ echo -e "${resolv_conf}" > /etc/resolv.conf
65 fi
66 }
67
68--
691.8.1.2
70
diff --git a/meta/recipes-connectivity/dhcp/dhcp_4.2.5-P1.bb b/meta/recipes-connectivity/dhcp/dhcp_4.2.5-P1.bb
index 0c9f0dbdb1..77cdb4e813 100644
--- a/meta/recipes-connectivity/dhcp/dhcp_4.2.5-P1.bb
+++ b/meta/recipes-connectivity/dhcp/dhcp_4.2.5-P1.bb
@@ -6,6 +6,7 @@ SRC_URI += "file://dhcp-3.0.3-dhclient-dbus.patch;striplevel=0 \
6 file://fix-external-bind.patch \ 6 file://fix-external-bind.patch \
7 file://link-with-lcrypto.patch \ 7 file://link-with-lcrypto.patch \
8 file://fixsepbuild.patch \ 8 file://fixsepbuild.patch \
9 file://dhclient-script-drop-resolv.conf.dhclient.patch \
9 " 10 "
10 11
11SRC_URI[md5sum] = "f68e3c1f00a9af5742bc5e71d567cf93" 12SRC_URI[md5sum] = "f68e3c1f00a9af5742bc5e71d567cf93"