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