Patchwork [1/1] dhcp-client: override make_resolv_conf for read-only fs

login
register
mail settings
Submitter Hongxu Jia
Date Dec. 3, 2013, 10:30 a.m.
Message ID <893fa112fb49ce4c68f6b39d9e2da04ddef5aa95.1386066538.git.hongxu.jia@windriver.com>
Download mbox | patch
Permalink /patch/62723/
State New
Headers show

Comments

Hongxu Jia - Dec. 3, 2013, 10:30 a.m.
When dhclient-script starts, the client script first defines a shell
function, make_resolv_conf , which is later used to create the
/etc/resolv.conf file.

But the read-only filesystem didn't permit the modification, so override
the default behaviour and redefine this function in the enter hook script.

http://linux.about.com/library/cmd/blcmdl8_dhclient-script.htm
[YOCTO #5624]

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
 meta/recipes-connectivity/dhcp/dhcp.inc                           | 8 +++++++-
 .../recipes-connectivity/dhcp/files/readonly-dhclient-enter-hooks | 3 +++
 2 files changed, 10 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-connectivity/dhcp/files/readonly-dhclient-enter-hooks

Patch

diff --git a/meta/recipes-connectivity/dhcp/dhcp.inc b/meta/recipes-connectivity/dhcp/dhcp.inc
index ad82b57..d9a6beb 100644
--- a/meta/recipes-connectivity/dhcp/dhcp.inc
+++ b/meta/recipes-connectivity/dhcp/dhcp.inc
@@ -16,6 +16,7 @@  SRC_URI = "ftp://ftp.isc.org/isc/dhcp/${PV}/dhcp-${PV}.tar.gz \
            file://site.h \
 	   file://init-relay file://default-relay \
 	   file://init-server file://default-server \
+	   file://readonly-dhclient-enter-hooks \
 	   file://dhclient.conf file://dhcpd.conf"
 
 inherit autotools
@@ -51,6 +52,9 @@  do_install_append () {
 		mv ${D}${sbindir}/dhclient ${D}${base_sbindir}/
 	fi
 	install -m 0755 ${S}/client/scripts/linux ${D}${base_sbindir}/dhclient-script
+	if ${@base_contains("IMAGE_FEATURES", "read-only-rootfs", "true", "false" ,d)}; then
+		install -m 0755 ${WORKDIR}/readonly-dhclient-enter-hooks ${D}${sysconfdir}/dhclient-enter-hooks
+	fi
 }
 
 PACKAGES += "dhcp-server dhcp-server-config dhcp-client dhcp-relay dhcp-omshell"
@@ -66,7 +70,9 @@  FILES_dhcp-server-config = "${sysconfdir}/default/dhcp-server ${sysconfdir}/dhcp
 
 FILES_dhcp-relay = "${sbindir}/dhcrelay ${sysconfdir}/init.d/dhcp-relay ${sysconfdir}/default/dhcp-relay"
 
-FILES_dhcp-client = "${base_sbindir}/dhclient ${base_sbindir}/dhclient-script ${sysconfdir}/dhcp/dhclient.conf"
+FILES_dhcp-client = "${base_sbindir}/dhclient ${base_sbindir}/dhclient-script ${sysconfdir}/dhcp/dhclient.conf \
+                     ${sysconfdir}/dhclient-enter-hooks \
+"
 RDEPENDS_dhcp-client = "bash"
 
 FILES_dhcp-omshell = "${bindir}/omshell"
diff --git a/meta/recipes-connectivity/dhcp/files/readonly-dhclient-enter-hooks b/meta/recipes-connectivity/dhcp/files/readonly-dhclient-enter-hooks
new file mode 100644
index 0000000..06c90e3
--- /dev/null
+++ b/meta/recipes-connectivity/dhcp/files/readonly-dhclient-enter-hooks
@@ -0,0 +1,3 @@ 
+make_resolv_conf(){
+  :
+}