Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 1 | SUMMARY = "Network Time Protocol daemon and utilities" |
| 2 | DESCRIPTION = "The Network Time Protocol (NTP) is used to \ |
| 3 | synchronize the time of a computer client or server to \ |
| 4 | another server or reference time source, such as a radio \ |
| 5 | or satellite receiver or modem." |
| 6 | HOMEPAGE = "http://support.ntp.org" |
| 7 | SECTION = "net" |
| 8 | LICENSE = "NTP" |
| 9 | LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=4190b39435611e92a4da74e682623f19" |
| 10 | |
| 11 | DEPENDS = "libevent" |
| 12 | |
| 13 | SRC_URI = "http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/ntp-${PV}.tar.gz \ |
| 14 | file://ntp-4.2.4_p6-nano.patch \ |
| 15 | file://reproducibility-fixed-path-to-posix-shell.patch \ |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 16 | file://0001-libntp-Do-not-use-PTHREAD_STACK_MIN-on-glibc.patch \ |
| 17 | file://0001-test-Fix-build-with-new-compiler-defaults-to-fno-com.patch \ |
Andrew Geissler | 87f5cff | 2022-09-30 13:13:31 -0500 | [diff] [blame] | 18 | file://0001-sntp-Fix-types-in-check-for-pthread_detach.patch \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 19 | file://ntpd \ |
| 20 | file://ntp.conf \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 21 | file://ntpd.service \ |
| 22 | file://sntp.service \ |
| 23 | file://sntp \ |
| 24 | file://ntpd.list \ |
| 25 | " |
| 26 | |
Andrew Geissler | c87764f | 2020-06-27 00:16:32 -0500 | [diff] [blame] | 27 | SRC_URI[sha256sum] = "f65840deab68614d5d7ceb2d0bb9304ff70dcdedd09abb79754a87536b849c19" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 28 | |
Andrew Geissler | 6972109 | 2021-07-23 12:57:00 -0400 | [diff] [blame] | 29 | # CVE-2016-9312 is only for windows. |
Patrick Williams | 8e7b46e | 2023-05-01 14:19:06 -0500 | [diff] [blame^] | 30 | # CVE-2019-11331 is inherent to RFC 5905 and cannot be fixed without breaking compatibility |
Andrew Geissler | 615f2f1 | 2022-07-15 14:00:58 -0500 | [diff] [blame] | 31 | # The other CVEs are not correctly identified because cve-check |
| 32 | # is not able to check the version correctly (it only checks for 4.2.8 omitting p15 that makes the difference) |
| 33 | CVE_CHECK_IGNORE += "\ |
| 34 | CVE-2016-9312 \ |
| 35 | CVE-2015-5146 \ |
| 36 | CVE-2015-5300 \ |
| 37 | CVE-2015-7975 \ |
| 38 | CVE-2015-7976 \ |
| 39 | CVE-2015-7977 \ |
| 40 | CVE-2015-7978 \ |
| 41 | CVE-2015-7979 \ |
| 42 | CVE-2015-8138 \ |
| 43 | CVE-2015-8139 \ |
| 44 | CVE-2015-8140 \ |
| 45 | CVE-2015-8158 \ |
| 46 | CVE-2016-1547 \ |
| 47 | CVE-2016-2516 \ |
| 48 | CVE-2016-2517 \ |
| 49 | CVE-2016-2519 \ |
| 50 | CVE-2016-7429 \ |
| 51 | CVE-2016-7433 \ |
| 52 | CVE-2016-9310 \ |
| 53 | CVE-2016-9311 \ |
Patrick Williams | 8e7b46e | 2023-05-01 14:19:06 -0500 | [diff] [blame^] | 54 | CVE-2019-11331 \ |
Andrew Geissler | 615f2f1 | 2022-07-15 14:00:58 -0500 | [diff] [blame] | 55 | " |
| 56 | |
Andrew Geissler | 6972109 | 2021-07-23 12:57:00 -0400 | [diff] [blame] | 57 | |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 58 | inherit autotools update-rc.d useradd systemd pkgconfig |
| 59 | |
| 60 | # The ac_cv_header_readline_history is to stop ntpdc depending on either |
| 61 | # readline or curses |
| 62 | EXTRA_OECONF += "--with-net-snmp-config=no \ |
| 63 | --without-ntpsnmpd \ |
| 64 | ac_cv_header_readline_history_h=no \ |
| 65 | --with-yielding_select=yes \ |
| 66 | --with-locfile=redhat \ |
| 67 | --without-rpath \ |
| 68 | " |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 69 | CFLAGS:append = " -DPTYS_ARE_GETPT -DPTYS_ARE_SEARCHED" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 70 | |
| 71 | USERADD_PACKAGES = "${PN}" |
| 72 | NTP_USER_HOME ?= "/var/lib/ntp" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 73 | USERADD_PARAM:${PN} = "--system --home-dir ${NTP_USER_HOME} \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 74 | --no-create-home \ |
| 75 | --shell /bin/false --user-group ntp" |
| 76 | |
| 77 | # NB: debug is default-enabled by NTP; keep it default-enabled here. |
| 78 | PACKAGECONFIG ??= "cap debug refclocks openssl \ |
| 79 | ${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)} \ |
| 80 | " |
| 81 | PACKAGECONFIG[openssl] = "--with-openssl-libdir=${STAGING_LIBDIR} \ |
| 82 | --with-openssl-incdir=${STAGING_INCDIR} \ |
| 83 | --with-crypto, \ |
| 84 | --without-openssl --without-crypto, \ |
| 85 | openssl" |
| 86 | PACKAGECONFIG[cap] = "--enable-linuxcaps,--disable-linuxcaps,libcap" |
| 87 | PACKAGECONFIG[readline] = "--with-lineeditlibs,--without-lineeditlibs,readline" |
| 88 | PACKAGECONFIG[refclocks] = "--enable-all-clocks,--disable-all-clocks,pps-tools" |
| 89 | PACKAGECONFIG[debug] = "--enable-debugging,--disable-debugging" |
| 90 | PACKAGECONFIG[mdns] = "ac_cv_header_dns_sd_h=yes,ac_cv_header_dns_sd_h=no,mdns" |
| 91 | PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6," |
| 92 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 93 | do_install:append() { |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 94 | install -d ${D}${sysconfdir}/init.d |
| 95 | install -m 644 ${WORKDIR}/ntp.conf ${D}${sysconfdir} |
| 96 | install -m 755 ${WORKDIR}/ntpd ${D}${sysconfdir}/init.d |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 97 | |
| 98 | install -m 755 -d ${D}${NTP_USER_HOME} |
| 99 | chown ntp:ntp ${D}${NTP_USER_HOME} |
| 100 | |
| 101 | # Fix hardcoded paths in scripts |
Andrew Geissler | fc113ea | 2023-03-31 09:59:46 -0500 | [diff] [blame] | 102 | sed -i 's!/usr/sbin/!${sbindir}/!g' ${D}${sysconfdir}/init.d/ntpd |
| 103 | sed -i 's!/usr/bin/!${bindir}/!g' ${D}${sysconfdir}/init.d/ntpd |
| 104 | sed -i 's!/etc/!${sysconfdir}/!g' ${D}${sysconfdir}/init.d/ntpd |
| 105 | sed -i 's!/var/!${localstatedir}/!g' ${D}${sysconfdir}/init.d/ntpd |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 106 | sed -i '1s,#!.*perl -w,#! ${bindir}/env perl,' ${D}${sbindir}/ntptrace |
| 107 | sed -i '/use/i use warnings;' ${D}${sbindir}/ntptrace |
| 108 | sed -i '1s,#!.*perl,#! ${bindir}/env perl,' ${D}${sbindir}/ntp-wait |
| 109 | sed -i '/use/i use warnings;' ${D}${sbindir}/ntp-wait |
| 110 | sed -i '1s,#!.*perl -w,#! ${bindir}/env perl,' ${D}${sbindir}/calc_tickadj |
| 111 | sed -i '/use/i use warnings;' ${D}${sbindir}/calc_tickadj |
| 112 | |
| 113 | install -d ${D}/${sysconfdir}/default |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 114 | install -m 0644 ${WORKDIR}/sntp ${D}${sysconfdir}/default/ |
| 115 | |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 116 | install -d ${D}${systemd_unitdir}/system |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 117 | install -m 0644 ${WORKDIR}/ntpd.service ${D}${systemd_unitdir}/system/ |
| 118 | install -m 0644 ${WORKDIR}/sntp.service ${D}${systemd_unitdir}/system/ |
| 119 | |
| 120 | install -d ${D}${systemd_unitdir}/ntp-units.d |
| 121 | install -m 0644 ${WORKDIR}/ntpd.list ${D}${systemd_unitdir}/ntp-units.d/60-ntpd.list |
| 122 | |
Andrew Geissler | fc113ea | 2023-03-31 09:59:46 -0500 | [diff] [blame] | 123 | # Remove the empty libexecdir and bindir. |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 124 | rmdir --ignore-fail-on-non-empty ${D}${libexecdir} |
Andrew Geissler | fc113ea | 2023-03-31 09:59:46 -0500 | [diff] [blame] | 125 | rmdir --ignore-fail-on-non-empty ${D}${bindir} |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 126 | } |
| 127 | |
Andrew Geissler | fc113ea | 2023-03-31 09:59:46 -0500 | [diff] [blame] | 128 | PACKAGES += "sntp ntpdc ntpq ${PN}-tickadj ${PN}-utils" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 129 | |
| 130 | # ntp originally includes tickadj. It's split off for inclusion in small firmware images on platforms |
| 131 | # with wonky clocks (e.g. OpenSlug) |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 132 | RDEPENDS:${PN} = "${PN}-tickadj" |
Andrew Geissler | 87f5cff | 2022-09-30 13:13:31 -0500 | [diff] [blame] | 133 | # ntpd & sntp require libgcc for execution due to phtread_cancel/pthread_exit calls |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 134 | RDEPENDS:${PN} += "libgcc" |
Andrew Geissler | 87f5cff | 2022-09-30 13:13:31 -0500 | [diff] [blame] | 135 | RDEPENDS:sntp += "libgcc" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 136 | # Handle move from bin to utils package |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 137 | RPROVIDES:${PN}-utils = "${PN}-bin" |
| 138 | RREPLACES:${PN}-utils = "${PN}-bin" |
| 139 | RCONFLICTS:${PN}-utils = "${PN}-bin" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 140 | # ntpdc and ntpq were split out of ntp-utils |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 141 | RDEPENDS:${PN}-utils = "ntpdc ntpq" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 142 | |
Andrew Geissler | fc113ea | 2023-03-31 09:59:46 -0500 | [diff] [blame] | 143 | SYSTEMD_PACKAGES = "${PN} sntp" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 144 | SYSTEMD_SERVICE:${PN} = "ntpd.service" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 145 | SYSTEMD_SERVICE:sntp = "sntp.service" |
| 146 | SYSTEMD_AUTO_ENABLE:sntp = "disable" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 147 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 148 | RPROVIDES:${PN} += "${PN}-systemd" |
| 149 | RREPLACES:${PN} += "${PN}-systemd" |
| 150 | RCONFLICTS:${PN} += "${PN}-systemd" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 151 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 152 | RSUGGESTS:${PN} = "iana-etc" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 153 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 154 | FILES:${PN} = "${sbindir}/ntpd.ntp ${sysconfdir}/ntp.conf ${sysconfdir}/init.d/ntpd \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 155 | ${NTP_USER_HOME} \ |
| 156 | ${systemd_unitdir}/ntp-units.d/60-ntpd.list \ |
| 157 | " |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 158 | FILES:${PN}-tickadj = "${sbindir}/tickadj" |
| 159 | FILES:${PN}-utils = "${sbindir} ${datadir}/ntp/lib" |
| 160 | RDEPENDS:${PN}-utils += "perl" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 161 | FILES:sntp = "${sbindir}/sntp \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 162 | ${sysconfdir}/default/sntp \ |
| 163 | ${systemd_unitdir}/system/sntp.service \ |
| 164 | " |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 165 | FILES:ntpdc = "${sbindir}/ntpdc" |
| 166 | FILES:ntpq = "${sbindir}/ntpq" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 167 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 168 | CONFFILES:${PN} = "${sysconfdir}/ntp.conf" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 169 | |
| 170 | INITSCRIPT_NAME = "ntpd" |
| 171 | # No dependencies, so just go in at the standard level (20) |
| 172 | INITSCRIPT_PARAMS = "defaults" |
| 173 | |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 174 | inherit update-alternatives |
| 175 | |
| 176 | ALTERNATIVE_PRIORITY = "100" |
| 177 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 178 | ALTERNATIVE:${PN} = "ntpd" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 179 | ALTERNATIVE_LINK_NAME[ntpd] = "${sbindir}/ntpd" |