summaryrefslogtreecommitdiffstats
path: root/meta/recipes-connectivity/dhcp/dhcp.inc
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-connectivity/dhcp/dhcp.inc')
-rw-r--r--meta/recipes-connectivity/dhcp/dhcp.inc100
1 files changed, 100 insertions, 0 deletions
diff --git a/meta/recipes-connectivity/dhcp/dhcp.inc b/meta/recipes-connectivity/dhcp/dhcp.inc
new file mode 100644
index 0000000000..512127cd4c
--- /dev/null
+++ b/meta/recipes-connectivity/dhcp/dhcp.inc
@@ -0,0 +1,100 @@
1SECTION = "console/network"
2SUMMARY = "Internet Software Consortium DHCP package"
3DESCRIPTION = "DHCP (Dynamic Host Configuration Protocol) is a protocol \
4which allows individual devices on an IP network to get their own \
5network configuration information from a server. DHCP helps make it \
6easier to administer devices."
7
8HOMEPAGE = "http://www.isc.org/"
9
10LICENSE = "ISC"
11LIC_FILES_CHKSUM = "file://LICENSE;beginline=4;md5=c5c64d696107f84b56fe337d14da1753"
12
13DEPENDS = "openssl bind"
14
15SRC_URI = "ftp://ftp.isc.org/isc/dhcp/${PV}/dhcp-${PV}.tar.gz \
16 file://site.h \
17 file://init-relay file://default-relay \
18 file://init-server file://default-server \
19 file://dhclient.conf file://dhcpd.conf"
20
21inherit autotools
22
23TARGET_CFLAGS += "-D_GNU_SOURCE"
24EXTRA_OECONF = "--with-srv-lease-file=${localstatedir}/lib/dhcp/dhcpd.leases \
25 --with-srv6-lease-file=${localstatedir}/lib/dhcp/dhcpd6.leases \
26 --with-cli-lease-file=${localstatedir}/lib/dhcp/dhclient.leases \
27 --with-cli6-lease-file=${localstatedir}/lib/dhcp/dhclient6.leases \
28 --with-libbind=${STAGING_LIBDIR}/ \
29 "
30
31do_compile_prepend () {
32 cp -f ${WORKDIR}/site.h ${S}/includes
33}
34
35do_install_append () {
36 install -d ${D}${sysconfdir}/init.d
37 install -d ${D}${sysconfdir}/default
38 install -d ${D}${sysconfdir}/dhcp
39 install -m 0755 ${WORKDIR}/init-relay ${D}${sysconfdir}/init.d/dhcp-relay
40 install -m 0644 ${WORKDIR}/default-relay ${D}${sysconfdir}/default/dhcp-relay
41 install -m 0755 ${WORKDIR}/init-server ${D}${sysconfdir}/init.d/dhcp-server
42 install -m 0644 ${WORKDIR}/default-server ${D}${sysconfdir}/default/dhcp-server
43
44 rm -f ${D}${sysconfdir}/dhclient.conf*
45 rm -f ${D}${sysconfdir}/dhcpd.conf*
46 install -m 0644 ${WORKDIR}/dhclient.conf ${D}${sysconfdir}/dhcp/dhclient.conf
47 install -m 0644 ${WORKDIR}/dhcpd.conf ${D}${sysconfdir}/dhcp/dhcpd.conf
48
49 install -d ${D}${base_sbindir}/
50 if [ "${sbindir}" != "${base_sbindir}" ]; then
51 mv ${D}${sbindir}/dhclient ${D}${base_sbindir}/
52 fi
53 install -m 0755 ${S}/client/scripts/linux ${D}${base_sbindir}/dhclient-script
54}
55
56PACKAGES += "dhcp-server dhcp-server-config dhcp-client dhcp-relay dhcp-omshell"
57
58FILES_${PN} = ""
59RDEPENDS_${PN}-dev = ""
60RDEPENDS_${PN}-staticdev = ""
61
62FILES_dhcp-server = "${sbindir}/dhcpd ${sysconfdir}/init.d/dhcp-server"
63RRECOMMENDS_dhcp-server = "dhcp-server-config"
64
65FILES_dhcp-server-config = "${sysconfdir}/default/dhcp-server ${sysconfdir}/dhcp/dhcpd.conf"
66
67FILES_dhcp-relay = "${sbindir}/dhcrelay ${sysconfdir}/init.d/dhcp-relay ${sysconfdir}/default/dhcp-relay"
68
69FILES_dhcp-client = "${base_sbindir}/dhclient ${base_sbindir}/dhclient-script ${sysconfdir}/dhcp/dhclient.conf"
70RDEPENDS_dhcp-client = "bash"
71
72FILES_dhcp-omshell = "${bindir}/omshell"
73
74pkg_postinst_dhcp-server() {
75 mkdir -p $D/${localstatedir}/lib/dhcp
76 touch $D/${localstatedir}/lib/dhcp/dhcpd.leases
77 touch $D/${localstatedir}/lib/dhcp/dhcpd6.leases
78}
79
80pkg_postinst_dhcp-client() {
81 mkdir -p $D/${localstatedir}/lib/dhcp
82}
83
84pkg_postrm_dhcp-server() {
85 rm -f $D/${localstatedir}/lib/dhcp/dhcpd.leases
86 rm -f $D/${localstatedir}/lib/dhcp/dhcpd6.leases
87
88 if ! rmdir $D/${localstatedir}/lib/dhcp 2>/dev/null; then
89 echo "Not removing ${localstatedir}/lib/dhcp as it is non-empty."
90 fi
91}
92
93pkg_postrm_dhcp-client() {
94 rm -f $D/${localstatedir}/lib/dhcp/dhclient.leases
95 rm -f $D/${localstatedir}/lib/dhcp/dhclient6.leases
96
97 if ! rmdir $D/${localstatedir}/lib/dhcp 2>/dev/null; then
98 echo "Not removing ${localstatedir}/lib/dhcp as it is non-empty."
99 fi
100}