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" |
| 11 | LIC_FILES_CHKSUM = "file://LICENSE;beginline=4;md5=c5c64d696107f84b56fe337d14da1753" |
| 12 | |
Brad Bishop | c4ea075 | 2018-11-15 14:30:15 -0800 | [diff] [blame] | 13 | DEPENDS = "openssl" |
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 | " |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 24 | UPSTREAM_CHECK_URI = "ftp://ftp.isc.org/isc/dhcp/" |
| 25 | UPSTREAM_CHECK_REGEX = "(?P<pver>\d+\.\d+\.(\d+?))/" |
| 26 | |
| 27 | inherit autotools systemd useradd update-rc.d |
| 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 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 46 | TARGET_CFLAGS += "-D_GNU_SOURCE" |
| 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 \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 53 | " |
| 54 | |
| 55 | do_install_append () { |
| 56 | install -d ${D}${sysconfdir}/init.d |
| 57 | install -d ${D}${sysconfdir}/default |
| 58 | install -d ${D}${sysconfdir}/dhcp |
| 59 | install -m 0755 ${WORKDIR}/init-relay ${D}${sysconfdir}/init.d/dhcp-relay |
| 60 | install -m 0644 ${WORKDIR}/default-relay ${D}${sysconfdir}/default/dhcp-relay |
| 61 | install -m 0755 ${WORKDIR}/init-server ${D}${sysconfdir}/init.d/dhcp-server |
| 62 | install -m 0644 ${WORKDIR}/default-server ${D}${sysconfdir}/default/dhcp-server |
| 63 | |
| 64 | rm -f ${D}${sysconfdir}/dhclient.conf* |
| 65 | rm -f ${D}${sysconfdir}/dhcpd.conf* |
| 66 | install -m 0644 ${WORKDIR}/dhclient.conf ${D}${sysconfdir}/dhcp/dhclient.conf |
| 67 | install -m 0644 ${WORKDIR}/dhcpd.conf ${D}${sysconfdir}/dhcp/dhcpd.conf |
| 68 | |
| 69 | install -d ${D}${base_sbindir}/ |
| 70 | if [ "${sbindir}" != "${base_sbindir}" ]; then |
| 71 | mv ${D}${sbindir}/dhclient ${D}${base_sbindir}/ |
| 72 | fi |
| 73 | install -m 0755 ${S}/client/scripts/linux ${D}${base_sbindir}/dhclient-script |
| 74 | |
| 75 | # Install systemd unit files |
| 76 | install -d ${D}${systemd_unitdir}/system |
| 77 | install -m 0644 ${WORKDIR}/dhcpd.service ${D}${systemd_unitdir}/system |
| 78 | install -m 0644 ${WORKDIR}/dhcpd6.service ${D}${systemd_unitdir}/system |
| 79 | install -m 0644 ${WORKDIR}/dhcrelay.service ${D}${systemd_unitdir}/system |
| 80 | sed -i -e 's,@SBINDIR@,${sbindir},g' ${D}${systemd_unitdir}/system/dhcpd*.service ${D}${systemd_unitdir}/system/dhcrelay.service |
| 81 | sed -i -e 's,@SYSCONFDIR@,${sysconfdir},g' ${D}${systemd_unitdir}/system/dhcpd*.service |
| 82 | sed -i -e 's,@base_bindir@,${base_bindir},g' ${D}${systemd_unitdir}/system/dhcpd*.service |
| 83 | 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] | 84 | sed -i -e 's,@SYSCONFDIR@,${sysconfdir},g' ${D}${systemd_unitdir}/system/dhcrelay.service |
| 85 | |
| 86 | install -d ${D}${base_sbindir} |
| 87 | install -m 0755 ${WORKDIR}/dhclient-systemd-wrapper ${D}${base_sbindir}/dhclient-systemd-wrapper |
| 88 | install -m 0644 ${WORKDIR}/dhclient.service ${D}${systemd_unitdir}/system |
| 89 | sed -i -e 's,@SYSCONFDIR@,${sysconfdir},g' ${D}${systemd_unitdir}/system/dhclient.service |
| 90 | 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] | 91 | } |
| 92 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 93 | 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] | 94 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 95 | PACKAGES_remove = "${PN}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 96 | RDEPENDS_${PN}-dev = "" |
| 97 | RDEPENDS_${PN}-staticdev = "" |
| 98 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 99 | FILES_${PN}-libs = "${libdir}/libdhcpctl.so.0* ${libdir}/libomapi.so.0*" |
| 100 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 101 | FILES_${PN}-server = "${sbindir}/dhcpd ${sysconfdir}/init.d/dhcp-server" |
| 102 | RRECOMMENDS_${PN}-server = "dhcp-server-config" |
| 103 | |
| 104 | FILES_${PN}-server-config = "${sysconfdir}/default/dhcp-server ${sysconfdir}/dhcp/dhcpd.conf" |
| 105 | |
| 106 | FILES_${PN}-relay = "${sbindir}/dhcrelay ${sysconfdir}/init.d/dhcp-relay ${sysconfdir}/default/dhcp-relay" |
| 107 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 108 | FILES_${PN}-client = "${base_sbindir}/dhclient \ |
| 109 | ${base_sbindir}/dhclient-script \ |
| 110 | ${sysconfdir}/dhcp/dhclient.conf \ |
| 111 | ${base_sbindir}/dhclient-systemd-wrapper \ |
| 112 | " |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 113 | |
| 114 | FILES_${PN}-omshell = "${bindir}/omshell" |
| 115 | |
| 116 | pkg_postinst_dhcp-server() { |
| 117 | mkdir -p $D/${localstatedir}/lib/dhcp |
| 118 | touch $D/${localstatedir}/lib/dhcp/dhcpd.leases |
| 119 | touch $D/${localstatedir}/lib/dhcp/dhcpd6.leases |
| 120 | } |
| 121 | |
| 122 | pkg_postinst_dhcp-client() { |
| 123 | mkdir -p $D/${localstatedir}/lib/dhcp |
| 124 | } |
| 125 | |
| 126 | pkg_postrm_dhcp-server() { |
| 127 | rm -f $D/${localstatedir}/lib/dhcp/dhcpd.leases |
| 128 | rm -f $D/${localstatedir}/lib/dhcp/dhcpd6.leases |
| 129 | |
| 130 | if ! rmdir $D/${localstatedir}/lib/dhcp 2>/dev/null; then |
| 131 | echo "Not removing ${localstatedir}/lib/dhcp as it is non-empty." |
| 132 | fi |
| 133 | } |
| 134 | |
| 135 | pkg_postrm_dhcp-client() { |
| 136 | rm -f $D/${localstatedir}/lib/dhcp/dhclient.leases |
| 137 | rm -f $D/${localstatedir}/lib/dhcp/dhclient6.leases |
| 138 | |
| 139 | if ! rmdir $D/${localstatedir}/lib/dhcp 2>/dev/null; then |
| 140 | echo "Not removing ${localstatedir}/lib/dhcp as it is non-empty." |
| 141 | fi |
| 142 | } |