summaryrefslogtreecommitdiffstats
path: root/meta/recipes-connectivity/dhcp/dhcp/dhclient-script-drop-resolv.conf.dhclient.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-connectivity/dhcp/dhcp/dhclient-script-drop-resolv.conf.dhclient.patch')
-rw-r--r--meta/recipes-connectivity/dhcp/dhcp/dhclient-script-drop-resolv.conf.dhclient.patch70
1 files changed, 70 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