From patchwork Tue Feb 7 20:29:45 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [2/2] dhcp: move dhcp leases files handling to postinst/postrm Date: Tue, 07 Feb 2012 20:29:45 -0000 From: Andrei Gherzan X-Patchwork-Id: 20907 Message-Id: <1328646585-25759-1-git-send-email-andrei@gherzan.ro> To: openembedded-core@lists.openembedded.org Both server and client needs access to leases files so its creation and removal are now handled by postinst/postrm scripts. Signed-off-by: Otavio Salvador Signed-off-by: Andrei Gherzan --- meta/recipes-connectivity/dhcp/dhcp.inc | 26 ++++++++++++++++++++++- meta/recipes-connectivity/dhcp/dhcp_4.2.3-P2.bb | 2 +- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/meta/recipes-connectivity/dhcp/dhcp.inc b/meta/recipes-connectivity/dhcp/dhcp.inc index 051190f..7db7c80 100644 --- a/meta/recipes-connectivity/dhcp/dhcp.inc +++ b/meta/recipes-connectivity/dhcp/dhcp.inc @@ -66,12 +66,36 @@ 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 ${localstatedir}/lib/dhcp/" +FILES_dhcp-client = "${base_sbindir}/dhclient ${base_sbindir}/dhclient-script ${sysconfdir}/dhcp/dhclient.conf" RDEPENDS_dhcp-client = "bash" FILES_dhcp-omshell = "${bindir}/omshell" pkg_postinst_dhcp-server() { + mkdir -p $D/${localstatedir}/lib/dhcp touch $D/${localstatedir}/lib/dhcp/dhcpd.leases touch $D/${localstatedir}/lib/dhcp/dhcpd6.leases } + + +pkg_postinst_dhcp-client() { + mkdir -p $D/${localstatedir}/lib/dhcp +} + +pkg_postrm_dhcp-server() { + rm -f $D/${localstatedir}/lib/dhcp/dhcpd.leases + rm -f $D/${localstatedir}/lib/dhcp/dhcpd6.leases + + if ! rmdir $D/${localstatedir}/lib/dhcp 2>/dev/null; then + echo "Not removing ${localstatedir}/lib/dhcp as it is non-empty." + fi +} + +pkg_postrm_dhcp-client() { + rm -f $D/${localstatedir}/lib/dhcp/dhclient.leases + rm -f $D/${localstatedir}/lib/dhcp/dhclient6.leases + + if ! rmdir $D/${localstatedir}/lib/dhcp 2>/dev/null; then + echo "Not removing ${localstatedir}/lib/dhcp as it is non-empty." + fi +} \ No newline at end of file diff --git a/meta/recipes-connectivity/dhcp/dhcp_4.2.3-P2.bb b/meta/recipes-connectivity/dhcp/dhcp_4.2.3-P2.bb index 24b50ba..67af3e2 100644 --- a/meta/recipes-connectivity/dhcp/dhcp_4.2.3-P2.bb +++ b/meta/recipes-connectivity/dhcp/dhcp_4.2.3-P2.bb @@ -1,6 +1,6 @@ require dhcp.inc -PR = "r0" +PR = "r1" SRC_URI += "file://fixincludes.patch \ file://dhcp-3.0.3-dhclient-dbus.patch;striplevel=0 \