%define localstatedir   /var/lib

Summary:            wflogs daemon
Name:               @PACKAGE@
Version:            @VERSION@
Release:            1%{?dist}
License:            GPLv3+
Group:              System Environment/Daemons
Source:             http://www.five-ten-sg.com/%{name}/packages/%{name}-%{version}.tar.gz
BuildRoot:          %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
URL:                http://www.five-ten-sg.com/%{name}/

Requires(post,preun):   /sbin/chkconfig
Requires(post,preun):   /sbin/service
Requires:               coreutils
BuildRequires:          gcc gcc-c++


%description
This is a simple wflogs daemon. It reads a syslog file, and feeds
the data every N seconds to wflogs, which creates a web page. M
versions of the web page are kept.

%prep
%setup -q

%build
%configure
make %{?_smp_mflags}


%install
rm -rf $RPM_BUILD_ROOT
make DESTDIR=$RPM_BUILD_ROOT install
mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d
mkdir -p $RPM_BUILD_ROOT/var/lib/%{name}
mv -f $RPM_BUILD_ROOT%{_sysconfdir}/%{name}        $RPM_BUILD_ROOT/etc/rc.d/init.d


%clean
rm -rf $RPM_BUILD_ROOT


%pre


%post
/sbin/chkconfig --add %{name}


%preun
[ $1 = 0 ] && /sbin/service %{name} stop || :


%postun
[ $1 = 0 ] && /sbin/chkconfig --del %{name}


%files
%defattr(-,root,root,-)
%{_sbindir}/*
%{_mandir}/man1/*
%{_mandir}/man5/*
%docdir %{_datadir}/doc/%{name}-%{version}
%{_datadir}/doc/%{name}-%{version}
/var/lib/%{name}/
%config(noreplace) %{_sysconfdir}/%{name}.conf
/etc/rc.d/init.d/%{name}


%changelog
* Fri May 17 2013 Carl Byington <carl@five-ten-sg.com> - 1.1-1
- allow multiple config contexts
- output optionally triggered by hourly/daily/weekly rollover

* Wed May 15 2013 Carl Byington <carl@five-ten-sg.com> - 1.0-1
- initial revision
