blob: 2586370fa74186749c4fff3b0b17a13076057edc [file] [log] [blame]
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08001SUMMARY = "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 = "GPLv2"
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"
38SRC_URI[md5sum] = "81ab62cf5d60b4b3fa8cd2c1b267ffd9"
39SRC_URI[sha256sum] = "0d1fb2d5875032f2d5a86f3770374c87ee4c941916f64171e81f7684f2a73128"
40
41DEPENDS = "pps-tools"
42
43# Note: Despite being built via './configure; make; make install',
44# chrony does not use GNU Autotools.
45inherit update-rc.d systemd
46
47# Configuration options:
48# - For command line editing support in chronyc, you may specify either
49# 'editline' or 'readline' but not both. editline is smaller, but
50# many systems already have readline for other purposes so you might want
51# to choose that instead. However, beware license incompatibility
52# since chrony is GPLv2 and readline versions after 6.0 are GPLv3+.
53# You can of course choose neither, but if you're that tight on space
54# consider dropping chronyc entirely (you can use it remotely with
55# appropriate chrony.conf 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[readline] = "--without-editline,--without-readline,readline"
66PACKAGECONFIG[editline] = ",--without-editline,libedit"
67PACKAGECONFIG[sechash] = "--without-tomcrypt,--disable-sechash,nss"
68PACKAGECONFIG[privdrop] = ",--disable-privdrop,libcap"
69PACKAGECONFIG[scfilter] = "--enable-scfilter,--without-seccomp,libseccomp"
70PACKAGECONFIG[ipv6] = ",--disable-ipv6,"
71PACKAGECONFIG[nss] = "--with-nss,--without-nss,nss"
72PACKAGECONFIG[libcap] = "--with-libcap,--without-libcap,libcap"
73
74# --disable-static isn't supported by chrony's configure script.
75DISABLE_STATIC = ""
76
77do_configure() {
78 ./configure --sysconfdir=${sysconfdir} --bindir=${bindir} --sbindir=${sbindir} \
79 --localstatedir=${localstatedir} --datarootdir=${datadir} \
80 ${PACKAGECONFIG_CONFARGS}
81}
82
83do_install() {
84 # Binaries
85 install -d ${D}${bindir}
86 install -m 0755 ${S}/chronyc ${D}${bindir}
87 install -d ${D}${sbindir}
88 install -m 0755 ${S}/chronyd ${D}${sbindir}
89
90 # Config file
91 install -d ${D}${sysconfdir}
92 install -m 644 ${WORKDIR}/chrony.conf ${D}${sysconfdir}
93
94 # System V init script
95 install -d ${D}${sysconfdir}/init.d
96 install -m 755 ${WORKDIR}/chronyd ${D}${sysconfdir}/init.d
97
98 # systemd unit configuration file
99 install -d ${D}${systemd_unitdir}/system
100 install -m 0644 ${S}/examples/chronyd.service ${D}${systemd_unitdir}/system/
101
102 # Variable data (for drift and/or rtc file)
103 install -d ${D}${localstatedir}/lib/chrony
104
105 # Log files
106 install -d ${D}${localstatedir}/log/chrony
107
108 # Fix hard-coded paths in config files and init scripts
109 sed -i -e 's!/var/!${localstatedir}/!g' -e 's!/etc/!${sysconfdir}/!g' \
110 -e 's!/usr/sbin/!${sbindir}/!g' -e 's!/usr/bin/!${bindir}/!g' \
111 ${D}${sysconfdir}/chrony.conf \
112 ${D}${sysconfdir}/init.d/chronyd \
113 ${D}${systemd_unitdir}/system/chronyd.service
114 sed -i 's!^PATH=.*!PATH=${base_sbindir}:${base_bindir}:${sbindir}:${bindir}!' ${D}${sysconfdir}/init.d/chronyd
115 sed -i 's!^EnvironmentFile=.*!EnvironmentFile=-${sysconfdir}/default/chronyd!' ${D}${systemd_unitdir}/system/chronyd.service
116}
117
118FILES_${PN} = "${sbindir}/chronyd ${sysconfdir} ${localstatedir}"
119CONFFILES_${PN} = "${sysconfdir}/chrony.conf"
120INITSCRIPT_NAME = "chronyd"
121INITSCRIPT_PARAMS = "defaults"
122SYSTEMD_PACKAGES = "${PN}"
123SYSTEMD_SERVICE_${PN} = "chronyd.service"
124
125# It's probably a bad idea to run chrony and another time daemon on
126# the same system. systemd includes the SNTP client 'timesyncd', which
127# will be disabled by chronyd.service, however it will remain on the rootfs
128# wasting 150 kB unless you put 'PACKAGECONFIG_remove_pn-systemd = "timesyncd"'
129# in a conf file or bbappend somewhere.
130RCONFLICTS_${PN} = "ntp ntimed"
131
132# Separate the client program into its own package
133PACKAGES =+ "chronyc"
134FILES_chronyc = "${bindir}/chronyc"