diff --git a/mrtg.crond.in b/mrtg.crond.in new file mode 100644 index 0000000..8bdd0d6 --- /dev/null +++ b/mrtg.crond.in @@ -0,0 +1 @@ +0-59/5 * * * * root @bindir@/mrtg @sysconfdir@/mrtg/mrtg.cfg diff --git a/mrtg.spec b/mrtg.spec index c722c89..343a062 100644 --- a/mrtg.spec +++ b/mrtg.spec @@ -1,19 +1,23 @@ +%define _use_internal_dependency_generator 0 + %define contentdir /var/www/html/%{name} Summary: Multi Router Traffic Grapher Name: mrtg Version: 2.9.17 -Release: 8 +Release: 13 URL: http://ee-staff.ethz.ch/~oetiker/webtools/mrtg/mrtg.html Source0: http://www.ee.ethz.ch/~oetiker/webtools/mrtg/pub/%{name}-%{version}.tar.gz Source1: mrtg.cfg Source2: README-14allcgi Source3: 14all.cgi Source4: filter-requires-mrtg.sh +Source5: mrtg.crond.in License: GPL Group: Applications/Internet Requires: perl >= 5.004 -Requires: gd +Requires: gd +PreReq: vixie-cron, /sbin/service Buildroot: %{_tmppath}/%{name}-%{version}-root BuildPrereq: freetype-devel, gd-devel, libjpeg-devel, libpng-devel @@ -37,6 +41,7 @@ find contrib -name "*.pl" -exec perl -e 's;\015;;gi' -p -i \{\} \; %install rm -rf $RPM_BUILD_ROOT mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/mrtg +mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/cron.d mkdir -p $RPM_BUILD_ROOT%{contentdir} mkdir -p $RPM_BUILD_ROOT%{_bindir} mkdir -p $RPM_BUILD_ROOT%{_libdir}/mrtg2/Pod @@ -46,6 +51,9 @@ install -m 644 images/* $RPM_BUILD_ROOT%{contentdir}/ install -m 644 doc/*.html $RPM_BUILD_ROOT%{contentdir}/ install -m 644 %{SOURCE1} $RPM_BUILD_ROOT/etc/mrtg perl -e 's|\@WORKDIR@|%{contentdir}|g' -pi $RPM_BUILD_ROOT/etc/mrtg/mrtg.cfg +sed -e 's,@bindir@,%{_bindir},g' -e 's,@sysconfdir@,%{_sysconfdir},g' \ + $RPM_SOURCE_DIR/mrtg.crond.in > $RPM_BUILD_ROOT/%{_sysconfdir}/cron.d/mrtg +chmod 644 $RPM_BUILD_ROOT/%{_sysconfdir}/cron.d/mrtg install -m 644 %{SOURCE2} contrib/14all/README install -m 755 %{SOURCE3} contrib/14all @@ -66,18 +74,18 @@ for i in doc/*.1; do install -m 644 $i $RPM_BUILD_ROOT%{_mandir}/man1/ done +# Tell crond to reload its configuration. %post -if ! grep '* * * * root %{_bindir}/mrtg' /etc/crontab > /dev/null; then - echo "" >> /etc/crontab - echo "0-59/5 * * * * root %{_bindir}/mrtg %{_sysconfdir}/mrtg/mrtg.cfg" >> /etc/crontab -fi +/sbin/service crond condrestart 2>&1 > /dev/null || : %postun -if [ $1 = 0 ]; then - grep -v '* * * * root %{_bindir}/mrtg' /etc/crontab > /etc/crontab.new &&\ - cat /etc/crontab.new > /etc/crontab && - rm /etc/crontab.new -fi +/sbin/service crond condrestart 2>&1 > /dev/null || : + +# Add a trigger to remove the system crontab version of our tasks. +%triggerun -- mrtg <= 2.9.17-12 +grep -v '* * * * root %{_bindir}/mrtg' /etc/crontab > /etc/crontab.new &&\ +cat /etc/crontab.new > /etc/crontab && +rm /etc/crontab.new %clean rm -rf $RPM_BUILD_ROOT @@ -87,12 +95,30 @@ rm -rf $RPM_BUILD_ROOT %doc contrib ANNOUNCE CHANGES COPYING COPYRIGHT MANIFEST README THANKS %dir %{_sysconfdir}/mrtg %config(noreplace) %{_sysconfdir}/mrtg/mrtg.cfg +%config %{_sysconfdir}/cron.d/mrtg %{contentdir} %{_bindir}/* %{_libdir}/mrtg2 %{_mandir}/*/* %changelog +* Fri Feb 7 2003 Nalin Dahyabhai 2.9.17-13 +- move crontab data to /etc/cron.d +- add trigger to remove crontab data from /etc/crontab on removal of + older versions + +* Wed Jan 22 2003 Tim Powers +- rebuilt + +* Tue Dec 17 2002 Tim Powers 2.9.17-11 +- PreReq crontabs + +* Sat Dec 14 2002 Tim Powers 2.9.17-10 +- don't use rpms internal dep generator + +* Thu Dec 12 2002 Tim Powers 2.9.17-9 +- rebuild on all arches + * Fri Jun 21 2002 Tim Powers - automated rebuild