Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | SECTION = "console/network" |
| 2 | SUMMARY = "Internet Software Consortium DHCP package" |
| 3 | DESCRIPTION = "DHCP (Dynamic Host Configuration Protocol) is a protocol \ |
| 4 | which allows individual devices on an IP network to get their own \ |
| 5 | network configuration information from a server. DHCP helps make it \ |
| 6 | easier to administer devices." |
| 7 | |
| 8 | HOMEPAGE = "http://www.isc.org/" |
| 9 | |
| 10 | LICENSE = "ISC" |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 11 | LIC_FILES_CHKSUM = "file://LICENSE;beginline=4;md5=004a4db50a1e20972e924a8618747c01" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 12 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 13 | DEPENDS = "openssl bind" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 14 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 15 | SRC_URI = "http://ftp.isc.org/isc/dhcp/${PV}/dhcp-${PV}.tar.gz \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 16 | file://init-relay file://default-relay \ |
| 17 | file://init-server file://default-server \ |
| 18 | file://dhclient.conf file://dhcpd.conf \ |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 19 | file://dhclient-systemd-wrapper \ |
| 20 | file://dhclient.service \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 21 | file://dhcpd.service file://dhcrelay.service \ |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 22 | file://dhcpd6.service \ |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 23 | " |
Brad Bishop | 08902b0 | 2019-08-20 09:16:51 -0400 | [diff] [blame] | 24 | UPSTREAM_CHECK_URI = "http://ftp.isc.org/isc/dhcp/" |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 25 | UPSTREAM_CHECK_REGEX = "(?P<pver>\d+\.\d+\.(\d+?))/" |
| 26 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 27 | inherit autotools-brokensep systemd useradd update-rc.d |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 28 | |
| 29 | USERADD_PACKAGES = "${PN}-server" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 30 | USERADD_PARAM_${PN}-server = "--system --no-create-home --home-dir /var/run/${BPN} --shell /bin/false --user-group ${BPN}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 31 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 32 | SYSTEMD_PACKAGES = "${PN}-server ${PN}-relay ${PN}-client" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 33 | SYSTEMD_SERVICE_${PN}-server = "dhcpd.service dhcpd6.service" |
| 34 | SYSTEMD_AUTO_ENABLE_${PN}-server = "disable" |
| 35 | |
| 36 | SYSTEMD_SERVICE_${PN}-relay = "dhcrelay.service" |
| 37 | SYSTEMD_AUTO_ENABLE_${PN}-relay = "disable" |
| 38 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 39 | SYSTEMD_SERVICE_${PN}-client = "dhclient.service" |
| 40 | SYSTEMD_AUTO_ENABLE_${PN}-client = "disable" |
| 41 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 42 | INITSCRIPT_PACKAGES = "dhcp-server" |
| 43 | INITSCRIPT_NAME_dhcp-server = "dhcp-server" |
| 44 | INITSCRIPT_PARAMS_dhcp-server = "defaults" |
| 45 | |
Brad Bishop | 1d80a2e | 2019-11-15 16:35:03 -0500 | [diff] [blame] | 46 | CFLAGS += "-D_GNU_SOURCE" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 47 | EXTRA_OECONF = "--with-srv-lease-file=${localstatedir}/lib/dhcp/dhcpd.leases \ |
| 48 | --with-srv6-lease-file=${localstatedir}/lib/dhcp/dhcpd6.leases \ |
| 49 | --with-cli-lease-file=${localstatedir}/lib/dhcp/dhclient.leases \ |
| 50 | --with-cli6-lease-file=${localstatedir}/lib/dhcp/dhclient6.leases \ |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 51 | --enable-paranoia --disable-static \ |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 52 | --with-randomdev=/dev/random \ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 53 | --with-libbind=${STAGING_DIR_HOST} \ |
| 54 | --enable-libtool \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 55 | " |
| 56 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 57 | #Enable shared libs per dhcp README |
| 58 | do_configure_prepend () { |
| 59 | cp configure.ac+lt configure.ac |
| 60 | } |
| 61 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 62 | do_install_append () { |
| 63 | install -d ${D}${sysconfdir}/init.d |
| 64 | install -d ${D}${sysconfdir}/default |
| 65 | install -d ${D}${sysconfdir}/dhcp |
| 66 | install -m 0755 ${WORKDIR}/init-relay ${D}${sysconfdir}/init.d/dhcp-relay |
| 67 | install -m 0644 ${WORKDIR}/default-relay ${D}${sysconfdir}/default/dhcp-relay |
| 68 | install -m 0755 ${WORKDIR}/init-server ${D}${sysconfdir}/init.d/dhcp-server |
| 69 | install -m 0644 ${WORKDIR}/default-server ${D}${sysconfdir}/default/dhcp-server |
| 70 | |
| 71 | rm -f ${D}${sysconfdir}/dhclient.conf* |
| 72 | rm -f ${D}${sysconfdir}/dhcpd.conf* |
| 73 | install -m 0644 ${WORKDIR}/dhclient.conf ${D}${sysconfdir}/dhcp/dhclient.conf |
| 74 | install -m 0644 ${WORKDIR}/dhcpd.conf ${D}${sysconfdir}/dhcp/dhcpd.conf |
| 75 | |
| 76 | install -d ${D}${base_sbindir}/ |
| 77 | if [ "${sbindir}" != "${base_sbindir}" ]; then |
| 78 | mv ${D}${sbindir}/dhclient ${D}${base_sbindir}/ |
| 79 | fi |
| 80 | install -m 0755 ${S}/client/scripts/linux ${D}${base_sbindir}/dhclient-script |
| 81 | |
| 82 | # Install systemd unit files |
| 83 | install -d ${D}${systemd_unitdir}/system |
| 84 | install -m 0644 ${WORKDIR}/dhcpd.service ${D}${systemd_unitdir}/system |
| 85 | install -m 0644 ${WORKDIR}/dhcpd6.service ${D}${systemd_unitdir}/system |
| 86 | install -m 0644 ${WORKDIR}/dhcrelay.service ${D}${systemd_unitdir}/system |
| 87 | sed -i -e 's,@SBINDIR@,${sbindir},g' ${D}${systemd_unitdir}/system/dhcpd*.service ${D}${systemd_unitdir}/system/dhcrelay.service |
| 88 | sed -i -e 's,@SYSCONFDIR@,${sysconfdir},g' ${D}${systemd_unitdir}/system/dhcpd*.service |
| 89 | sed -i -e 's,@base_bindir@,${base_bindir},g' ${D}${systemd_unitdir}/system/dhcpd*.service |
| 90 | sed -i -e 's,@localstatedir@,${localstatedir},g' ${D}${systemd_unitdir}/system/dhcpd*.service |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 91 | sed -i -e 's,@SYSCONFDIR@,${sysconfdir},g' ${D}${systemd_unitdir}/system/dhcrelay.service |
| 92 | |
| 93 | install -d ${D}${base_sbindir} |
| 94 | install -m 0755 ${WORKDIR}/dhclient-systemd-wrapper ${D}${base_sbindir}/dhclient-systemd-wrapper |
| 95 | install -m 0644 ${WORKDIR}/dhclient.service ${D}${systemd_unitdir}/system |
| 96 | sed -i -e 's,@SYSCONFDIR@,${sysconfdir},g' ${D}${systemd_unitdir}/system/dhclient.service |
| 97 | sed -i -e 's,@BASE_SBINDIR@,${base_sbindir},g' ${D}${systemd_unitdir}/system/dhclient.service |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 98 | } |
| 99 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 100 | PACKAGES += "dhcp-libs dhcp-server dhcp-server-config dhcp-client dhcp-relay dhcp-omshell" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 101 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 102 | PACKAGES_remove = "${PN}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 103 | RDEPENDS_${PN}-dev = "" |
| 104 | RDEPENDS_${PN}-staticdev = "" |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 105 | FILES_${PN}-libs = "${libdir}/libdhcpctl.so.0* ${libdir}/libomapi.so.0* ${libdir}/libdhcp.so.0*" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 106 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 107 | FILES_${PN}-server = "${sbindir}/dhcpd ${sysconfdir}/init.d/dhcp-server" |
| 108 | RRECOMMENDS_${PN}-server = "dhcp-server-config" |
| 109 | |
| 110 | FILES_${PN}-server-config = "${sysconfdir}/default/dhcp-server ${sysconfdir}/dhcp/dhcpd.conf" |
| 111 | |
| 112 | FILES_${PN}-relay = "${sbindir}/dhcrelay ${sysconfdir}/init.d/dhcp-relay ${sysconfdir}/default/dhcp-relay" |
| 113 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 114 | FILES_${PN}-client = "${base_sbindir}/dhclient \ |
| 115 | ${base_sbindir}/dhclient-script \ |
| 116 | ${sysconfdir}/dhcp/dhclient.conf \ |
| 117 | ${base_sbindir}/dhclient-systemd-wrapper \ |
| 118 | " |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 119 | |
| 120 | FILES_${PN}-omshell = "${bindir}/omshell" |
| 121 | |
| 122 | pkg_postinst_dhcp-server() { |
| 123 | mkdir -p $D/${localstatedir}/lib/dhcp |
| 124 | touch $D/${localstatedir}/lib/dhcp/dhcpd.leases |
| 125 | touch $D/${localstatedir}/lib/dhcp/dhcpd6.leases |
| 126 | } |
| 127 | |
| 128 | pkg_postinst_dhcp-client() { |
| 129 | mkdir -p $D/${localstatedir}/lib/dhcp |
| 130 | } |
| 131 | |
| 132 | pkg_postrm_dhcp-server() { |
| 133 | rm -f $D/${localstatedir}/lib/dhcp/dhcpd.leases |
| 134 | rm -f $D/${localstatedir}/lib/dhcp/dhcpd6.leases |
| 135 | |
| 136 | if ! rmdir $D/${localstatedir}/lib/dhcp 2>/dev/null; then |
| 137 | echo "Not removing ${localstatedir}/lib/dhcp as it is non-empty." |
| 138 | fi |
| 139 | } |
| 140 | |
| 141 | pkg_postrm_dhcp-client() { |
| 142 | rm -f $D/${localstatedir}/lib/dhcp/dhclient.leases |
| 143 | rm -f $D/${localstatedir}/lib/dhcp/dhclient6.leases |
| 144 | |
| 145 | if ! rmdir $D/${localstatedir}/lib/dhcp 2>/dev/null; then |
| 146 | echo "Not removing ${localstatedir}/lib/dhcp as it is non-empty." |
| 147 | fi |
| 148 | } |