On 08-03-18 01:52, Richard Laager wrote:
>> What about the spec file?
> 
> There are a couple of different issues here:
> 
> 1) You want to use /etc/sysconfig/ntpd.

Not in this one. (see attachment)
This was fixed after the systemd tip you gave me.

> 2) Should the packaging on any particular distro use /etc/sysconfig/ntpd?

What is the difference here?
One can use /etc/systemd/system/ntpd.service.d/whatever.conf but that
requires a bit of systemd knowledge.
/etc/sysconfig/ntpd has been there for ages and people might know this
location.
I guess this is transitionary.
The project ships an ntpd.service without reference to /etc/sysconfig/ntpd

> For #2, I think one should follow the distro conventions. If it is
> customary for _systemd_ (not sysvinit) services to use /etc/sysconfig/
> files for options on RedHat, then ntpd.service should be customized in
> this way in packaging/RPM/ntpsec.spec. Likewise for
> packaging/SUSE/ntpsec.spec. If the distros make different choices, the
> two .spec files would take different approaches.

Reasonable.

Udo
%global debug_package %{nil}

Summary: The NTPsec daemon and utilities
Name: ntpsec
Version: 1.0.1
Release: 2%{?dist}
License: BSD
Group: System Environment/Daemons
Source: ftp://ftp.ntpsec.org/pub/releases/ntpsec-1.0.1.tgz
#Source4: ntpd.sysconfig

URL: http://www.ntpsec.org
Requires(post): systemd-units
Requires(preun): systemd-units
Requires(postun): systemd-units
BuildRequires: systemd-units
BuildRequires: bison openssl-devel
BuildRequires:libcap-devel libseccomp-devel
BuildRequires: pps-tools-devel
BuildRequires: avahi-compat-libdns_sd-devel
BuildRequires: libcap openssl-libs pps-tools
BuildRequires: python-devel libxslt asciidoc m4

%description
The NTPsec project - a secure, hardened, and improved implementation
of Network Time Protocol derived from NTP Classic, Dave Mills’s
original.
The Network Time Protocol (NTP) is used to synchronize a computer's
time with another reference time source. This package includes ntpd
(a daemon which continuously adjusts system time) and utilities used
to query and configure the ntpd daemon.

Perl scripts ntp-wait and ntptrace are in the ntp-perl package,
ntpdate is in the ntpdate package and sntp is in the sntp package.
The documentation is in the ntp-doc package.

%package doc
Summary: NTP documentation
Group: Documentation
Requires: %{name} = %{version}-%{release}
BuildArch: noarch
%description doc
This package contains NTP documentation in HTML format.
 
%prep
%setup -q

%build
./waf configure \
		--prefix=/usr\
		--enable-early-droproot\
		--refclock=nmea,generic\
		--libdir=%{_libdir}\
		--docdir=%{_docdir}/ntpsec\
		--enable-doc
./waf build

%install

DESTDIR=$RPM_BUILD_ROOT ./waf install

pushd $RPM_BUILD_ROOT
mkdir -p .%{_sysconfdir}/{ntp/crypto,sysconfig,dhcp/dhclient.d} .%{_libexecdir}
mkdir -p .%{_sysconfdir}/ntp.d
mkdir -p .%{_localstatedir}/{lib/{s,}ntp,log/ntpstats} .%{_unitdir}
mkdir -p .%{_unitdir}
mkdir -p .%{_docdir}/ntpsec
mkdir -p .%{_sysconfdir}/ntp/crypto/
#install -p -m644 %{SOURCE4} .%{_sysconfdir}/sysconfig/ntpd
install -p -m644 "$RPM_BUILD_DIR/%{name}-%{version}"/docs/*.txt .%{_docdir}/ntpsec
install -p -m644 %{_builddir}/%{name}-%{version}/etc/ntpviz-weekly.service .%{_unitdir}/
install -p -m644 %{_builddir}/%{name}-%{version}/etc/ntploggps.service .%{_unitdir}/
install -p -m644 %{_builddir}/%{name}-%{version}/etc/ntp-wait.service .%{_unitdir}/
install -p -m644 %{_builddir}/%{name}-%{version}/etc/ntpviz-daily.service .%{_unitdir}/
install -p -m644 %{_builddir}/%{name}-%{version}/etc/ntplogtemp.service .%{_unitdir}/
install -p -m644 %{_builddir}/%{name}-%{version}/etc/ntpd.service .%{_unitdir}/

mv .%{_bindir}/ntpdig .%{_sbindir}

install -p -m644 %{_builddir}/%{name}-%{version}/etc/ntp.d/default.conf .%{_sysconfdir}/ntp.conf
install -p -m644 %{_builddir}/%{name}-%{version}/etc/ntp.d/use-gpsd-json .%{_sysconfdir}/ntp.d/
install -p -m644 %{_builddir}/%{name}-%{version}/etc/ntp.d/use-gpsd-shm .%{_sysconfdir}/ntp.d/
install -p -m644 %{_builddir}/%{name}-%{version}/etc/ntp.d/use-minimal-logging .%{_sysconfdir}/ntp.d/
install -p -m644 %{_builddir}/%{name}-%{version}/etc/ntp.d/use-no-remote-configuration .%{_sysconfdir}/ntp.d/
install -p -m644 %{_builddir}/%{name}-%{version}/etc/ntp.d/use-performance-logging .%{_sysconfdir}/ntp.d/
install -p -m644 %{_builddir}/%{name}-%{version}/etc/ntp.d/use-pool .%{_sysconfdir}/ntp.d/

# if 64-bit arch... (needs to be 64-bit only check, not intel-specific)
%ifarch x86_64
mkdir -p ./usr/lib64/python2.7/site-packages/ntp/
mv ./usr/lib/python2.7/site-packages/ntp/* ./usr/lib64/python2.7/site-packages/ntp/
%endif
popd

%post
%systemd_post ntpd.service

%preun
%systemd_preun ntpd.service

%postun
%systemd_postun_with_restart ntpd.service


%files
%{_sbindir}/*
%{_bindir}/*
%{_libdir}/python2.7/site-packages/ntp/*
#%config(noreplace) %{_sysconfdir}/sysconfig/ntpd
%dir %attr(-,ntp,ntp) %{_sysconfdir}/ntp.d
%config(noreplace) %attr(644,ntp,ntp) %{_sysconfdir}/ntp.d/*
%{_unitdir}/*
%{_mandir}/*
%config(noreplace) %verify(not md5 size mtime) %attr(644,ntp,ntp) %{_sysconfdir}/ntp.conf
%dir %attr(750,root,ntp) %{_sysconfdir}/ntp/crypto
#%config(noreplace) %{_sysconfdir}/ntp/crypto/pw
#%dir %{_sysconfdir}/dhcp/dhclient.d
#%{_sysconfdir}/dhcp/dhclient.d/ntp.sh
%dir %attr(-,ntp,ntp) %{_localstatedir}/lib/ntp
%dir %attr(-,ntp,ntp) %{_localstatedir}/log/ntpstats
%ghost %attr(644,ntp,ntp) %{_localstatedir}/lib/ntp/drift

%files doc
%{_docdir}/*

%changelog
* Wed Mar 07 2018 Udo van den Heuvel <udo...@xs4all.nl> 1.0.1-2
- Fresh git pull
* Sat Mar 03 2018 Udo van den Heuvel <udo...@xs4all.nl> 1.0.1-1
- Bump to 1.0.1, include configs, service files, etc
* Tue Nov 14 2017 Udo van den Heuvel <udo...@xs4all.nl> 1.0.0-0
- Create 1.0.0 package.
_______________________________________________
devel mailing list
devel@ntpsec.org
http://lists.ntpsec.org/mailman/listinfo/devel

Reply via email to