1#
2# spec file for package ntpsec
3#
4# Copyright SUSE LINUX GmbH, Nuernberg, Germany.
5# Copyright Malcolm J Lewis <malcolmlewis@opensuse.org>
6#
7# All modifications and additions to the file contributed by third parties
8# remain the property of their copyright owners, unless otherwise agreed
9# upon. The license for this file, and modifications and additions to the
10# file, is the same license as for the pristine package itself (unless the
11# license for the pristine package is not an Open Source License, in which
12# case the license is the MIT License). An "Open Source License" is a
13# license that conforms to the Open Source Definition (Version 1.9)
14# published by the Open Source Initiative.
15
16# Please submit bugfixes or comments via http://bugs.opensuse.org/
17#
18
19
20%if 0%{?suse_version} >= 1320 || 0%{?is_opensuse}
21%bcond_without libbsd
22%else
23%bcond_with libbsd
24%endif
25Name:           ntpsec
26Version:        1.1.3
27Release:        0
28Summary:        Improved implementation of Network Time Protocol
29License:        BSD-2-Clause and NTP and BSD-3-Clause and MIT
30Group:          System/Base
31Url:            https://www.ntpsec.org/
32Source0:        ntpsec-%{version}.tar.xz
33Source3:        %{name}.changes
34Source4:        logrotate.ntp
35Source7:        ntp.firewall
36Source8:        ntp.conf
37BuildRequires:  asciidoc
38BuildRequires:  avahi-compat-mDNSResponder-devel
39BuildRequires:  bison
40BuildRequires:  fdupes
41# Needed for waf init in the git snapshot
42BuildRequires:  git-core
43BuildRequires:  libcap-devel
44BuildRequires:  libxslt-tools
45# Required for tests to pass
46BuildRequires:  netcfg
47BuildRequires:  openssl-devel
48BuildRequires:  pkgconfig
49BuildRequires:  pps-tools-devel
50BuildRequires:  pkgconfig(libseccomp)
51BuildRequires:  pkgconfig(python)
52Requires:       netcfg
53Requires:       ntpsec-utils
54Requires(pre):  pwdutils
55Recommends:     logrotate
56# For ntpleapfetch
57Recommends:     wget
58Conflicts:      otherproviders(ntp)
59Provides:       ntp = 4.2.9
60BuildRoot:      %{_tmppath}/%{name}-%{version}-build
61%if %{with libbsd}
62BuildRequires:  pkgconfig(libbsd)
63%endif
64
65%description
66A more secure implementation of NTP, derived from NTP Classic, Dave
67Millss original.
68
69%package -n python-ntp
70Summary:        Python ntpsec bindings
71Group:          Development/Languages/Python
72
73%description -n python-ntp
74The ntpsec python bindings used by various ntp utilities.
75
76%package utils
77Summary:        Utilities and commands for ntp
78Group:          System/Base
79Requires:       %{name} = %{version}
80# For ntploggps
81Requires:       python-gpsd
82Requires:       python-ntp
83# For ntpviz
84Recommends:     python-psutil
85Conflicts:      ntp < 4.2.9
86
87%description utils
88The ntpsec utilities relying on the python module of ntp
89
90%prep
91%setup -q
92# Fix python shebangs
93sed -i -e 's:#!%{_bindir}/env python:#!%{_bindir}/python2:' \
94    ntpclients/*
95
96%build
97# We use the date from the changes file
98epoch=`date --date "@\`stat --format %%Y %{SOURCE3}\`" +"%%s"`
99
100export CFLAGS="%{optflags}"
101export CCFLAGS="%{optflags}"
102./waf configure \
103    --build-epoch="$epoch" \
104    --enable-debug \
105    --prefix=%{_prefix} \
106    --mandir="%{_mandir}" \
107    --python=%{_bindir}/python2 \
108    --pythonarchdir=%{python_sitearch} \
109    --pythondir=%{python_sitearch} \
110    --enable-seccomp \
111    --enable-debug-gdb \
112    --enable-early-droproot \
113    --enable-leap-smear \
114    --enable-mssntp \
115    --enable-lockclock \
116    --refclock=all
117./waf build --verbose %{?_smp_mflags}
118
119%install
120./waf install --destdir=%{buildroot}
121
122# Use correct path in unit file
123sed -i "s|bin|sbin|g" etc/ntpd.service
124
125# FIXME: As long as systemdenable switch for install is broken
126install -m 0644 -D etc/ntpd.service %{buildroot}/%{_unitdir}/ntpd.service
127install -m 0644 -D etc/ntp-wait.service %{buildroot}/%{_unitdir}/ntp-wait.service
128ln -s service %{buildroot}%{_sbindir}/rcntpd
129ln -s service %{buildroot}%{_sbindir}/rcntp-wait
130
131install -m 0644 -D %{SOURCE4} %{buildroot}%{_sysconfdir}/logrotate.d/ntp
132install -m 0644 -D %{SOURCE7} %{buildroot}%{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/ntp
133install -m 0644 -D %{SOURCE8} %{buildroot}%{_sysconfdir}/ntp.conf
134
135%fdupes -s %{buildroot}
136
137%check
138./waf check --verbose %{?_smp_mflags}
139
140%pre
141getent group ntp >/dev/null || groupadd -r ntp
142getent passwd ntp >/dev/null || useradd -u 74 -r -g ntp -d %{_localstatedir}/lib/ntp -s /sbin/nologin -c "NTP daemon" ntp
143%service_add_pre ntp.service ntpd.service
144exit 0
145
146%pre utils
147%service_add_pre ntp-wait.service
148
149%post
150%service_add_post ntpd.service
151
152%post utils
153%service_add_post ntp-wait.service
154
155%preun
156%service_del_preun ntpd.service
157
158%preun utils
159%service_del_preun ntp-wait.service
160
161%postun
162%service_del_postun ntpd.service
163
164%postun utils
165%service_del_postun ntp-wait.service
166
167%files -n python-ntp
168%defattr(-,root,root)
169%{python_sitearch}/ntp
170
171%files utils
172%defattr(-,root,root)
173%{_bindir}/ntploggps
174%{_bindir}/ntpdig
175%{_bindir}/ntpkeygen
176%{_bindir}/ntpmon
177%{_bindir}/ntpq
178%{_bindir}/ntpsweep
179%{_bindir}/ntptrace
180%{_bindir}/ntpviz
181%{_bindir}/ntpwait
182%{_bindir}/ntplogtemp
183%{_mandir}/man1/ntploggps.1%{?ext_man}
184%{_mandir}/man1/ntpdig.1%{?ext_man}
185%{_mandir}/man8/ntpkeygen.8%{?ext_man}
186%{_mandir}/man1/ntpmon.1%{?ext_man}
187%{_mandir}/man1/ntpq.1%{?ext_man}
188%{_mandir}/man1/ntpsweep.1%{?ext_man}
189%{_mandir}/man1/ntptrace.1%{?ext_man}
190%{_mandir}/man1/ntpviz.1%{?ext_man}
191%{_mandir}/man8/ntpwait.8%{?ext_man}
192%{_mandir}/man1/ntplogtemp.1%{?ext_man}
193%{_sbindir}/rcntp-wait
194%{_unitdir}/ntp-wait.service
195
196%files
197%defattr(-,root,root)
198%doc NEWS README LICENSE
199%config(noreplace) %{_sysconfdir}/ntp.conf
200%{_sbindir}/rcntpd
201%{_bindir}/ntpfrob
202%{_bindir}/ntpleapfetch
203%{_bindir}/ntptime
204%{_sbindir}/ntpd
205%{_mandir}/man5/ntp.conf.5%{?ext_man}
206%{_mandir}/man5/ntp.keys.5%{?ext_man}
207%{_mandir}/man8/ntpd.8%{?ext_man}
208%{_mandir}/man8/ntpfrob.8%{?ext_man}
209%{_mandir}/man8/ntpleapfetch.8%{?ext_man}
210%{_mandir}/man8/ntptime.8%{?ext_man}
211%config %{_sysconfdir}/logrotate.d/ntp
212%config %{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/ntp
213%{_unitdir}/ntpd.service
214
215%changelog
216