chrony-vl.spec 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  1. %bcond_with systemd
  2. Name: chrony
  3. Version: 4.5
  4. Release: 1%{?_dist_release}%{?with_systemd:.systemd}
  5. Summary: An NTP client/server
  6. Group: system
  7. Vendor: Project Vine
  8. Distribution: Vine Linux
  9. Packager: tomop
  10. License: GPLv2
  11. URL: https://chrony.tuxfamily.org/
  12. Source0: https://download.tuxfamily.org/chrony/chrony-%{version}%{?prerelease}.tar.gz
  13. Source2: chrony.dhclient
  14. Source3: chronyd.sysconfig
  15. Source4: chronyd.init
  16. Source6: chrony.sysusers
  17. # add distribution-specific bits to DHCP dispatcher
  18. Patch1: chrony-nm-dispatcher-dhcp.patch
  19. BuildRequires: libcap-devel readline-devel ncurses-devel bison
  20. BuildRequires: libseccomp-devel
  21. BuildRequires: gcc gcc-c++ bison gnupg2 net-tools
  22. BuildRequires: gnutls-devel gnutls-utils
  23. Requires(pre): shadow-utils
  24. %if %{with systemd}
  25. BuildRequires: systemd
  26. %{?systemd_requires}
  27. %else
  28. Requires(post): chkconfig
  29. Requires(preun): chkconfig initscripts
  30. Requires(postun): initscripts
  31. %endif
  32. %if "%{?_dist_release}" == "vl7"
  33. Obsoletes: ntp < 4.2.6p5
  34. %endif
  35. %description
  36. A client/server for the Network Time Protocol, this program keeps your
  37. computer's clock accurate. It was specially designed to support
  38. systems with intermittent internet connections, but it also works well
  39. in permanently connected environments. It can use also hardware reference
  40. clocks, system real-time clock or manual input as time references.
  41. %debug_package
  42. %prep
  43. %setup -q -n %{name}-%{version}%{?prerelease}
  44. %patch1 -p1 -b .nm-dispatcher-dhcp
  45. echo '# Keys used by chronyd for command and NTP authentication' > chrony.keys
  46. # use example chrony.conf as the default config with some modifications:
  47. # - use our vendor zone (2.*pool.ntp.org names include IPv6 addresses)
  48. # - enable leapsectz to get TAI-UTC offset and leap seconds from tzdata
  49. # - use NTP servers from DHCP
  50. sed -e 's|^\(pool \)\(pool.ntp.org\)|\1ntp.nict.jp|' \
  51. -e 's|#\(leapsectz\)|\1|' \
  52. -e 's|^pool.*pool.ntp.org.*|&\n\n# Use NTP servers from DHCP.\nsourcedir /run/chrony-dhcp|' \
  53. < examples/chrony.conf.example2 > chrony.conf
  54. touch -r examples/chrony.conf.example2 chrony.conf
  55. # regenerate the file from getdate.y
  56. rm -f getdate.c
  57. %build
  58. %configure \
  59. --chronyrundir=/run/chrony \
  60. --docdir=%{_docdir} \
  61. --enable-ntp-signd \
  62. --enable-scfilter \
  63. --disable-nts \
  64. --with-ntp-era=$(date -d '1970-01-01 00:00:00+00:00' +'%s') \
  65. --with-user=chrony \
  66. --with-hwclockfile=%{_sysconfdir}/adjtime \
  67. --with-pidfile=/run/chrony/chronyd.pid \
  68. --with-sendmail=%{_sbindir}/sendmail \
  69. %{mil}
  70. make %{?_smp_mflags}
  71. %install
  72. make install DESTDIR=%{buildroot}
  73. rm -rf %{buildroot}%{_docdir}
  74. mkdir -p %{buildroot}%{_initrddir}
  75. mkdir -p %{buildroot}%{_sysconfdir}/{sysconfig,logrotate.d}
  76. mkdir -p %{buildroot}%{_localstatedir}/{lib,log}/chrony
  77. mkdir -p %{buildroot}%{_sysconfdir}/dhcp/dhclient.d
  78. mkdir -p %{buildroot}%{_libexecdir}
  79. mkdir -p %{buildroot}%{_prefix}/lib/NetworkManager/dispatcher.d
  80. %if %{with systemd}
  81. mkdir -p %{buildroot}%{_sysusersdir}
  82. mkdir -p %{buildroot}{%{_unitdir},%{_prefix}/lib/systemd/ntp-units.d}
  83. %endif
  84. install -m 644 -p chrony.conf %{buildroot}%{_sysconfdir}/chrony.conf
  85. install -m 755 -p %{SOURCE2} \
  86. %{buildroot}%{_sysconfdir}/dhcp/dhclient.d/chrony.sh
  87. install -m 644 -p examples/chrony.logrotate \
  88. %{buildroot}%{_sysconfdir}/logrotate.d/chrony
  89. install -m 755 -p examples/chrony.nm-dispatcher.onoffline \
  90. %{buildroot}%{_prefix}/lib/NetworkManager/dispatcher.d/20-chrony-onoffline
  91. install -m 755 -p examples/chrony.nm-dispatcher.dhcp \
  92. %{buildroot}%{_prefix}/lib/NetworkManager/dispatcher.d/20-chrony-dhcp
  93. %if %{with systemd}
  94. install -m 644 -p examples/chronyd.service \
  95. %{buildroot}%{_unitdir}/chronyd.service
  96. install -m 644 -p examples/chronyd-restricted.service \
  97. %{buildroot}%{_unitdir}/chronyd-restricted.service
  98. install -m 644 -p examples/chrony-wait.service \
  99. %{buildroot}%{_unitdir}/chrony-wait.service
  100. install -m 644 -p %{SOURCE6} \
  101. %{buildroot}%{_sysusersdir}/chrony.conf
  102. echo 'chronyd.service' > \
  103. %{buildroot}/usr/lib/systemd/ntp-units.d/50-chronyd.list
  104. %else
  105. install -m 755 -p %{SOURCE4} %{buildroot}%{_initrddir}/chronyd
  106. %endif
  107. install -m 644 -p %{SOURCE3} %{buildroot}%{_sysconfdir}/sysconfig/chronyd
  108. touch %{buildroot}%{_sysconfdir}/chrony.keys
  109. touch %{buildroot}%{_localstatedir}/lib/chrony/{drift,rtc}
  110. %pre
  111. %if %{with systemd}
  112. %sysusers_create_compat %{SOURCE6}
  113. %else
  114. getent group chrony > /dev/null || /usr/sbin/groupadd -r chrony
  115. getent passwd chrony > /dev/null || /usr/sbin/useradd -r -g chrony \
  116. -d %{_localstatedir}/lib/chrony -s /sbin/nologin chrony
  117. exit 0
  118. %endif
  119. %post
  120. %if %{with systemd}
  121. # migrate from chrony-helper to sourcedir directive
  122. if test -a %{_libexecdir}/chrony-helper; then
  123. grep -qi 'sourcedir /run/chrony-dhcp$' %{_sysconfdir}/chrony.conf 2> /dev/null || \
  124. echo -e '\n# Use NTP servers from DHCP.\nsourcedir /run/chrony-dhcp' >> \
  125. %{_sysconfdir}/chrony.conf
  126. mkdir -p /run/chrony-dhcp
  127. for f in %{_localstatedir}/lib/dhclient/chrony.servers.*; do
  128. sed 's|.*|server &|' < $f > /run/chrony-dhcp/"${f##*servers.}.sources"
  129. done 2> /dev/null
  130. fi
  131. %systemd_post chronyd.service chronyd-restricted.service chrony-wait.service
  132. %else
  133. /sbin/chkconfig --add chronyd
  134. :
  135. %endif
  136. %preun
  137. %if %{with systemd}
  138. %systemd_preun chronyd.service chronyd-restricted.service chrony-wait.service
  139. %else
  140. if [ "$1" -eq 0 -o -x /bin/systemctl ]; then
  141. /sbin/service chronyd stop &> /dev/null
  142. /sbin/chkconfig --del chronyd
  143. fi
  144. :
  145. %endif
  146. %postun
  147. %if %{with systemd}
  148. %systemd_postun_with_restart chronyd.service chronyd-restricted.service
  149. %else
  150. if [ "$1" -ge 1 ]; then
  151. /sbin/service chronyd condrestart &> /dev/null
  152. fi
  153. :
  154. %endif
  155. %files
  156. %defattr(-,root,root,-)
  157. %license COPYING
  158. %doc FAQ NEWS README examples/*
  159. %config(noreplace) %{_sysconfdir}/chrony.conf
  160. %config(noreplace) %attr(640,root,chrony) %{_sysconfdir}/chrony.keys
  161. %config(noreplace) %{_sysconfdir}/sysconfig/chronyd
  162. %config(noreplace) %{_sysconfdir}/logrotate.d/chrony
  163. %if %{with systemd}
  164. /usr/lib/systemd/ntp-units.d/*.list
  165. %{_unitdir}/chrony*.service
  166. %{_sysusersdir}/chrony.conf
  167. %else
  168. %{_initrddir}/chronyd
  169. %endif
  170. %dir %{_prefix}/lib/NetworkManager
  171. %dir %{_prefix}/lib/NetworkManager/dispatcher.d
  172. %{_prefix}/lib/NetworkManager/dispatcher.d/20-chrony*
  173. %dir %{_sysconfdir}/dhcp
  174. %dir %{_sysconfdir}/dhcp/dhclient.d
  175. %{_sysconfdir}/dhcp/dhclient.d/chrony.sh
  176. %{_bindir}/chronyc
  177. %{_sbindir}/chronyd
  178. %{_mandir}/man[158]/%{name}*.[158]*
  179. %dir %attr(-,chrony,chrony) %{_localstatedir}/lib/chrony
  180. %ghost %attr(-,chrony,chrony) %{_localstatedir}/lib/chrony/drift
  181. %ghost %attr(-,chrony,chrony) %{_localstatedir}/lib/chrony/rtc
  182. %dir %attr(-,chrony,chrony) %{_localstatedir}/log/chrony
  183. %changelog
  184. * Fri Jul 12 2024 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 4.5-1
  185. - new upstream release.
  186. * Wed Nov 24 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 4.1-1
  187. - new upstream release.
  188. * Tue Sep 08 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.5.1-2
  189. - rebuilt with nettle-3.6.
  190. * Thu Aug 27 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.5.1-1
  191. - new upstream release.
  192. * Mon Apr 06 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.5-2
  193. - added systemd stuff (disabled as default).
  194. - updated Source2.
  195. * Wed Mar 25 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.5-1
  196. - new upstream release.
  197. - dropped Patch102: fixed in upstream.
  198. * Sat Aug 31 2019 Toshiaki Ara <ara_t@384.jp> 3.2-2
  199. - rebuild with readline-8.0 and ncurses-6.1
  200. * Sat Jun 9 2018 IWAI, Masaharu <iwaim.sub@gmail.com> 3.2-1
  201. - update to 3.2
  202. - drop Patch101; upstream merged
  203. - add Fedora's patch (Patch102)
  204. * Tue Dec 05 2017 Miroslav Lichvar <mlichvar@redhat.com> 3.2-2
  205. - fix chronyc getting stuck in infinite loop after clock step (#1520884)
  206. - restrict obsoleting 'ntp' package to VineSeed; for Vine Linux 6
  207. * Thu May 18 2017 IWAI, Masaharu <iwaim.sub@gmail.com> 3.0-1
  208. - update to 3.0
  209. - add patch to fix time smoothing in interleaved mode (Patch101); from Debian 3.0-4
  210. - drop chrony.txt in %%doc; upstream dropped
  211. - drop info file; upstream dropped
  212. - drop R: info
  213. - drop BR: texinfo
  214. - drop scripts for info
  215. * Mon Jul 11 2016 IWAI, Masaharu <iwaim.sub@gmail.com> 2.2.1-2
  216. - Obsoletes: networkmanager-dispatcher-chrony
  217. * Wed Mar 23 2016 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.2.1-1
  218. - new upstream release.
  219. * Fri Oct 23 2015 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.2-1
  220. - new upstream release.
  221. * Sat Jul 25 2015 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.1.1-1
  222. - new upstream release.
  223. * Tue Dec 23 2014 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.31-1
  224. - new upstream release.
  225. * Sat Jun 7 2014 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.29.1-1
  226. - new upstream release.
  227. - initial build for Vine Linux.
  228. * Fri Aug 09 2013 Miroslav Lichvar <mlichvar@redhat.com> 1.25-3
  229. - fix buffer overflow when processing crafted command packets (CVE-2012-4502)
  230. - don't send uninitialized data in command replies (CVE-2012-4503)
  231. * Thu May 19 2011 Miroslav Lichvar <mlichvar@redhat.com> 1.25-2
  232. - remove timepps.h, NM and dhclient scripts
  233. - build with readline
  234. * Thu May 05 2011 Miroslav Lichvar <mlichvar@redhat.com> 1.25-1
  235. - update to 1.25
  236. - link with -Wl,-z,relro,-z,now options
  237. - use iburst, four pool servers, rtcsync, stratumweight in default config
  238. - suppress install-info errors
  239. * Thu Apr 29 2010 Miroslav Lichvar <mlichvar@redhat.com> 1.24-4.20100428git73d775
  240. - update to 20100428git73d775
  241. - replace initstepslew directive with makestep in default config
  242. - add NetworkManager dispatcher script
  243. - add dhclient script
  244. - retry server/peer name resolution at least once to workaround
  245. NetworkManager race condition on boot
  246. - don't verify chrony.keys
  247. * Fri Mar 12 2010 Miroslav Lichvar <mlichvar@redhat.com> 1.24-3.20100302git5fb555
  248. - update to snapshot 20100302git5fb555
  249. - compile with PPS API support
  250. * Thu Feb 04 2010 Miroslav Lichvar <mlichvar@redhat.com> 1.24-1
  251. - update to 1.24 (#555367, CVE-2010-0292 CVE-2010-0293 CVE-2010-0294)
  252. - modify default config
  253. - step clock on start if it is off by more than 100 seconds
  254. - disable client log
  255. - build with -fPIE on sparc
  256. * Tue Dec 15 2009 Miroslav Lichvar <mlichvar@redhat.com> 1.24-0.1.pre1
  257. - update to 1.24-pre1
  258. * Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.23-7.20081106gitbe42b4
  259. - Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
  260. * Fri Jul 17 2009 Miroslav Lichvar <mlichvar@redhat.com> 1.23-6.20081106gitbe42b4
  261. - switch to editline
  262. - support arbitrary chronyc commands in init script
  263. * Mon Jun 08 2009 Dan Horak <dan[at]danny.cz> 1.23-5.20081106gitbe42b4
  264. - add patch with support for s390/s390x
  265. * Mon Mar 09 2009 Miroslav Lichvar <mlichvar@redhat.com> 1.23-4.20081106gitbe42b4
  266. - fix building with broken libcap header (#483548)
  267. * Mon Feb 23 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.23-3.20081106gitbe42b4
  268. - Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
  269. * Wed Nov 19 2008 Miroslav Lichvar <mlichvar@redhat.com> 1.23-2.20081106gitbe42b4
  270. - fix info uninstall
  271. - generate random command key in init script
  272. - support cyclelogs, online, offline commands in init script
  273. - add logrotate script
  274. * Tue Nov 11 2008 Miroslav Lichvar <mlichvar@redhat.com> 1.23-1.20081106gitbe42b4
  275. - initial release