]> git.pld-linux.org Git - packages/cacti-template-mail_statistics.git/blame - cacti-template-mail_statistics.spec
- drop obsolete and outdated manual inclusion of rpm macros
[packages/cacti-template-mail_statistics.git] / cacti-template-mail_statistics.spec
CommitLineData
f05ac46b 1%define template mail_statistics
f05ac46b 2Summary: Mail logs Graphing with Cacti
886f2a9e
ER
3Name: cacti-template-%{template}
4Version: 0.1
f05ac46b 5Release: 0.6
886f2a9e
ER
6License: GPL v2
7Group: Applications/WWW
8Source0: http://forums.cacti.net/download/file.php?id=4091#/postfix_mailserver.tar.gz
9# Source0-md5: 3cd539df3669c72b0679f18cbf74f164
10URL: http://forums.cacti.net/about6657.html
f05ac46b
ER
11Patch0: cachetime.patch
12Patch1: more-matches.patch
886f2a9e
ER
13BuildRequires: rpm-perlprov >= 4.1-13
14BuildRequires: rpmbuild(macros) >= 1.554
15Requires: cacti
16BuildArch: noarch
17BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
18
19%define cactidir /usr/share/cacti
20%define resourcedir %{cactidir}/resource
21%define scriptsdir %{cactidir}/scripts
22%define snmpdconfdir /etc/snmp
23%define _libdir %{_prefix}/lib
b110e13e 24%define dbfile /var/spool/postfix/mailstats.db
f05ac46b 25%define agentscript %{_libdir}/snmpd-agent-cacti-mail_statistics
886f2a9e
ER
26# This is officially registered: http://www.oid-info.com/get/1.3.6.1.4.1.16606
27%define snmpoid .1.3.6.1.4.1.16606.2
28
29%description
30Postifix monitoring with Cacti.
31
f05ac46b
ER
32%package -n net-snmp-agent-mail_statistics
33Summary: SNMPd agent to provide mail stats
886f2a9e
ER
34Group: Networking/Daemons
35Requires: net-snmp
36
f05ac46b
ER
37%description -n net-snmp-agent-mail_statistics
38SNMPd agent to provide mail stats for Cacti.
886f2a9e
ER
39
40%prep
41%setup -qc
f05ac46b
ER
42%patch0 -p1
43%patch1 -p1
886f2a9e
ER
44
45%install
46rm -rf $RPM_BUILD_ROOT
47install -d $RPM_BUILD_ROOT{%{resourcedir},%{scriptsdir},%{snmpdconfdir},%{_libdir}}
48cp -a *.xml $RPM_BUILD_ROOT%{resourcedir}
b110e13e
ER
49install -p fetch_mail_statistics.pl $RPM_BUILD_ROOT%{agentscript}
50# ghost the dbfile
51install -d $RPM_BUILD_ROOT$(dirname %{dbfile})
52touch $RPM_BUILD_ROOT%{dbfile}
886f2a9e
ER
53
54%clean
55rm -rf $RPM_BUILD_ROOT
56
57%post
58%cacti_import_template %{resourcedir}/cacti_host_template_postfix_mailserver.xml
59
f05ac46b 60%post -n net-snmp-agent-mail_statistics
886f2a9e 61if ! grep -qF %{snmpoid} %{snmpdconfdir}/snmpd.local.conf; then
a4a4b1ee 62 echo "pass %{snmpoid} cacti_postfix %{agentscript} /var/log/maillog %{dbfile} %{snmpoid}" >> %{snmpdconfdir}/snmpd.local.conf
886f2a9e
ER
63 %service -q snmpd reload
64fi
65
f05ac46b 66%preun -n net-snmp-agent-mail_statistics
886f2a9e
ER
67if [ "$1" = 0 ]; then
68 if [ -f %{snmpdconfdir}/snmpd.local.conf ]; then
a4a4b1ee 69 %{__sed} -i -e "/pass %(echo %{snmpoid} | sed -e 's,\.,\\.,g')/d" %{snmpdconfdir}/snmpd.local.conf
886f2a9e
ER
70 %service -q snmpd reload
71 fi
72fi
73
74%files
75%defattr(644,root,root,755)
76%{resourcedir}/*.xml
77
f05ac46b 78%files -n net-snmp-agent-mail_statistics
886f2a9e 79%defattr(644,root,root,755)
b110e13e
ER
80%attr(755,root,root) %{agentscript}
81%ghost %attr(700,root,root) %{dbfile}
This page took 0.144548 seconds and 4 git commands to generate.