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 \ |
| 21 | file://ntpdate \ |
| 22 | file://ntpdate.default \ |
| 23 | file://ntpdate.service \ |
| 24 | file://ntpd.service \ |
| 25 | file://sntp.service \ |
| 26 | file://sntp \ |
| 27 | file://ntpd.list \ |
| 28 | " |
| 29 | |
Andrew Geissler | c87764f | 2020-06-27 00:16:32 -0500 | [diff] [blame] | 30 | SRC_URI[sha256sum] = "f65840deab68614d5d7ceb2d0bb9304ff70dcdedd09abb79754a87536b849c19" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 31 | |
Andrew Geissler | 6972109 | 2021-07-23 12:57:00 -0400 | [diff] [blame] | 32 | # CVE-2016-9312 is only for windows. |
Andrew Geissler | 615f2f1 | 2022-07-15 14:00:58 -0500 | [diff] [blame] | 33 | # The other CVEs are not correctly identified because cve-check |
| 34 | # is not able to check the version correctly (it only checks for 4.2.8 omitting p15 that makes the difference) |
| 35 | CVE_CHECK_IGNORE += "\ |
| 36 | CVE-2016-9312 \ |
| 37 | CVE-2015-5146 \ |
| 38 | CVE-2015-5300 \ |
| 39 | CVE-2015-7975 \ |
| 40 | CVE-2015-7976 \ |
| 41 | CVE-2015-7977 \ |
| 42 | CVE-2015-7978 \ |
| 43 | CVE-2015-7979 \ |
| 44 | CVE-2015-8138 \ |
| 45 | CVE-2015-8139 \ |
| 46 | CVE-2015-8140 \ |
| 47 | CVE-2015-8158 \ |
| 48 | CVE-2016-1547 \ |
| 49 | CVE-2016-2516 \ |
| 50 | CVE-2016-2517 \ |
| 51 | CVE-2016-2519 \ |
| 52 | CVE-2016-7429 \ |
| 53 | CVE-2016-7433 \ |
| 54 | CVE-2016-9310 \ |
| 55 | CVE-2016-9311 \ |
| 56 | " |
| 57 | |
Andrew Geissler | 6972109 | 2021-07-23 12:57:00 -0400 | [diff] [blame] | 58 | |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 59 | inherit autotools update-rc.d useradd systemd pkgconfig |
| 60 | |
| 61 | # The ac_cv_header_readline_history is to stop ntpdc depending on either |
| 62 | # readline or curses |
| 63 | EXTRA_OECONF += "--with-net-snmp-config=no \ |
| 64 | --without-ntpsnmpd \ |
| 65 | ac_cv_header_readline_history_h=no \ |
| 66 | --with-yielding_select=yes \ |
| 67 | --with-locfile=redhat \ |
| 68 | --without-rpath \ |
| 69 | " |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 70 | CFLAGS:append = " -DPTYS_ARE_GETPT -DPTYS_ARE_SEARCHED" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 71 | |
| 72 | USERADD_PACKAGES = "${PN}" |
| 73 | NTP_USER_HOME ?= "/var/lib/ntp" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 74 | USERADD_PARAM:${PN} = "--system --home-dir ${NTP_USER_HOME} \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 75 | --no-create-home \ |
| 76 | --shell /bin/false --user-group ntp" |
| 77 | |
| 78 | # NB: debug is default-enabled by NTP; keep it default-enabled here. |
| 79 | PACKAGECONFIG ??= "cap debug refclocks openssl \ |
| 80 | ${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)} \ |
| 81 | " |
| 82 | PACKAGECONFIG[openssl] = "--with-openssl-libdir=${STAGING_LIBDIR} \ |
| 83 | --with-openssl-incdir=${STAGING_INCDIR} \ |
| 84 | --with-crypto, \ |
| 85 | --without-openssl --without-crypto, \ |
| 86 | openssl" |
| 87 | PACKAGECONFIG[cap] = "--enable-linuxcaps,--disable-linuxcaps,libcap" |
| 88 | PACKAGECONFIG[readline] = "--with-lineeditlibs,--without-lineeditlibs,readline" |
| 89 | PACKAGECONFIG[refclocks] = "--enable-all-clocks,--disable-all-clocks,pps-tools" |
| 90 | PACKAGECONFIG[debug] = "--enable-debugging,--disable-debugging" |
| 91 | PACKAGECONFIG[mdns] = "ac_cv_header_dns_sd_h=yes,ac_cv_header_dns_sd_h=no,mdns" |
| 92 | PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6," |
| 93 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 94 | do_install:append() { |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 95 | install -d ${D}${sysconfdir}/init.d |
| 96 | install -m 644 ${WORKDIR}/ntp.conf ${D}${sysconfdir} |
| 97 | install -m 755 ${WORKDIR}/ntpd ${D}${sysconfdir}/init.d |
| 98 | install -d ${D}${bindir} |
| 99 | install -m 755 ${WORKDIR}/ntpdate ${D}${bindir}/ntpdate-sync |
| 100 | |
| 101 | install -m 755 -d ${D}${NTP_USER_HOME} |
| 102 | chown ntp:ntp ${D}${NTP_USER_HOME} |
| 103 | |
| 104 | # Fix hardcoded paths in scripts |
| 105 | sed -i 's!/usr/sbin/!${sbindir}/!g' ${D}${sysconfdir}/init.d/ntpd ${D}${bindir}/ntpdate-sync |
| 106 | sed -i 's!/usr/bin/!${bindir}/!g' ${D}${sysconfdir}/init.d/ntpd ${D}${bindir}/ntpdate-sync |
| 107 | sed -i 's!/etc/!${sysconfdir}/!g' ${D}${sysconfdir}/init.d/ntpd ${D}${bindir}/ntpdate-sync |
| 108 | sed -i 's!/var/!${localstatedir}/!g' ${D}${sysconfdir}/init.d/ntpd ${D}${bindir}/ntpdate-sync |
| 109 | sed -i 's!^PATH=.*!PATH=${base_sbindir}:${base_bindir}:${sbindir}:${bindir}!' ${D}${bindir}/ntpdate-sync |
| 110 | sed -i '1s,#!.*perl -w,#! ${bindir}/env perl,' ${D}${sbindir}/ntptrace |
| 111 | sed -i '/use/i use warnings;' ${D}${sbindir}/ntptrace |
| 112 | sed -i '1s,#!.*perl,#! ${bindir}/env perl,' ${D}${sbindir}/ntp-wait |
| 113 | sed -i '/use/i use warnings;' ${D}${sbindir}/ntp-wait |
| 114 | sed -i '1s,#!.*perl -w,#! ${bindir}/env perl,' ${D}${sbindir}/calc_tickadj |
| 115 | sed -i '/use/i use warnings;' ${D}${sbindir}/calc_tickadj |
| 116 | |
| 117 | install -d ${D}/${sysconfdir}/default |
| 118 | install -m 644 ${WORKDIR}/ntpdate.default ${D}${sysconfdir}/default/ntpdate |
| 119 | install -m 0644 ${WORKDIR}/sntp ${D}${sysconfdir}/default/ |
| 120 | |
| 121 | install -d ${D}/${sysconfdir}/network/if-up.d |
| 122 | ln -s ${bindir}/ntpdate-sync ${D}/${sysconfdir}/network/if-up.d |
| 123 | |
| 124 | install -d ${D}${systemd_unitdir}/system |
| 125 | install -m 0644 ${WORKDIR}/ntpdate.service ${D}${systemd_unitdir}/system/ |
| 126 | install -m 0644 ${WORKDIR}/ntpd.service ${D}${systemd_unitdir}/system/ |
| 127 | install -m 0644 ${WORKDIR}/sntp.service ${D}${systemd_unitdir}/system/ |
| 128 | |
| 129 | install -d ${D}${systemd_unitdir}/ntp-units.d |
| 130 | install -m 0644 ${WORKDIR}/ntpd.list ${D}${systemd_unitdir}/ntp-units.d/60-ntpd.list |
| 131 | |
| 132 | # Remove an empty libexecdir. |
| 133 | rmdir --ignore-fail-on-non-empty ${D}${libexecdir} |
| 134 | } |
| 135 | |
| 136 | PACKAGES += "ntpdate sntp ntpdc ntpq ${PN}-tickadj ${PN}-utils" |
| 137 | # NOTE: you don't need ntpdate, use "ntpd -q -g -x" |
| 138 | |
| 139 | # ntp originally includes tickadj. It's split off for inclusion in small firmware images on platforms |
| 140 | # with wonky clocks (e.g. OpenSlug) |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 141 | RDEPENDS:${PN} = "${PN}-tickadj" |
Andrew Geissler | 87f5cff | 2022-09-30 13:13:31 -0500 | [diff] [blame] | 142 | # 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] | 143 | RDEPENDS:${PN} += "libgcc" |
Andrew Geissler | 87f5cff | 2022-09-30 13:13:31 -0500 | [diff] [blame] | 144 | RDEPENDS:sntp += "libgcc" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 145 | # Handle move from bin to utils package |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 146 | RPROVIDES:${PN}-utils = "${PN}-bin" |
| 147 | RREPLACES:${PN}-utils = "${PN}-bin" |
| 148 | RCONFLICTS:${PN}-utils = "${PN}-bin" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 149 | # ntpdc and ntpq were split out of ntp-utils |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 150 | RDEPENDS:${PN}-utils = "ntpdc ntpq" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 151 | |
| 152 | SYSTEMD_PACKAGES = "${PN} ntpdate sntp" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 153 | SYSTEMD_SERVICE:${PN} = "ntpd.service" |
| 154 | SYSTEMD_SERVICE:ntpdate = "ntpdate.service" |
| 155 | SYSTEMD_SERVICE:sntp = "sntp.service" |
| 156 | SYSTEMD_AUTO_ENABLE:sntp = "disable" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 157 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 158 | RPROVIDES:${PN} += "${PN}-systemd" |
| 159 | RREPLACES:${PN} += "${PN}-systemd" |
| 160 | RCONFLICTS:${PN} += "${PN}-systemd" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 161 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 162 | RPROVIDES:ntpdate += "ntpdate-systemd" |
| 163 | RREPLACES:ntpdate += "ntpdate-systemd" |
| 164 | RCONFLICTS:ntpdate += "ntpdate-systemd" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 165 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 166 | RSUGGESTS:${PN} = "iana-etc" |
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 | FILES:${PN} = "${sbindir}/ntpd.ntp ${sysconfdir}/ntp.conf ${sysconfdir}/init.d/ntpd \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 169 | ${NTP_USER_HOME} \ |
| 170 | ${systemd_unitdir}/ntp-units.d/60-ntpd.list \ |
| 171 | " |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 172 | FILES:${PN}-tickadj = "${sbindir}/tickadj" |
| 173 | FILES:${PN}-utils = "${sbindir} ${datadir}/ntp/lib" |
| 174 | RDEPENDS:${PN}-utils += "perl" |
| 175 | FILES:ntpdate = "${sbindir}/ntpdate \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 176 | ${sysconfdir}/network/if-up.d/ntpdate-sync \ |
| 177 | ${bindir}/ntpdate-sync \ |
| 178 | ${sysconfdir}/default/ntpdate \ |
| 179 | ${systemd_unitdir}/system/ntpdate.service \ |
| 180 | " |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 181 | FILES:sntp = "${sbindir}/sntp \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 182 | ${sysconfdir}/default/sntp \ |
| 183 | ${systemd_unitdir}/system/sntp.service \ |
| 184 | " |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 185 | FILES:ntpdc = "${sbindir}/ntpdc" |
| 186 | FILES:ntpq = "${sbindir}/ntpq" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 187 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 188 | CONFFILES:${PN} = "${sysconfdir}/ntp.conf" |
| 189 | CONFFILES:ntpdate = "${sysconfdir}/default/ntpdate" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 190 | |
| 191 | INITSCRIPT_NAME = "ntpd" |
| 192 | # No dependencies, so just go in at the standard level (20) |
| 193 | INITSCRIPT_PARAMS = "defaults" |
| 194 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 195 | pkg_postinst:ntpdate() { |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 196 | if ! grep -q -s ntpdate $D/var/spool/cron/root; then |
| 197 | echo "adding crontab" |
| 198 | test -d $D/var/spool/cron || mkdir -p $D/var/spool/cron |
| 199 | echo "30 * * * * ${bindir}/ntpdate-sync silent" >> $D/var/spool/cron/root |
| 200 | fi |
| 201 | } |
| 202 | |
| 203 | inherit update-alternatives |
| 204 | |
| 205 | ALTERNATIVE_PRIORITY = "100" |
| 206 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 207 | ALTERNATIVE:${PN} = "ntpd" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 208 | ALTERNATIVE_LINK_NAME[ntpd] = "${sbindir}/ntpd" |