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 | |
| 13 | DEPENDS = "openssl bind" |
| 14 | |
| 15 | SRC_URI = "ftp://ftp.isc.org/isc/dhcp/${PV}/dhcp-${PV}.tar.gz \ |
| 16 | file://define-macro-_PATH_DHCPD_CONF-and-_PATH_DHCLIENT_CON.patch \ |
| 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 \ |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 21 | file://dhcpd6.service \ |
| 22 | file://search-for-libxml2.patch " |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -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" |
| 30 | USERADD_PARAM_${PN}-server = "--system --no-create-home --home-dir /var/run/${PN} --shell /bin/false --user-group ${PN}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 31 | |
| 32 | SYSTEMD_PACKAGES = "${PN}-server ${PN}-relay" |
| 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 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 39 | INITSCRIPT_PACKAGES = "dhcp-server" |
| 40 | INITSCRIPT_NAME_dhcp-server = "dhcp-server" |
| 41 | INITSCRIPT_PARAMS_dhcp-server = "defaults" |
| 42 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 43 | TARGET_CFLAGS += "-D_GNU_SOURCE" |
| 44 | EXTRA_OECONF = "--with-srv-lease-file=${localstatedir}/lib/dhcp/dhcpd.leases \ |
| 45 | --with-srv6-lease-file=${localstatedir}/lib/dhcp/dhcpd6.leases \ |
| 46 | --with-cli-lease-file=${localstatedir}/lib/dhcp/dhclient.leases \ |
| 47 | --with-cli6-lease-file=${localstatedir}/lib/dhcp/dhclient6.leases \ |
| 48 | --with-libbind=${STAGING_LIBDIR}/ \ |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 49 | --enable-paranoia \ |
| 50 | --with-randomdev=/dev/random \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 51 | " |
| 52 | |
| 53 | do_install_append () { |
| 54 | install -d ${D}${sysconfdir}/init.d |
| 55 | install -d ${D}${sysconfdir}/default |
| 56 | install -d ${D}${sysconfdir}/dhcp |
| 57 | install -m 0755 ${WORKDIR}/init-relay ${D}${sysconfdir}/init.d/dhcp-relay |
| 58 | install -m 0644 ${WORKDIR}/default-relay ${D}${sysconfdir}/default/dhcp-relay |
| 59 | install -m 0755 ${WORKDIR}/init-server ${D}${sysconfdir}/init.d/dhcp-server |
| 60 | install -m 0644 ${WORKDIR}/default-server ${D}${sysconfdir}/default/dhcp-server |
| 61 | |
| 62 | rm -f ${D}${sysconfdir}/dhclient.conf* |
| 63 | rm -f ${D}${sysconfdir}/dhcpd.conf* |
| 64 | install -m 0644 ${WORKDIR}/dhclient.conf ${D}${sysconfdir}/dhcp/dhclient.conf |
| 65 | install -m 0644 ${WORKDIR}/dhcpd.conf ${D}${sysconfdir}/dhcp/dhcpd.conf |
| 66 | |
| 67 | install -d ${D}${base_sbindir}/ |
| 68 | if [ "${sbindir}" != "${base_sbindir}" ]; then |
| 69 | mv ${D}${sbindir}/dhclient ${D}${base_sbindir}/ |
| 70 | fi |
| 71 | install -m 0755 ${S}/client/scripts/linux ${D}${base_sbindir}/dhclient-script |
| 72 | |
| 73 | # Install systemd unit files |
| 74 | install -d ${D}${systemd_unitdir}/system |
| 75 | install -m 0644 ${WORKDIR}/dhcpd.service ${D}${systemd_unitdir}/system |
| 76 | install -m 0644 ${WORKDIR}/dhcpd6.service ${D}${systemd_unitdir}/system |
| 77 | install -m 0644 ${WORKDIR}/dhcrelay.service ${D}${systemd_unitdir}/system |
| 78 | sed -i -e 's,@SBINDIR@,${sbindir},g' ${D}${systemd_unitdir}/system/dhcpd*.service ${D}${systemd_unitdir}/system/dhcrelay.service |
| 79 | sed -i -e 's,@SYSCONFDIR@,${sysconfdir},g' ${D}${systemd_unitdir}/system/dhcpd*.service |
| 80 | sed -i -e 's,@base_bindir@,${base_bindir},g' ${D}${systemd_unitdir}/system/dhcpd*.service |
| 81 | sed -i -e 's,@localstatedir@,${localstatedir},g' ${D}${systemd_unitdir}/system/dhcpd*.service |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 82 | sed -i -e 's,@SYSCONFDIR@,${sysconfdir},g' ${D}${systemd_unitdir}/system/dhcrelay.service |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 83 | } |
| 84 | |
| 85 | PACKAGES += "dhcp-server dhcp-server-config dhcp-client dhcp-relay dhcp-omshell" |
| 86 | |
| 87 | FILES_${PN} = "" |
| 88 | RDEPENDS_${PN}-dev = "" |
| 89 | RDEPENDS_${PN}-staticdev = "" |
| 90 | |
| 91 | FILES_${PN}-server = "${sbindir}/dhcpd ${sysconfdir}/init.d/dhcp-server" |
| 92 | RRECOMMENDS_${PN}-server = "dhcp-server-config" |
| 93 | |
| 94 | FILES_${PN}-server-config = "${sysconfdir}/default/dhcp-server ${sysconfdir}/dhcp/dhcpd.conf" |
| 95 | |
| 96 | FILES_${PN}-relay = "${sbindir}/dhcrelay ${sysconfdir}/init.d/dhcp-relay ${sysconfdir}/default/dhcp-relay" |
| 97 | |
| 98 | FILES_${PN}-client = "${base_sbindir}/dhclient ${base_sbindir}/dhclient-script ${sysconfdir}/dhcp/dhclient.conf" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 99 | |
| 100 | FILES_${PN}-omshell = "${bindir}/omshell" |
| 101 | |
| 102 | pkg_postinst_dhcp-server() { |
| 103 | mkdir -p $D/${localstatedir}/lib/dhcp |
| 104 | touch $D/${localstatedir}/lib/dhcp/dhcpd.leases |
| 105 | touch $D/${localstatedir}/lib/dhcp/dhcpd6.leases |
| 106 | } |
| 107 | |
| 108 | pkg_postinst_dhcp-client() { |
| 109 | mkdir -p $D/${localstatedir}/lib/dhcp |
| 110 | } |
| 111 | |
| 112 | pkg_postrm_dhcp-server() { |
| 113 | rm -f $D/${localstatedir}/lib/dhcp/dhcpd.leases |
| 114 | rm -f $D/${localstatedir}/lib/dhcp/dhcpd6.leases |
| 115 | |
| 116 | if ! rmdir $D/${localstatedir}/lib/dhcp 2>/dev/null; then |
| 117 | echo "Not removing ${localstatedir}/lib/dhcp as it is non-empty." |
| 118 | fi |
| 119 | } |
| 120 | |
| 121 | pkg_postrm_dhcp-client() { |
| 122 | rm -f $D/${localstatedir}/lib/dhcp/dhclient.leases |
| 123 | rm -f $D/${localstatedir}/lib/dhcp/dhclient6.leases |
| 124 | |
| 125 | if ! rmdir $D/${localstatedir}/lib/dhcp 2>/dev/null; then |
| 126 | echo "Not removing ${localstatedir}/lib/dhcp as it is non-empty." |
| 127 | fi |
| 128 | } |