############################################################################### # IPFire.org - An Open Source Firewall Solution # # Copyright (C) - IPFire Development Team # ############################################################################### name = ntp version = %{ver_major}.8 ver_major = 4.2 release = 1 groups = System/Daemons url = http://www.ntp.org/ license = (MIT and BSD and BSD with advertising) and GPLv2 summary = The NTP daemon and utilities. description 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. end source_dl = http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-%{ver_major}/ sources += ntpstat-0.2.tgz # The vendor part in the NTP pool address. VENDORZONE = %{DISTRO_SNAME} build requires libcap-devel libedit-devel openssl-devel perl-HTML-Parser pps-tools-devel end prepare %{MACRO_EXTRACT_TARBALL} ln -svf ../ntpstat-0.2 . %{MACRO_PATCHES} # Create ntp user and group. %{create_user} end configure_options += \ --sysconfdir=%{sysconfdir}/ntp/crypto \ --with-openssl-libdir=%{libdir} \ --enable-all-clocks \ --enable-parse-clocks \ --enable-ntp-signd=%{localstatedir}/run/ntp_signd build ./configure %{configure_options} echo "#define KEYFILE \"%{sysconfdir}/ntp/keys\"" >> ntpdate/ntpdate.h echo "#define NTP_VAR \"%{localstatedir}/log/ntpstats/\"" >> config.h make ${PARALLELISMFLAGS} # Build ntpstat. make -C ntpstat-0.2 end make_install_targets += bindir=%{sbindir} install_cmds mkdir -pv %{BUILDROOT}%{mandir}/man{5,8} sed -i "s/sntp\.1/sntp\.8/" %{BUILDROOT}%{mandir}/man1/sntp.1 mv -v %{BUILDROOT}%{mandir}/man{1/sntp.1,8/sntp.8} rm -rfv %{BUILDROOT}%{mandir}/man1 # Install ntpstat. pushd ntpstat-0.2 mkdir -pv %{BUILDROOT}%{bindir} install -m 755 ntpstat %{BUILDROOT}%{bindir} install -m 644 ntpstat.1 %{BUILDROOT}%{mandir}/man8/ntpstat.8 popd # Fix section numbers. sed -i 's/\(\.TH[a-zA-Z ]*\)[1-9]\(.*\)/\18\2/' \ %{BUILDROOT}%{mandir}/man8/*.8 mkdir -pv %{BUILDROOT}/%{sysconfdir}/sysconfig mkdir -pv %{BUILDROOT}/%{localstatedir}/{lib/ntp,log/ntpstats} mkdir -pv %{BUILDROOT}%{prefix}/lib touch %{BUILDROOT}/%{localstatedir}/lib/ntp/{drift,sntp-kod} sed \ -e "s@VENDORZONE@%{VENDORZONE}@g" \ -e "s@ETCNTP@%{sysconfdir}/ntp@g" \ -e "s@VARNTP@%{localstatedir}/lib/ntp@g" \ < %{DIR_SOURCE}/ntp.conf > %{BUILDROOT}%{sysconfdir}/ntp.conf mkdir -pv %{BUILDROOT}%{sysconfdir}/ntp sed -e "s@VENDORZONE@%{VENDORZONE}@g" \ < %{DIR_SOURCE}/ntp.step-tickers > %{BUILDROOT}%{sysconfdir}/ntp/step-tickers # Install crypto pw. mkdir -pv %{BUILDROOT}%{sysconfdir}/ntp/crypto install -p -m 600 %{DIR_SOURCE}/ntp.cryptopw \ %{BUILDROOT}%{sysconfdir}/ntp/crypto/pw # Install keys. install -p -m 600 %{DIR_SOURCE}/ntp.keys \ %{BUILDROOT}%{sysconfdir}/ntp/keys # Install ntpdate wrapper. install -p -m 755 %{DIR_SOURCE}/ntpdate-wrapper\ %{BUILDROOT}%{prefix}/lib/ntpdate-wrapper install -p -m 644 %{DIR_SOURCE}/ntpdate.sysconfig \ %{BUILDROOT}%{sysconfdir}/sysconfig/ntpdate mkdir -pv %{unitdir}/ntp-units.d echo "ntpd.service" > %{unitdir}/ntp-units.d/60-ntpd.list # Fix ownership. chown -R ntp:ntp %{BUILDROOT}%{sharedstatedir}/ntp end end create_user getent group ntp >/dev/null || groupadd -g 38 ntp || : getent passwd ntp >/dev/null || useradd -u 38 -g 38 -s /sbin/nologin \ -M -r -d %{sysconfdir}/ntp ntp || : end packages package %{name} requires ntpdate = %{thisver} end datafiles %{localstatedir}/lib/ntp/drift end script postin systemctl daemon-reload >/dev/null 2>&1 || : end script preun systemctl --no-reload disable ntpd.service >/dev/null 2>&1 || : systemctl stop ntpd.service >/dev/null 2>&1 || : end script postun systemctl daemon-reload >/dev/null 2>&1 || : end script postup systemctl daemon-reload >/dev/null 2>&1 || : systemctl try-restart ntpd.service >/dev/null 2>&1 || : end end package ntpdate summary = Utility to set the date and time via NTP. description ntpdate is a program for retrieving the date and time from NTP servers. end files %{sbindir}/ntpdate %{mandir}/man8/ntpdate.8* end script prein %{create_user} end script postin systemctl daemon-reload >/dev/null 2>&1 || : end script preun systemctl --no-reload disable ntpdate.service >/dev/null 2>&1 || : systemctl stop ntpdate.service >/dev/null 2>&1 || : end script postun systemctl daemon-reload >/dev/null 2>&1 || : end end package %{name}-devel template DEVEL end package %{name}-debuginfo template DEBUGINFO end end