diff options
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.bb | 141 |
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 @@ | |||
1 | SUMMARY = "Versatile implementation of the Network Time Protocol" | ||
2 | DESCRIPTION = "Chrony can synchronize the system clock with NTP \ | ||
3 | servers, reference clocks (e.g. GPS receiver), and manual input using \ | ||
4 | wristwatch and keyboard. It can also operate as an NTPv4 (RFC 5905) \ | ||
5 | server and peer to provide a time service to other computers in the \ | ||
6 | network. \ | ||
7 | \ | ||
8 | It is designed to perform well in a wide range of conditions, \ | ||
9 | including intermittent network connections, heavily congested \ | ||
10 | networks, changing temperatures (ordinary computer clocks are \ | ||
11 | sensitive to temperature), and systems that do not run continuously, or \ | ||
12 | run on a virtual machine. \ | ||
13 | \ | ||
14 | Typical accuracy between two machines on a LAN is in tens, or a few \ | ||
15 | hundreds, of microseconds; over the Internet, accuracy is typically \ | ||
16 | within a few milliseconds. With a good hardware reference clock \ | ||
17 | sub-microsecond accuracy is possible. \ | ||
18 | \ | ||
19 | Two programs are included in chrony: chronyd is a daemon that can be \ | ||
20 | started at boot time and chronyc is a command-line interface program \ | ||
21 | which can be used to monitor chronyd's performance and to change \ | ||
22 | various operating parameters whilst it is running. \ | ||
23 | \ | ||
24 | This recipe produces two binary packages: 'chrony' which contains chronyd, \ | ||
25 | the configuration file and the init script, and 'chronyc' which contains \ | ||
26 | the client program only." | ||
27 | |||
28 | HOMEPAGE = "https://chrony.tuxfamily.org/" | ||
29 | SECTION = "net" | ||
30 | LICENSE = "GPL-2.0-only" | ||
31 | LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe" | ||
32 | |||
33 | SRC_URI = "https://chrony-project.org/releases/chrony-${PV}.tar.gz \ | ||
34 | file://chrony.conf \ | ||
35 | file://chronyd \ | ||
36 | file://arm_eabi.patch \ | ||
37 | " | ||
38 | |||
39 | SRC_URI:append:libc-musl = " \ | ||
40 | file://0001-Fix-compilation-with-musl.patch \ | ||
41 | " | ||
42 | SRC_URI[sha256sum] = "571ff73fbf0ae3097f0604eca2e00b1d8bb2e91affe1a3494785ff21d6199c5c" | ||
43 | |||
44 | DEPENDS = "pps-tools" | ||
45 | |||
46 | # Note: Despite being built via './configure; make; make install', | ||
47 | # chrony does not use GNU Autotools. | ||
48 | inherit update-rc.d systemd pkgconfig | ||
49 | |||
50 | # Add chronyd user if privdrop packageconfig is selected | ||
51 | inherit_defer ${@bb.utils.contains('PACKAGECONFIG', 'privdrop', 'useradd', '', d)} | ||
52 | USERADD_PACKAGES = "${@bb.utils.contains('PACKAGECONFIG', 'privdrop', '${PN}', '', d)}" | ||
53 | USERADD_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. | ||
62 | PACKAGECONFIG ??= "editline \ | ||
63 | ${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)} \ | ||
64 | " | ||
65 | PACKAGECONFIG[editline] = ",--without-editline,libedit" | ||
66 | PACKAGECONFIG[sechash] = "--without-tomcrypt,--disable-sechash,nss" | ||
67 | PACKAGECONFIG[privdrop] = ",--disable-privdrop,libcap" | ||
68 | PACKAGECONFIG[scfilter] = "--enable-scfilter,--without-seccomp,libseccomp" | ||
69 | PACKAGECONFIG[ipv6] = ",--disable-ipv6," | ||
70 | PACKAGECONFIG[nts] = ",--disable-nts,gnutls" | ||
71 | |||
72 | # --disable-static isn't supported by chrony's configure script. | ||
73 | DISABLE_STATIC = "" | ||
74 | |||
75 | do_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 | |||
85 | do_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 | |||
125 | FILES:${PN} = "${sbindir}/chronyd ${sysconfdir} ${localstatedir}/lib/chrony ${localstatedir}" | ||
126 | CONFFILES:${PN} = "${sysconfdir}/chrony.conf" | ||
127 | INITSCRIPT_NAME = "chronyd" | ||
128 | INITSCRIPT_PARAMS = "defaults" | ||
129 | SYSTEMD_PACKAGES = "${PN}" | ||
130 | SYSTEMD_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. | ||
137 | RCONFLICTS:${PN} = "ntp ntimed" | ||
138 | |||
139 | # Separate the client program into its own package | ||
140 | PACKAGES =+ "chronyc" | ||
141 | FILES:chronyc = "${bindir}/chronyc" | ||