mrtg/mrtg.spec

224 lines
6.6 KiB
RPMSpec

%define with_rrdtool 0
Name: mrtg
Version: 2.17.10
Release: 1mamba
Summary: Multi Router Traffic Grapher
Group: Network/Monitoring
Vendor: openmamba
Distribution: openmamba
Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
Source0: http://oss.oetiker.ch/mrtg/pub/mrtg-%{version}.tar.gz
Source1: mrtg-initscript
Source2: http://my14all.sourceforge.net/14all-1.1.cgi
Patch: %{name}-2.14.6-makefile.patch
URL: https://oss.oetiker.ch/mrtg/pub/
License: GPL
## AUTOBUILDREQ-BEGIN
BuildRequires: glibc-devel
BuildRequires: libgd-devel
BuildRequires: libperl
BuildRequires: libpng-devel
BuildRequires: libz-devel
BuildRequires: perl-Net-SNMP
BuildRequires: perl-devel
## AUTOBUILDREQ-END
Requires: apache >= 2.0.48
Requires: net-snmp >= 5.1
Requires: libgd >= 2.0.17
Requires: perl >= 5.8.0
BuildRequires: libgd-devel >= 2.0.17
%if %with_rrdtool
Requires: rrdtool >= 1.2.0
%endif
Requires: perl-Net-SNMP
%description
The Multi Router Traffic Grapher (MRTG) is a tool to monitor the traffic load on network-links.
MRTG generates HTML pages containing graphical images which provide a LIVE visual representation of this traffic.
Check http://www.ee.ethz.ch/stats/mrtg/ for an example.
MRTG is based on Perl and C and works under UNIX and Windows NT.
MRTG is being successfully used on many sites around the net.
%prep
%setup -q
#%patch -p1 -b .makefile
cat > find_provides.sh << _EOF
#! /bin/sh
%{__find_provides} %{buildroot} %{_target_cpu} | grep -v "perl(Pod"
_EOF
chmod +x find_provides.sh
%define __perl_provides %{_builddir}/mrtg-%{version}/find_provides.sh
%build
%configure
%make
%install
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%makeoldinstall
install -d %{buildroot}%{_sysconfdir}/mrtg
install -d %{buildroot}/var/www/html/mrtg
install -d %{buildroot}%{_initrddir}
install -m744 %{S:1} %{buildroot}%{_initrddir}/mrtg
%if %with_rrdtool
install -d %{buildroot}/var/www/cgi-bin
install -m755 %{S:2} %{buildroot}/var/www/cgi-bin/14all.cgi
%endif
install -d %{buildroot}/var/www/icons/
install -m644 %{buildroot}%{_datadir}/mrtg2/icons/* \
%{buildroot}/var/www/icons/
%clean
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%post
# new install case: make configuration and start the server
if [ $1 -eq 1 ]; then
# NOTE1: if snmpd is not running, an empty configuration
# file for MRTG will be created!
# NOTE2: the default snmp ro community is `hostname -d`
# (see the net-snmp specfile)
if [ ! -e %{_sysconfdir}/mrtg/mrtg.cfg ]; then
cfgmaker \
--global="WorkDir: /var/www/html/mrtg/" \
--global="IconDir: /icons/" \
%if %with_rrdtool
--global="LogFormat: rrdtool" \
%endif
--ifref=descr \
--output %{_sysconfdir}/mrtg/mrtg.cfg \
`hostname -d`@localhost
# sed -i 's|# WorkDir: /home/.*|WorkDir: /var/www/html/mrtg/|' \
# %{_sysconfdir}/mrtg/mrtg.cfg 2>/dev/null
fi
if [ ! -e /var/www/html/mrtg/index.html ]; then
indexmaker \
--enumerate \
--columns=1 \
%if %with_rrdtool
--rrdviewer=/cgi-bin/14all.cgi \
%endif
--output=/var/www/html/mrtg/index.html \
%{_sysconfdir}/mrtg/mrtg.cfg
fi
#chkconfig --add mrtg
#%{_initrddir}/mrtg start
fi
exit 0
%preun
# erase case: erase configuration and stop the server
if [ $1 -eq 0 ]; then
chkconfig --del mrtg
[ -e /var/lock/subsys/mrtg ] && %{_initrddir}/mrtg stop
fi
exit 0
%postun
# update case: just restart the server
if [ $1 -eq 1 ]; then
[ -e /var/lock/subsys/mrtg ] && \
%{_initrddir}/mrtg restart
fi
exit 0
%files
%defattr(-,root,root)
%{_bindir}/*
%dir %{_datadir}/mrtg2
%{_datadir}/mrtg2/*
%dir %{_libdir}/mrtg2
%{_libdir}/mrtg2/*
%dir /var/www/html/mrtg
%if %with_rrdtool
/var/www/cgi-bin/*
%endif
/var/www/icons/*
%{_initrddir}/mrtg
%dir %{_sysconfdir}/mrtg
%dir %{_docdir}/mrtg2
%{_docdir}/mrtg2/*
%{_mandir}/man?/*
%changelog
* Wed Jan 19 2022 Automatic Build System <autodist@mambasoft.it> 2.17.10-1mamba
- automatic version update by autodist
* Sat Aug 07 2021 Automatic Build System <autodist@mambasoft.it> 2.17.8-1mamba
- automatic version update by autodist
* Fri May 15 2020 Automatic Build System <autodist@mambasoft.it> 2.17.7-1mamba
- automatic update by autodist
* Mon Apr 30 2018 Silvan Calarco <silvan.calarco@mambasoft.it> 2.17.4-2mamba
- fix url link as per upstream request
* Wed Aug 08 2012 Automatic Build System <autodist@mambasoft.it> 2.17.4-1mamba
- automatic version update by autodist
* Fri Dec 09 2011 Automatic Build System <autodist@mambasoft.it> 2.17.3-1mamba
- automatic version update by autodist
* Mon Feb 21 2011 Automatic Build System <autodist@mambasoft.it> 2.17.2-1mamba
- automatic update by autodist
* Fri Dec 17 2010 Automatic Build System <autodist@mambasoft.it> 2.17.0-1mamba
- automatic update by autodist
* Sun Jun 06 2010 Automatic Build System <autodist@mambasoft.it> 2.16.4-1mamba
- automatic update by autodist
* Fri Jan 22 2010 Automatic Build System <autodist@mambasoft.it> 2.16.3-1mamba
- automatic update by autodist
* Thu Jan 01 2009 Silvan Calarco <silvan.calarco@mambasoft.it> 2.16.2-1mamba
- automatic update by autodist
* Wed Sep 06 2006 Davide Madrisan <davide.madrisan@qilinux.it> 2.14.6-1qilnx
- update to version 2.14.6 by autospec
- added a new runtime requirement: perl-Net-SNMP
* Thu Jul 27 2006 Davide Madrisan <davide.madrisan@qilinux.it> 2.10.15-2qilnx
- initscript fixed: the mrtg daemon must be run in a environment with UTF-8
disabled
* Tue Nov 30 2004 Silvan Calarco <silvan.calarco@mambasoft.it> 2.10.15-1qilnx
- update to version 2.10.15 by autospec
- removed provides for perl(Pod::*) because it conflicts with Perl package
libraries
* Mon Jul 20 2004 Davide Madrisan <davide.madrisan@qilinux.it> 2.10.14-2qilnx
- added the cgi module 14all.cgi needed to integrate mrtg with rrdtool
- %post script modified again
* Thu Jul 15 2004 Davide Madrisan <davide.madrisan@qilinux.it> 2.10.14-1qilnx
- update to 2.10.14
- fixed %post script
* Fri Jan 09 2004 Davide Madrisan <davide.madrisan@qilinux.it> 2.10.12-1qilnx
- specfile fix: restart mrtg only if it is active
- package updated
* Fri Jul 11 2003 Silvan Calarco <silvan.calarco@qinet.it> 2.9.29-4qilnx
- modified initscript so that mrtg logs to /var/log/mrtg.log
* Tue Jun 12 2003 Silvan Calarco <silvan.calarco@qinet.it> 2.9.29-3qilnx
- added automatic index creation
* Mon Jun 09 2003 Silvan Calarco <silvan.calarco@qinet.it> 2.9.29-2qilnx
- made %post automatic service configuration for localhost
* Fri Jun 06 2003 Silvan Calarco <silvan.calarco@qinet.it> 2.9.29-1qilnx
- creation of mrtg package