File ntp.spec of Package ntp.import4677

#
# spec file for package ntp
#
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

# norootforbuild


Name:           ntp
BuildRequires:  fdupes libcap-devel openssl-devel readline-devel
# to allow the postinst script to succeed
BuildRequires:  pwdutils
%define ntpfaqversion 3.4
Url:            http://www.ntp.org/
License:        BSD3c(or similar)
Group:          Productivity/Networking/Other
Version:        4.2.6p3
Release:        6.<RELEASE11>
Summary:        Network Time Protocol daemon (version 4)
# main source
Source0:        http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/ntp-%{version}.tar.gz
# configuration
Source1:        conf.logrotate.ntp
Source2:        conf.ntp.conf
Source3:        conf.ntp.init
Source4:        conf.sysconfig.ntp
Source5:        conf.sysconfig.syslog-ntp
Source6:        conf.ntp.reg
Source7:        %name.firewall
# documentation
Source10:       NTP-FAQ-%{ntpfaqversion}.tar.bz2
Source11:       ntp.1.gz
Source12:       README.SUSE
Source13:       ntp-4.2.0-rh-manpages.tar.gz
Source14:       ntp.xml
Source15:       ntpdate
Source16:       ntp-wait
Patch1:         ntp-segfault_on_invalid_device.patch
Patch4:         ntpd-maxmonmen.patch
Patch9:         remove-ntpdate.diff
Patch10:        ntp-strcat.patch
Patch11:        ntp-4.2.6p2-seed_file.patch
Patch13:        ntp-code-cleanup.patch 
Patch15:        bnc#506908.diff
Patch16:        MOD_NANO.diff
Patch18:        bnc#574885.diff
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
AutoReqProv:    on
Provides:       ntp-daemon xntp3 xntp <= 4.2.4p6
Obsoletes:      xntp3 xntp <= 4.2.4p5
Conflicts:      openntpd
PreReq:         pwdutils %insserv_prereq  %fillup_prereq /usr/bin/diff /usr/bin/grep /sbin/chkconfig
Requires:       timezone

%description
The Network Time Protocol (NTP) is used to synchronize the time of a
computer client or server to another server or reference time source,
such as a radio, satellite receiver, or modem.

Ntpd is an operating system daemon that sets and maintains the system
time-of-day synchronized with Internet standard time servers.



Authors:
--------
    Mark Andrews <marka@syd.dms.csiro.au>
    Viraj Bais <vbais@mailman1.intel.com>
    Clayton Kirkwood <kirkwood@striderfm.intel.com>
    Karl Berry <karl@owl.HQ.ileaf.com>
    Piete Brooks <Piete.Brooks@cl.cam.ac.uk>
    Steve Clift <clift@ml.csiro.au>
    Casey Crellin <casey@csc.co.za>
    Torsten Duwe <duwe@immd4.informatik.uni-erlangen.de>
    John A. Dundas III <dundas@salt.jpl.nasa.gov>
    Dennis Ferguson <dennis@mrbill.canet.ca>
    Glenn Hollinger <glenn@herald.usask.ca>
    Mike Iglesias <iglesias@uci.edu>
    Jim Jagielski <jim@jagubox.gsfc.nasa.gov>
    Jeff Johnson <jbj@chatham.usdesign.com>
    William L. Jones <jones@hermes.chpc.utexas.edu>
    Dave Katz <dkatz@cisco.com>
    Craig Leres <leres@ee.lbl.gov>
    George Lindholm <lindholm@ucs.ubc.ca>
    Louis A. Mamakos <louie@ni.umd.edu>
    Derek Mulcahy <derek@toybox.demon.co.uk>
    Damon Hart-Davis <d@hd.org>
    Lars H. Mathiesen <thorinn@diku.dk>
    David L. Mills <mills@udel.edu>
    Wolfgang Moeller <moeller@gwdgv1.dnet.gwdg.de>
    Jeffrey Mogul <mogul@pa.dec.com>
    Tom Moore <tmoore@fievel.daytonoh.ncr.com>
    Rainer Pruy <Rainer.Pruy@informatik.uni-erlangen.de>
    Dirce Richards <dirce@zk3.dec.com>
    Nick Sayer <mrapple@quack.kfu.com>
    Frank Kardel <Frank.Kardel@informatik.uni-erlangen.de>
    Ray Schnitzler <schnitz@unipress.com>
    Michael Shields <shields@tembel.org>
    Jeff Steinman <jss@pebbles.jpl.nasa.gov>
    Harlan Stenn <harlan@pfcs.com>
    Kenneth Stone <ken@sdd.hp.com>
    Ajit Thyagarajan <ajit@ee.udel.edu>
    Tomoaki TSURUOKA <tsuruoka@nc.fukuoka-u.ac.jp>
    Paul A Vixie <vixie@vix.com>
    Ulrich Windl <Ulrich.Windl@rz.uni-regensburg.de>

%package doc
License:        MIT License (or similar)
Group:          Documentation/Other
AutoReqProv:    on
Provides:       ntpdoc xntpdoc xntp-doc = 4.2.4
Obsoletes:      ntpdoc xntpdoc xntp-doc <= 4.2.4
Summary:        Additional Package Documentation for ntp

%description doc
The complete set of documentation for building and configuring an NTP
server or client. The documentation is in the form of HTML files
suitable for browsing and contains links to additional documentation at
various web sites.

What about NTP? Understanding and using the Network Time Protocol (A
first try on a non-technical Mini-HOWTO and FAQ on NTP). Edited by
Ulrich Windl and David Dalton.



Authors:
--------
    Mark Andrews <marka@syd.dms.csiro.au>
    Viraj Bais <vbais@mailman1.intel.com>
    Clayton Kirkwood <kirkwood@striderfm.intel.com>
    Karl Berry <karl@owl.HQ.ileaf.com>
    Piete Brooks <Piete.Brooks@cl.cam.ac.uk>
    Steve Clift <clift@ml.csiro.au>
    Casey Crellin <casey@csc.co.za>
    Torsten Duwe <duwe@immd4.informatik.uni-erlangen.de>
    John A. Dundas III <dundas@salt.jpl.nasa.gov>
    Dennis Ferguson <dennis@mrbill.canet.ca>
    Glenn Hollinger <glenn@herald.usask.ca>
    Mike Iglesias <iglesias@uci.edu>
    Jim Jagielski <jim@jagubox.gsfc.nasa.gov>
    Jeff Johnson <jbj@chatham.usdesign.com>
    William L. Jones <jones@hermes.chpc.utexas.edu>
    Dave Katz <dkatz@cisco.com>
    Craig Leres <leres@ee.lbl.gov>
    George Lindholm <lindholm@ucs.ubc.ca>
    Louis A. Mamakos <louie@ni.umd.edu>
    Derek Mulcahy <derek@toybox.demon.co.uk>
    Damon Hart-Davis <d@hd.org>
    Lars H. Mathiesen <thorinn@diku.dk>
    David L. Mills <mills@udel.edu>
    Wolfgang Moeller <moeller@gwdgv1.dnet.gwdg.de>
    Jeffrey Mogul <mogul@pa.dec.com>
    Tom Moore <tmoore@fievel.daytonoh.ncr.com>
    Rainer Pruy <Rainer.Pruy@informatik.uni-erlangen.de>
    Dirce Richards <dirce@zk3.dec.com>
    Nick Sayer <mrapple@quack.kfu.com>
    Frank Kardel <Frank.Kardel@informatik.uni-erlangen.de>
    Ray Schnitzler <schnitz@unipress.com>
    Michael Shields <shields@tembel.org>
    Jeff Steinman <jss@pebbles.jpl.nasa.gov>
    Harlan Stenn <harlan@pfcs.com>
    Kenneth Stone <ken@sdd.hp.com>
    Ajit Thyagarajan <ajit@ee.udel.edu>
    Tomoaki TSURUOKA <tsuruoka@nc.fukuoka-u.ac.jp>
    Paul A Vixie <vixie@vix.com>
    Ulrich Windl <Ulrich.Windl@rz.uni-regensburg.de>

%prep
%setup -q -n ntp-%{version}
# unpack ntp-faq
tar -x -C html -j -f %{S:10}
%patch1
%patch4 -p1
# copy README.SUSE
cp %{S:12} .
tar xzf %{S:13} 
%patch9
%patch10 -p1
%patch11
%patch13
%patch15
%patch16
%patch18

%build
rm -rf acconfig.h
%{?suse_update_config}
autoreconf -fi
export RPM_OPT_FLAGS="$RPM_OPT_FLAGS -W -Wall -Wstrict-prototypes -Wpointer-arith -Wno-unused-parameter -fno-strict-aliasing -fstack-protector"
%ifarch alpha s390x
export RPM_OPT_FLAGS="$RPM_OPT_FLAGS -O0"
%endif
%ifarch ia64
RPM_OPT_FLAGS="$RPM_OPT_FLAGS -ffast-math"
%endif
CFLAGS="$RPM_OPT_FLAGS -fPIE" LDFLAGS="-pie" ./configure \
	--with-binsubdir=bin \
	--bindir=%{_sbindir} \
	--mandir=%{_mandir} \
	--infodir=%{_infodir} \
	--enable-parse-clocks \
	--enable-all-clocks \
	--enable-linuxcaps \
	--enable-ipv6 \
	--with-sntp \
	--enable-ntp-signd \
	--with-lineeditlibs=readline
make %{?_smp_mflags}

%install
%makeinstall
# Change permissions
chmod 644 html/pic/neoclock4x.gif
%fdupes -s html
#
# default configuration
#
%__install -d %{buildroot}/var/lib/ntp/{drift,etc,var/{lib,run/ntp},dev}
%__install -d %{buildroot}/var/run
ln -s ../.. %{buildroot}/var/lib/ntp/var/lib/ntp
ln -s ../lib/ntp/var/run/ntp %{buildroot}/var/run
%__install -m 644 -D %{S:1} %{buildroot}/etc/logrotate.d/ntp
%__install -m 600 -D %{S:2} %{buildroot}/etc/ntp.conf
%__install -m 600 -D %{S:2} %{buildroot}/var/lib/ntp/etc/ntp.conf.iburst
#
# boot scripts
#
%__install -D %{S:3} %{buildroot}/etc/init.d/ntp
%__install -d %{buildroot}/usr/sbin
ln -s ../../etc/init.d/ntp %{buildroot}/usr/sbin/rcntp
#
# fillup sysconfig.ntp
#
%__install -m 644 -D %{S:4} %{buildroot}/var/adm/fillup-templates/sysconfig.ntp
%__install -m 644 -D %{S:5} %{buildroot}/var/adm/fillup-templates/sysconfig.syslog-ntp
#
# install SLP reg file
#
%__install -m 644 -D %{S:6} %{buildroot}/etc/slp.reg.d/ntp.reg
#
# man pages
#
%__install -d %{buildroot}/%{_mandir}/man1
%__install -m 644 man/* %{buildroot}/%{_mandir}/man1
#
# firewall
#
%__install -d %{buildroot}%{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/
%__install -m 644 %{S:7} %{buildroot}%{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/%{name}
#
# Logfile
#
%__install -d %{buildroot}/var/log/
touch %{buildroot}/var/log/ntp
#
# service xml
#
install -d %{buildroot}/usr/share/omc/svcinfo.d/
install -m 644 %{S:14} %{buildroot}/usr/share/omc/svcinfo.d/
install -m 755 %{S:15} %{buildroot}/usr/sbin/
install -m 755 %{S:16} %{buildroot}/usr/sbin/

%clean
%__rm -rf %{buildroot}

%pre
/usr/sbin/groupadd -r ntp 2> /dev/null || :
/usr/sbin/useradd -r -o -g ntp -u 74 -s /bin/false -c "NTP daemon" -d /var/lib/ntp ntp 2> /dev/null || :
/usr/sbin/usermod -g ntp ntp 2>/dev/null || :
test -L /var/run/ntp  || rm -rf /var/run/ntp && :

%preun
%stop_on_removal ntp
# no update? Then remove these files that aren't owned by the package
if [ ${FIRST_ARG:-0} -eq 0 ]; then
     test -e /var/lib/ntp/drift/ntp.drift  && rm -f /var/lib/ntp/drift/ntp.drift
     rm -f /var/lib/ntp/etc/* 2>/dev/null
     test -e /var/log/ntp  && rm -f /var/log/ntp
fi

%post
# Create ntp.keys file
if [ ! -f /etc/ntp.keys ]; then
  tmp=$(dd if=/dev/urandom count=1 2>/dev/null | md5sum)
  tmp=${tmp:0:7} > /etc/ntp.keys
  echo "1 M $tmp" > /etc/ntp.keys
  chown root:ntp /etc/ntp.keys
  chmod 0640 /etc/ntp.keys
fi
# Are we in update mode?
if [ -f /etc/sysconfig/ntp ]; then
	grep -q '^keys /etc/ntp.keys' /etc/ntp.conf || {
        echo "#
# Authentication stuff
#
keys /etc/ntp.keys              # path for keys file
trustedkey 1                    # define trusted keys
requestkey 1                    # key (7) for accessing server variables
# controlkey 15                 # key (6) for accessing server variables
" >> /etc/ntp.conf
}
fi
# update from previous permissions
if [ -f /etc/ntp.conf ]; then
  chown --from=ntp:root root:ntp /etc/ntp.conf
fi
if [ -f /var/lib/ntp/etc/ntp.conf.iburst ]; then
  chown --from=ntp:root root:ntp /var/lib/ntp/etc/ntp.conf.iburst
fi
if /sbin/chkconfig -c ntpd 3 ; then
	%{insserv_force_if_yast ntp}
fi
%{fillup_only -n ntp }
%{fillup_only -n syslog }
if [ ! -f /var/log/ntp ]; then
	touch /var/log/ntp
	chmod 644 /var/log/ntp
fi

%postun
%restart_on_update ntp
%{insserv_cleanup}

%files
%defattr(-,root,root)
%doc COPYRIGHT ChangeLog NEWS README* TODO WHERE-TO-START conf 
%attr(0640,root,ntp) %config(noreplace) %{_sysconfdir}/ntp.conf
%dir %{_sysconfdir}/slp.reg.d
%{_sysconfdir}/init.d/ntp
%config(noreplace) %{_sysconfdir}/slp.reg.d/ntp.reg
%config %{_sysconfdir}/logrotate.d/ntp
%config %{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/ntp
%{_sbindir}/*
/var/lib/ntp
%attr(0640,root,ntp) %config(noreplace) /var/lib/ntp/etc/ntp.conf.iburst
%attr(0755,ntp,ntp) %dir /var/lib/ntp/drift
%{_mandir}/man1/*
/var/adm/fillup-templates/*
%attr(0755,ntp,root) /var/lib/ntp/var/run/ntp
%ghost /var/run/ntp
%ghost %config(noreplace) /var/log/ntp
/usr/share/omc/svcinfo.d/ntp.xml

%files doc
%defattr(-,root,root)
%doc	html/*

%changelog
openSUSE Build Service is sponsored by