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