summaryrefslogtreecommitdiffstats
path: root/meta-networking/recipes-support/chrony/chrony_4.6.1.bb
diff options
context:
space:
mode:
Diffstat (limited to 'meta-networking/recipes-support/chrony/chrony_4.6.1.bb')
-rw-r--r--meta-networking/recipes-support/chrony/chrony_4.6.1.bb141
1 files changed, 141 insertions, 0 deletions
diff --git a/meta-networking/recipes-support/chrony/chrony_4.6.1.bb b/meta-networking/recipes-support/chrony/chrony_4.6.1.bb
new file mode 100644
index 0000000000..5ac3e6d37e
--- /dev/null
+++ b/meta-networking/recipes-support/chrony/chrony_4.6.1.bb
@@ -0,0 +1,141 @@
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://chrony-project.org/releases/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] = "571ff73fbf0ae3097f0604eca2e00b1d8bb2e91affe1a3494785ff21d6199c5c"
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_defer ${@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 /sbin/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,"
70PACKAGECONFIG[nts] = ",--disable-nts,gnutls"
71
72# --disable-static isn't supported by chrony's configure script.
73DISABLE_STATIC = ""
74
75do_configure() {
76 ./configure --sysconfdir=${sysconfdir} --bindir=${bindir} --sbindir=${sbindir} \
77 --localstatedir=${localstatedir} --datarootdir=${datadir} \
78 --with-ntp-era=$(shell date -d '1970-01-01 00:00:00+00:00' +'%s') \
79 --with-pidfile=/run/chrony/chronyd.pid \
80 --chronyrundir=/run/chrony \
81 --host-system=Linux \
82 ${PACKAGECONFIG_CONFARGS}
83}
84
85do_install() {
86 # Binaries
87 install -d ${D}${bindir}
88 install -m 0755 ${S}/chronyc ${D}${bindir}
89 install -d ${D}${sbindir}
90 install -m 0755 ${S}/chronyd ${D}${sbindir}
91
92 # Config file
93 install -d ${D}${sysconfdir}
94 install -m 644 ${UNPACKDIR}/chrony.conf ${D}${sysconfdir}
95 if ${@bb.utils.contains('PACKAGECONFIG', 'privdrop', 'true', 'false', d)}; then
96 echo "# Define user to drop to after dropping root privileges" >> ${D}${sysconfdir}/chrony.conf
97 echo "user chronyd" >> ${D}${sysconfdir}/chrony.conf
98 fi
99
100 # System V init script
101 install -d ${D}${sysconfdir}/init.d
102 install -m 755 ${UNPACKDIR}/chronyd ${D}${sysconfdir}/init.d
103
104 # systemd unit configuration file
105 install -d ${D}${systemd_unitdir}/system
106 install -m 0644 ${S}/examples/chronyd.service ${D}${systemd_unitdir}/system/
107
108 # Variable data (for drift and/or rtc file)
109 install -d ${D}${localstatedir}/lib/chrony
110
111 # Fix hard-coded paths in config files and init scripts
112 sed -i -e 's!/var/!${localstatedir}/!g' -e 's!/etc/!${sysconfdir}/!g' \
113 -e 's!/usr/sbin/!${sbindir}/!g' -e 's!/usr/bin/!${bindir}/!g' \
114 ${D}${sysconfdir}/chrony.conf \
115 ${D}${sysconfdir}/init.d/chronyd \
116 ${D}${systemd_unitdir}/system/chronyd.service
117 sed -i 's!^PATH=.*!PATH=${base_sbindir}:${base_bindir}:${sbindir}:${bindir}!' ${D}${sysconfdir}/init.d/chronyd
118 sed -i 's!^EnvironmentFile=.*!EnvironmentFile=-${sysconfdir}/default/chronyd!' ${D}${systemd_unitdir}/system/chronyd.service
119
120 install -d ${D}${sysconfdir}/tmpfiles.d
121 echo "d /var/lib/chrony 0755 root root -" > ${D}${sysconfdir}/tmpfiles.d/chronyd.conf
122
123}
124
125FILES:${PN} = "${sbindir}/chronyd ${sysconfdir} ${localstatedir}/lib/chrony ${localstatedir}"
126CONFFILES:${PN} = "${sysconfdir}/chrony.conf"
127INITSCRIPT_NAME = "chronyd"
128INITSCRIPT_PARAMS = "defaults"
129SYSTEMD_PACKAGES = "${PN}"
130SYSTEMD_SERVICE:${PN} = "chronyd.service"
131
132# It's probably a bad idea to run chrony and another time daemon on
133# the same system. systemd includes the SNTP client 'timesyncd', which
134# will be disabled by chronyd.service, however it will remain on the rootfs
135# wasting 150 kB unless you put 'PACKAGECONFIG:remove:pn-systemd = "timesyncd"'
136# in a conf file or bbappend somewhere.
137RCONFLICTS:${PN} = "ntp ntimed"
138
139# Separate the client program into its own package
140PACKAGES =+ "chronyc"
141FILES:chronyc = "${bindir}/chronyc"