diff options
Diffstat (limited to 'meta-networking/recipes-support/chrony/chrony_4.3.bb')
-rw-r--r-- | meta-networking/recipes-support/chrony/chrony_4.3.bb | 151 |
1 files changed, 151 insertions, 0 deletions
diff --git a/meta-networking/recipes-support/chrony/chrony_4.3.bb b/meta-networking/recipes-support/chrony/chrony_4.3.bb new file mode 100644 index 0000000000..083d2cbc00 --- /dev/null +++ b/meta-networking/recipes-support/chrony/chrony_4.3.bb | |||
@@ -0,0 +1,151 @@ | |||
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://download.tuxfamily.org/chrony/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] = "9d0da889a865f089a5a21610ffb6713e3c9438ce303a63b49c2fb6eaff5b8804" | ||
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 | ||
49 | |||
50 | # Add chronyd user if privdrop packageconfig is selected | ||
51 | inherit ${@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 /bin/nologin chronyd;', '', d)}" | ||
54 | |||
55 | # Configuration options: | ||
56 | # - For command line editing support in chronyc, you may specify either | ||
57 | # 'editline' or 'readline' but not both. editline is smaller, but | ||
58 | # many systems already have readline for other purposes so you might want | ||
59 | # to choose that instead. However, beware license incompatibility | ||
60 | # since chrony is GPLv2 and readline versions after 6.0 are GPLv3+. | ||
61 | # You can of course choose neither, but if you're that tight on space | ||
62 | # consider dropping chronyc entirely (you can use it remotely with | ||
63 | # appropriate chrony.conf options). | ||
64 | # - Security-related: | ||
65 | # - 'sechash' is omitted by default because it pulls in nss which is huge. | ||
66 | # - 'privdrop' allows chronyd to run as non-root; would need changes to | ||
67 | # chrony.conf and init script. | ||
68 | # - 'scfilter' enables support for system call filtering, but requires the | ||
69 | # kernel to have CONFIG_SECCOMP enabled. | ||
70 | PACKAGECONFIG ??= "editline \ | ||
71 | ${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)} \ | ||
72 | " | ||
73 | PACKAGECONFIG[readline] = "--without-editline,--without-readline,readline" | ||
74 | PACKAGECONFIG[editline] = ",--without-editline,libedit" | ||
75 | PACKAGECONFIG[sechash] = "--without-tomcrypt,--disable-sechash,nss" | ||
76 | PACKAGECONFIG[privdrop] = "--with-libcap,--disable-privdrop --without-libcap,libcap" | ||
77 | PACKAGECONFIG[scfilter] = "--enable-scfilter,--without-seccomp,libseccomp" | ||
78 | PACKAGECONFIG[ipv6] = ",--disable-ipv6," | ||
79 | PACKAGECONFIG[nss] = "--with-nss,--without-nss,nss" | ||
80 | PACKAGECONFIG[libcap] = "--with-libcap,--without-libcap,libcap" | ||
81 | |||
82 | # --disable-static isn't supported by chrony's configure script. | ||
83 | DISABLE_STATIC = "" | ||
84 | |||
85 | do_configure() { | ||
86 | ./configure --sysconfdir=${sysconfdir} --bindir=${bindir} --sbindir=${sbindir} \ | ||
87 | --localstatedir=${localstatedir} --datarootdir=${datadir} \ | ||
88 | --with-ntp-era=$(shell date -d '1970-01-01 00:00:00+00:00' +'%s') \ | ||
89 | --with-pidfile=/run/chrony/chronyd.pid \ | ||
90 | --chronyrundir=/run/chrony \ | ||
91 | --host-system=Linux \ | ||
92 | ${PACKAGECONFIG_CONFARGS} | ||
93 | } | ||
94 | |||
95 | do_install() { | ||
96 | # Binaries | ||
97 | install -d ${D}${bindir} | ||
98 | install -m 0755 ${S}/chronyc ${D}${bindir} | ||
99 | install -d ${D}${sbindir} | ||
100 | install -m 0755 ${S}/chronyd ${D}${sbindir} | ||
101 | |||
102 | # Config file | ||
103 | install -d ${D}${sysconfdir} | ||
104 | install -m 644 ${WORKDIR}/chrony.conf ${D}${sysconfdir} | ||
105 | if ${@bb.utils.contains('PACKAGECONFIG', 'privdrop', 'true', 'false', d)}; then | ||
106 | echo "# Define user to drop to after dropping root privileges" >> ${D}${sysconfdir}/chrony.conf | ||
107 | echo "user chronyd" >> ${D}${sysconfdir}/chrony.conf | ||
108 | fi | ||
109 | |||
110 | # System V init script | ||
111 | install -d ${D}${sysconfdir}/init.d | ||
112 | install -m 755 ${WORKDIR}/chronyd ${D}${sysconfdir}/init.d | ||
113 | |||
114 | # systemd unit configuration file | ||
115 | install -d ${D}${systemd_unitdir}/system | ||
116 | install -m 0644 ${S}/examples/chronyd.service ${D}${systemd_unitdir}/system/ | ||
117 | |||
118 | # Variable data (for drift and/or rtc file) | ||
119 | install -d ${D}${localstatedir}/lib/chrony | ||
120 | |||
121 | # Fix hard-coded paths in config files and init scripts | ||
122 | sed -i -e 's!/var/!${localstatedir}/!g' -e 's!/etc/!${sysconfdir}/!g' \ | ||
123 | -e 's!/usr/sbin/!${sbindir}/!g' -e 's!/usr/bin/!${bindir}/!g' \ | ||
124 | ${D}${sysconfdir}/chrony.conf \ | ||
125 | ${D}${sysconfdir}/init.d/chronyd \ | ||
126 | ${D}${systemd_unitdir}/system/chronyd.service | ||
127 | sed -i 's!^PATH=.*!PATH=${base_sbindir}:${base_bindir}:${sbindir}:${bindir}!' ${D}${sysconfdir}/init.d/chronyd | ||
128 | sed -i 's!^EnvironmentFile=.*!EnvironmentFile=-${sysconfdir}/default/chronyd!' ${D}${systemd_unitdir}/system/chronyd.service | ||
129 | |||
130 | install -d ${D}${sysconfdir}/tmpfiles.d | ||
131 | echo "d /var/lib/chrony 0755 root root -" > ${D}${sysconfdir}/tmpfiles.d/chronyd.conf | ||
132 | |||
133 | } | ||
134 | |||
135 | FILES:${PN} = "${sbindir}/chronyd ${sysconfdir} ${localstatedir}/lib/chrony ${localstatedir}" | ||
136 | CONFFILES:${PN} = "${sysconfdir}/chrony.conf" | ||
137 | INITSCRIPT_NAME = "chronyd" | ||
138 | INITSCRIPT_PARAMS = "defaults" | ||
139 | SYSTEMD_PACKAGES = "${PN}" | ||
140 | SYSTEMD_SERVICE:${PN} = "chronyd.service" | ||
141 | |||
142 | # It's probably a bad idea to run chrony and another time daemon on | ||
143 | # the same system. systemd includes the SNTP client 'timesyncd', which | ||
144 | # will be disabled by chronyd.service, however it will remain on the rootfs | ||
145 | # wasting 150 kB unless you put 'PACKAGECONFIG:remove:pn-systemd = "timesyncd"' | ||
146 | # in a conf file or bbappend somewhere. | ||
147 | RCONFLICTS:${PN} = "ntp ntimed" | ||
148 | |||
149 | # Separate the client program into its own package | ||
150 | PACKAGES =+ "chronyc" | ||
151 | FILES:chronyc = "${bindir}/chronyc" | ||