1SUMMARY = "Versatile implementation of the Network Time Protocol" 2DESCRIPTION = "Chrony can synchronize the system clock with NTP \ 3servers, reference clocks (e.g. GPS receiver), and manual input using \ 4wristwatch and keyboard. It can also operate as an NTPv4 (RFC 5905) \ 5server and peer to provide a time service to other computers in the \ 6network. \ 7\ 8It is designed to perform well in a wide range of conditions, \ 9including intermittent network connections, heavily congested \ 10networks, changing temperatures (ordinary computer clocks are \ 11sensitive to temperature), and systems that do not run continuously, or \ 12run on a virtual machine. \ 13\ 14Typical accuracy between two machines on a LAN is in tens, or a few \ 15hundreds, of microseconds; over the Internet, accuracy is typically \ 16within a few milliseconds. With a good hardware reference clock \ 17sub-microsecond accuracy is possible. \ 18\ 19Two programs are included in chrony: chronyd is a daemon that can be \ 20started at boot time and chronyc is a command-line interface program \ 21which can be used to monitor chronyd's performance and to change \ 22various operating parameters whilst it is running. \ 23\ 24This recipe produces two binary packages: 'chrony' which contains chronyd, \ 25the configuration file and the init script, and 'chronyc' which contains \ 26the client program only." 27 28HOMEPAGE = "https://chrony.tuxfamily.org/" 29SECTION = "net" 30LICENSE = "GPL-2.0-only" 31LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe" 32 33SRC_URI = "https://download.tuxfamily.org/chrony/chrony-${PV}.tar.gz \ 34 file://chrony.conf \ 35 file://chronyd \ 36 file://arm_eabi.patch \ 37" 38 39SRC_URI:append:libc-musl = " \ 40 file://0001-Fix-compilation-with-musl.patch \ 41" 42SRC_URI[sha256sum] = "273f9fd15c328ed6f3a5f6ba6baec35a421a34a73bb725605329b1712048db9a" 43 44DEPENDS = "pps-tools" 45 46# Note: Despite being built via './configure; make; make install', 47# chrony does not use GNU Autotools. 48inherit update-rc.d systemd pkgconfig 49 50# Add chronyd user if privdrop packageconfig is selected 51inherit ${@bb.utils.contains('PACKAGECONFIG', 'privdrop', 'useradd', '', d)} 52USERADD_PACKAGES = "${@bb.utils.contains('PACKAGECONFIG', 'privdrop', '${PN}', '', d)}" 53USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'privdrop', '--system -d / -M --shell /bin/nologin chronyd;', '', d)}" 54 55# Configuration options: 56# - Security-related: 57# - 'sechash' is omitted by default because it pulls in nss which is huge. 58# - 'privdrop' allows chronyd to run as non-root; would need changes to 59# chrony.conf and init script. 60# - 'scfilter' enables support for system call filtering, but requires the 61# kernel to have CONFIG_SECCOMP enabled. 62PACKAGECONFIG ??= "editline \ 63 ${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)} \ 64" 65PACKAGECONFIG[editline] = ",--without-editline,libedit" 66PACKAGECONFIG[sechash] = "--without-tomcrypt,--disable-sechash,nss" 67PACKAGECONFIG[privdrop] = ",--disable-privdrop,libcap" 68PACKAGECONFIG[scfilter] = "--enable-scfilter,--without-seccomp,libseccomp" 69PACKAGECONFIG[ipv6] = ",--disable-ipv6," 70 71# These are left for backwards compatibility, to avoid breaking existing 72# configurations. 73PACKAGECONFIG[libcap] = "" 74PACKAGECONFIG[nss] = "" 75PACKAGECONFIG[readline] = "" 76 77# --disable-static isn't supported by chrony's configure script. 78DISABLE_STATIC = "" 79 80do_configure() { 81 ./configure --sysconfdir=${sysconfdir} --bindir=${bindir} --sbindir=${sbindir} \ 82 --localstatedir=${localstatedir} --datarootdir=${datadir} \ 83 --with-ntp-era=$(shell date -d '1970-01-01 00:00:00+00:00' +'%s') \ 84 --with-pidfile=/run/chrony/chronyd.pid \ 85 --chronyrundir=/run/chrony \ 86 --host-system=Linux \ 87 ${PACKAGECONFIG_CONFARGS} 88} 89 90do_install() { 91 # Binaries 92 install -d ${D}${bindir} 93 install -m 0755 ${S}/chronyc ${D}${bindir} 94 install -d ${D}${sbindir} 95 install -m 0755 ${S}/chronyd ${D}${sbindir} 96 97 # Config file 98 install -d ${D}${sysconfdir} 99 install -m 644 ${WORKDIR}/chrony.conf ${D}${sysconfdir} 100 if ${@bb.utils.contains('PACKAGECONFIG', 'privdrop', 'true', 'false', d)}; then 101 echo "# Define user to drop to after dropping root privileges" >> ${D}${sysconfdir}/chrony.conf 102 echo "user chronyd" >> ${D}${sysconfdir}/chrony.conf 103 fi 104 105 # System V init script 106 install -d ${D}${sysconfdir}/init.d 107 install -m 755 ${WORKDIR}/chronyd ${D}${sysconfdir}/init.d 108 109 # systemd unit configuration file 110 install -d ${D}${systemd_unitdir}/system 111 install -m 0644 ${S}/examples/chronyd.service ${D}${systemd_unitdir}/system/ 112 113 # Variable data (for drift and/or rtc file) 114 install -d ${D}${localstatedir}/lib/chrony 115 116 # Fix hard-coded paths in config files and init scripts 117 sed -i -e 's!/var/!${localstatedir}/!g' -e 's!/etc/!${sysconfdir}/!g' \ 118 -e 's!/usr/sbin/!${sbindir}/!g' -e 's!/usr/bin/!${bindir}/!g' \ 119 ${D}${sysconfdir}/chrony.conf \ 120 ${D}${sysconfdir}/init.d/chronyd \ 121 ${D}${systemd_unitdir}/system/chronyd.service 122 sed -i 's!^PATH=.*!PATH=${base_sbindir}:${base_bindir}:${sbindir}:${bindir}!' ${D}${sysconfdir}/init.d/chronyd 123 sed -i 's!^EnvironmentFile=.*!EnvironmentFile=-${sysconfdir}/default/chronyd!' ${D}${systemd_unitdir}/system/chronyd.service 124 125 install -d ${D}${sysconfdir}/tmpfiles.d 126 echo "d /var/lib/chrony 0755 root root -" > ${D}${sysconfdir}/tmpfiles.d/chronyd.conf 127 128} 129 130FILES:${PN} = "${sbindir}/chronyd ${sysconfdir} ${localstatedir}/lib/chrony ${localstatedir}" 131CONFFILES:${PN} = "${sysconfdir}/chrony.conf" 132INITSCRIPT_NAME = "chronyd" 133INITSCRIPT_PARAMS = "defaults" 134SYSTEMD_PACKAGES = "${PN}" 135SYSTEMD_SERVICE:${PN} = "chronyd.service" 136 137# It's probably a bad idea to run chrony and another time daemon on 138# the same system. systemd includes the SNTP client 'timesyncd', which 139# will be disabled by chronyd.service, however it will remain on the rootfs 140# wasting 150 kB unless you put 'PACKAGECONFIG:remove:pn-systemd = "timesyncd"' 141# in a conf file or bbappend somewhere. 142RCONFLICTS:${PN} = "ntp ntimed" 143 144# Separate the client program into its own package 145PACKAGES =+ "chronyc" 146FILES:chronyc = "${bindir}/chronyc" 147