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.inc115
1 files changed, 115 insertions, 0 deletions
diff --git a/meta/recipes-connectivity/dhcp/dhcp.inc b/meta/recipes-connectivity/dhcp/dhcp.inc
new file mode 100644
index 0000000..4949e02
--- /dev/null
+++ b/meta/recipes-connectivity/dhcp/dhcp.inc
@@ -0,0 +1,115 @@
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 file://dhcpd.service file://dhcrelay.service"
21
22inherit autotools systemd
23
24SYSTEMD_PACKAGES = "${PN}-server ${PN}-relay"
25SYSTEMD_SERVICE_${PN}-server = "dhcpd.service"
26SYSTEMD_AUTO_ENABLE_${PN}-server = "disable"
27
28SYSTEMD_SERVICE_${PN}-relay = "dhcrelay.service"
29SYSTEMD_AUTO_ENABLE_${PN}-relay = "disable"
30
31TARGET_CFLAGS += "-D_GNU_SOURCE"
32EXTRA_OECONF = "--with-srv-lease-file=${localstatedir}/lib/dhcp/dhcpd.leases \
33 --with-srv6-lease-file=${localstatedir}/lib/dhcp/dhcpd6.leases \
34 --with-cli-lease-file=${localstatedir}/lib/dhcp/dhclient.leases \
35 --with-cli6-lease-file=${localstatedir}/lib/dhcp/dhclient6.leases \
36 --with-libbind=${STAGING_LIBDIR}/ \
37 "
38
39do_compile_prepend () {
40 cp -f ${WORKDIR}/site.h ${S}/includes
41}
42
43do_install_append () {
44 install -d ${D}${sysconfdir}/init.d
45 install -d ${D}${sysconfdir}/default
46 install -d ${D}${sysconfdir}/dhcp
47 install -m 0755 ${WORKDIR}/init-relay ${D}${sysconfdir}/init.d/dhcp-relay
48 install -m 0644 ${WORKDIR}/default-relay ${D}${sysconfdir}/default/dhcp-relay
49 install -m 0755 ${WORKDIR}/init-server ${D}${sysconfdir}/init.d/dhcp-server
50 install -m 0644 ${WORKDIR}/default-server ${D}${sysconfdir}/default/dhcp-server
51
52 rm -f ${D}${sysconfdir}/dhclient.conf*
53 rm -f ${D}${sysconfdir}/dhcpd.conf*
54 install -m 0644 ${WORKDIR}/dhclient.conf ${D}${sysconfdir}/dhcp/dhclient.conf
55 install -m 0644 ${WORKDIR}/dhcpd.conf ${D}${sysconfdir}/dhcp/dhcpd.conf
56
57 install -d ${D}${base_sbindir}/
58 if [ "${sbindir}" != "${base_sbindir}" ]; then
59 mv ${D}${sbindir}/dhclient ${D}${base_sbindir}/
60 fi
61 install -m 0755 ${S}/client/scripts/linux ${D}${base_sbindir}/dhclient-script
62
63 # Install systemd unit files
64 install -d ${D}${systemd_unitdir}/system
65 install -m 0644 ${WORKDIR}/dhcpd.service ${D}${systemd_unitdir}/system
66 install -m 0644 ${WORKDIR}/dhcrelay.service ${D}${systemd_unitdir}/system
67 sed -i -e 's,@SBINDIR@,${sbindir},g' ${D}${systemd_unitdir}/system/dhcpd.service ${D}${systemd_unitdir}/system/dhcrelay.service
68 sed -i -e 's,@SYSCONFDIR@,${sysconfdir},g' ${D}${systemd_unitdir}/system/dhcpd.service
69}
70
71PACKAGES += "dhcp-server dhcp-server-config dhcp-client dhcp-relay dhcp-omshell"
72
73FILES_${PN} = ""
74RDEPENDS_${PN}-dev = ""
75RDEPENDS_${PN}-staticdev = ""
76
77FILES_dhcp-server = "${sbindir}/dhcpd ${sysconfdir}/init.d/dhcp-server"
78RRECOMMENDS_dhcp-server = "dhcp-server-config"
79
80FILES_dhcp-server-config = "${sysconfdir}/default/dhcp-server ${sysconfdir}/dhcp/dhcpd.conf"
81
82FILES_dhcp-relay = "${sbindir}/dhcrelay ${sysconfdir}/init.d/dhcp-relay ${sysconfdir}/default/dhcp-relay"
83
84FILES_dhcp-client = "${base_sbindir}/dhclient ${base_sbindir}/dhclient-script ${sysconfdir}/dhcp/dhclient.conf"
85RDEPENDS_dhcp-client = "bash"
86
87FILES_dhcp-omshell = "${bindir}/omshell"
88
89pkg_postinst_dhcp-server() {
90 mkdir -p $D/${localstatedir}/lib/dhcp
91 touch $D/${localstatedir}/lib/dhcp/dhcpd.leases
92 touch $D/${localstatedir}/lib/dhcp/dhcpd6.leases
93}
94
95pkg_postinst_dhcp-client() {
96 mkdir -p $D/${localstatedir}/lib/dhcp
97}
98
99pkg_postrm_dhcp-server() {
100 rm -f $D/${localstatedir}/lib/dhcp/dhcpd.leases
101 rm -f $D/${localstatedir}/lib/dhcp/dhcpd6.leases
102
103 if ! rmdir $D/${localstatedir}/lib/dhcp 2>/dev/null; then
104 echo "Not removing ${localstatedir}/lib/dhcp as it is non-empty."
105 fi
106}
107
108pkg_postrm_dhcp-client() {
109 rm -f $D/${localstatedir}/lib/dhcp/dhclient.leases
110 rm -f $D/${localstatedir}/lib/dhcp/dhclient6.leases
111
112 if ! rmdir $D/${localstatedir}/lib/dhcp 2>/dev/null; then
113 echo "Not removing ${localstatedir}/lib/dhcp as it is non-empty."
114 fi
115}