1SUMMARY = "Network Time Protocol daemon and utilities" 2DESCRIPTION = "The Network Time Protocol (NTP) is used to \ 3synchronize the time of a computer client or server to \ 4another server or reference time source, such as a radio \ 5or satellite receiver or modem." 6HOMEPAGE = "http://support.ntp.org" 7SECTION = "net" 8LICENSE = "NTP" 9LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=4190b39435611e92a4da74e682623f19" 10 11DEPENDS = "libevent" 12 13SRC_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 \ 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 \ 18 file://ntpd \ 19 file://ntp.conf \ 20 file://ntpdate \ 21 file://ntpdate.default \ 22 file://ntpdate.service \ 23 file://ntpd.service \ 24 file://sntp.service \ 25 file://sntp \ 26 file://ntpd.list \ 27" 28 29SRC_URI[sha256sum] = "f65840deab68614d5d7ceb2d0bb9304ff70dcdedd09abb79754a87536b849c19" 30 31# CVE-2016-9312 is only for windows. 32# CVE-2019-11331 is inherent to RFC 5905 and cannot be fixed without breaking compatibility 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) 35CVE_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 CVE-2019-11331 \ 57" 58 59 60inherit autotools update-rc.d useradd systemd pkgconfig 61 62# The ac_cv_header_readline_history is to stop ntpdc depending on either 63# readline or curses 64EXTRA_OECONF += "--with-net-snmp-config=no \ 65 --without-ntpsnmpd \ 66 ac_cv_header_readline_history_h=no \ 67 --with-yielding_select=yes \ 68 --with-locfile=redhat \ 69 --without-rpath \ 70 " 71CFLAGS:append = " -DPTYS_ARE_GETPT -DPTYS_ARE_SEARCHED" 72 73USERADD_PACKAGES = "${PN}" 74NTP_USER_HOME ?= "/var/lib/ntp" 75USERADD_PARAM:${PN} = "--system --home-dir ${NTP_USER_HOME} \ 76 --no-create-home \ 77 --shell /bin/false --user-group ntp" 78 79# NB: debug is default-enabled by NTP; keep it default-enabled here. 80PACKAGECONFIG ??= "cap debug refclocks openssl \ 81 ${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)} \ 82" 83PACKAGECONFIG[openssl] = "--with-openssl-libdir=${STAGING_LIBDIR} \ 84 --with-openssl-incdir=${STAGING_INCDIR} \ 85 --with-crypto, \ 86 --without-openssl --without-crypto, \ 87 openssl" 88PACKAGECONFIG[cap] = "--enable-linuxcaps,--disable-linuxcaps,libcap" 89PACKAGECONFIG[readline] = "--with-lineeditlibs,--without-lineeditlibs,readline" 90PACKAGECONFIG[refclocks] = "--enable-all-clocks,--disable-all-clocks,pps-tools" 91PACKAGECONFIG[debug] = "--enable-debugging,--disable-debugging" 92PACKAGECONFIG[mdns] = "ac_cv_header_dns_sd_h=yes,ac_cv_header_dns_sd_h=no,mdns" 93PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6," 94 95do_install:append() { 96 install -d ${D}${sysconfdir}/init.d 97 install -m 644 ${WORKDIR}/ntp.conf ${D}${sysconfdir} 98 install -m 755 ${WORKDIR}/ntpd ${D}${sysconfdir}/init.d 99 install -d ${D}${bindir} 100 install -m 755 ${WORKDIR}/ntpdate ${D}${bindir}/ntpdate-sync 101 102 install -m 755 -d ${D}${NTP_USER_HOME} 103 chown ntp:ntp ${D}${NTP_USER_HOME} 104 105 # Fix hardcoded paths in scripts 106 sed -i 's!/usr/sbin/!${sbindir}/!g' ${D}${sysconfdir}/init.d/ntpd ${D}${bindir}/ntpdate-sync 107 sed -i 's!/usr/bin/!${bindir}/!g' ${D}${sysconfdir}/init.d/ntpd ${D}${bindir}/ntpdate-sync 108 sed -i 's!/etc/!${sysconfdir}/!g' ${D}${sysconfdir}/init.d/ntpd ${D}${bindir}/ntpdate-sync 109 sed -i 's!/var/!${localstatedir}/!g' ${D}${sysconfdir}/init.d/ntpd ${D}${bindir}/ntpdate-sync 110 sed -i 's!^PATH=.*!PATH=${base_sbindir}:${base_bindir}:${sbindir}:${bindir}!' ${D}${bindir}/ntpdate-sync 111 sed -i '1s,#!.*perl -w,#! ${bindir}/env perl,' ${D}${sbindir}/ntptrace 112 sed -i '/use/i use warnings;' ${D}${sbindir}/ntptrace 113 sed -i '1s,#!.*perl,#! ${bindir}/env perl,' ${D}${sbindir}/ntp-wait 114 sed -i '/use/i use warnings;' ${D}${sbindir}/ntp-wait 115 sed -i '1s,#!.*perl -w,#! ${bindir}/env perl,' ${D}${sbindir}/calc_tickadj 116 sed -i '/use/i use warnings;' ${D}${sbindir}/calc_tickadj 117 118 install -d ${D}/${sysconfdir}/default 119 install -m 644 ${WORKDIR}/ntpdate.default ${D}${sysconfdir}/default/ntpdate 120 install -m 0644 ${WORKDIR}/sntp ${D}${sysconfdir}/default/ 121 122 install -d ${D}/${sysconfdir}/network/if-up.d 123 ln -s ${bindir}/ntpdate-sync ${D}/${sysconfdir}/network/if-up.d 124 125 install -d ${D}${systemd_unitdir}/system 126 install -m 0644 ${WORKDIR}/ntpdate.service ${D}${systemd_unitdir}/system/ 127 install -m 0644 ${WORKDIR}/ntpd.service ${D}${systemd_unitdir}/system/ 128 install -m 0644 ${WORKDIR}/sntp.service ${D}${systemd_unitdir}/system/ 129 130 install -d ${D}${systemd_unitdir}/ntp-units.d 131 install -m 0644 ${WORKDIR}/ntpd.list ${D}${systemd_unitdir}/ntp-units.d/60-ntpd.list 132 133 # Remove an empty libexecdir. 134 rmdir --ignore-fail-on-non-empty ${D}${libexecdir} 135} 136 137PACKAGES += "ntpdate sntp ntpdc ntpq ${PN}-tickadj ${PN}-utils" 138# NOTE: you don't need ntpdate, use "ntpd -q -g -x" 139 140# ntp originally includes tickadj. It's split off for inclusion in small firmware images on platforms 141# with wonky clocks (e.g. OpenSlug) 142RDEPENDS:${PN} = "${PN}-tickadj" 143# ntpd require libgcc for execution 144RDEPENDS:${PN} += "libgcc" 145# Handle move from bin to utils package 146RPROVIDES:${PN}-utils = "${PN}-bin" 147RREPLACES:${PN}-utils = "${PN}-bin" 148RCONFLICTS:${PN}-utils = "${PN}-bin" 149# ntpdc and ntpq were split out of ntp-utils 150RDEPENDS:${PN}-utils = "ntpdc ntpq" 151 152SYSTEMD_PACKAGES = "${PN} ntpdate sntp" 153SYSTEMD_SERVICE:${PN} = "ntpd.service" 154SYSTEMD_SERVICE:ntpdate = "ntpdate.service" 155SYSTEMD_SERVICE:sntp = "sntp.service" 156SYSTEMD_AUTO_ENABLE:sntp = "disable" 157 158RPROVIDES:${PN} += "${PN}-systemd" 159RREPLACES:${PN} += "${PN}-systemd" 160RCONFLICTS:${PN} += "${PN}-systemd" 161 162RPROVIDES:ntpdate += "ntpdate-systemd" 163RREPLACES:ntpdate += "ntpdate-systemd" 164RCONFLICTS:ntpdate += "ntpdate-systemd" 165 166RSUGGESTS:${PN} = "iana-etc" 167 168FILES:${PN} = "${sbindir}/ntpd.ntp ${sysconfdir}/ntp.conf ${sysconfdir}/init.d/ntpd \ 169 ${NTP_USER_HOME} \ 170 ${systemd_unitdir}/ntp-units.d/60-ntpd.list \ 171" 172FILES:${PN}-tickadj = "${sbindir}/tickadj" 173FILES:${PN}-utils = "${sbindir} ${datadir}/ntp/lib" 174RDEPENDS:${PN}-utils += "perl" 175FILES:ntpdate = "${sbindir}/ntpdate \ 176 ${sysconfdir}/network/if-up.d/ntpdate-sync \ 177 ${bindir}/ntpdate-sync \ 178 ${sysconfdir}/default/ntpdate \ 179 ${systemd_unitdir}/system/ntpdate.service \ 180" 181FILES:sntp = "${sbindir}/sntp \ 182 ${sysconfdir}/default/sntp \ 183 ${systemd_unitdir}/system/sntp.service \ 184 " 185FILES:ntpdc = "${sbindir}/ntpdc" 186FILES:ntpq = "${sbindir}/ntpq" 187 188CONFFILES:${PN} = "${sysconfdir}/ntp.conf" 189CONFFILES:ntpdate = "${sysconfdir}/default/ntpdate" 190 191INITSCRIPT_NAME = "ntpd" 192# No dependencies, so just go in at the standard level (20) 193INITSCRIPT_PARAMS = "defaults" 194 195pkg_postinst:ntpdate() { 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 203inherit update-alternatives 204 205ALTERNATIVE_PRIORITY = "100" 206 207ALTERNATIVE:${PN} = "ntpd" 208ALTERNATIVE_LINK_NAME[ntpd] = "${sbindir}/ntpd" 209