%define gitver .git20170315 # Only Fedora & RHEL 5+ can use selinux %if 0%{?rhel} && "%rhel" < "5" %define without_selinux 1 %endif ### DMN 2023-01-02 - bz#1629858 %define without_selinux 1 %global _version 1.15 %global _rel rc1 %global _iteration 28 %define selinux_variants mls strict targeted Name: mailgraph Version: %{_version}%{?gitver} Release: %{_iteration}%{?dist}%{?repotag:.%{repotag}} Summary: A RRDtool frontend for Mail statistics Group: System Environment/Daemons License: GPL+ URL: http://mailgraph.schweikert.ch/ #Source0: http://mailgraph.schweikert.ch/pub/%{name}-%{version}.tar.gz Source0: mailgraph-master-%version.zip Source1: mailgraph.service Source2: mailgraph.conf Source3: mailgraph.sysconfig Source4: mailgraph.te Source5: mailgraph.fc Source6: mailgraph.if Patch0: paths.patch Patch1: mailgraph-reporting.patch Patch2: mailgraph-noimgscheme.patch Patch100: paths.1.15.patch Patch101: mailgraph-reporting.1.15.patch # Patches prese da https://dokuwiki.nausch.org/doku.php/centos:mail_c7:mta_13 - mailserver.guru/7/os/x86_64/Packages/ che estendono il pacchetto vanilla Patch200: mailgraph.guru.1.15.diff Patch300: mailgraph.lux.1.15.diff BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) ### DMN 2023-01-02 BuildRequires: systemd-rpm-macros %if ! 0%{?without_selinux} BuildRequires: checkpolicy, perl-generators, selinux-policy-devel, hardlink %endif Requires: perl(File::Tail), rrdtool, httpd Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) #Requires: initscripts Requires(post): systemd-units Requires(preun): systemd-units Requires(postun): systemd-units BuildArch: noarch %description Mailgraph is a very simple mail statistics RRDtool frontend for Postfix and Sendmail that produces daily, weekly, monthly and yearly graphs of received/sent and bounced/rejected mail. %if ! 0%{?without_selinux} %package selinux Summary: A RRDtool frontend for Mail statistics Group: System Environment/Daemons %define selinux_policyver %(sed -e 's,.*selinux-policy-\\([^/]*\\)/.*,\\1,' /usr/share/selinux/devel/policyhelp) %if "%{selinux_policyver}" != "" Requires: selinux-policy >= %{selinux_policyver} %endif Requires: %{name} = %{version}-%{release} #Requires(post): /usr/sbin/semodule, /sbin/restorecon, /sbin/fixfiles, %{name} #Requires(postun): /usr/sbin/semodule, /sbin/restorecon, /sbin/fixfiles, %{name} %description selinux This is the selinux policy for mailgraph. %endif %prep %setup -q -n mailgraph-master %patch100 -p1 -b .paths %patch101 -p1 -b .mailgraph-reporting %patch2 -p1 -b .mailgraph-noimgscheme %patch200 -p1 -b .guru %patch300 -p0 -b .lux %if ! 0%{?without_selinux} mkdir selinux cp -p %{SOURCE4} %{SOURCE5} %{SOURCE6} ./selinux/ %build cd selinux for selinuxvariant in %{selinux_variants}; do make NAME=${selinuxvariant} -f %{_datadir}/selinux/devel/Makefile mv %{name}.pp %{name}.pp.${selinuxvariant} make NAME=${selinuxvariant} -f %{_datadir}/selinux/devel/Makefile clean done cd - %endif %install rm -rf %{buildroot} %{__install} -d -m 0755 %{buildroot}%{_sbindir} %{__install} -d -m 0755 %{buildroot}%{_unitdir} %{__install} -d -m 0755 %{buildroot}%{_sysconfdir}/sysconfig %{__install} -d -m 0755 %{buildroot}%{_sysconfdir}/httpd/conf.d %{__install} -d -m 0755 %{buildroot}%{_datadir}/mailgraph %{__install} -d -m 0755 %{buildroot}%{_localstatedir}/lib/mailgraph %{__install} -d -m 0775 %{buildroot}%{_localstatedir}/cache/mailgraph %{__install} -p -m 0755 mailgraph.cgi %{buildroot}%{_datadir}/mailgraph %{__install} -p -m 0644 mailgraph.css %{buildroot}%{_datadir}/mailgraph %{__install} -p -m 0755 mailgraph.pl %{buildroot}%{_sbindir}/mailgraph %{__install} -p -m 0755 %SOURCE1 %{buildroot}%{_unitdir}/mailgraph.service %{__install} -p -m 0644 %SOURCE2 %{buildroot}%{_sysconfdir}/httpd/conf.d/ %{__install} -p -m 0644 %SOURCE3 %{buildroot}%{_sysconfdir}/sysconfig/mailgraph %if ! 0%{?without_selinux} cd selinux for selinuxvariant in %{selinux_variants}; do install -d %{buildroot}%{_datadir}/selinux/${selinuxvariant} install -p -m 644 %{name}.pp.${selinuxvariant} \ %{buildroot}%{_datadir}/selinux/${selinuxvariant}/%{name}.pp done cd - # Hardlink identical policy module packages together /usr/sbin/hardlink -cv %{buildroot}%{_datadir}/selinux %endif %clean rm -rf %{buildroot} %post #/sbin/chkconfig --add %{name} 2>&1 > /dev/null || : if [ $1 -eq 1 ] ; then # Initial installation /bin/systemctl daemon-reload >/dev/null 2>&1 || : fi #if [ "$1" -ge "1" ]; then # /sbin/service %{name} condrestart 2>&1 > /dev/null || : #fi %preun #if [ $1 = 0 ]; then # /sbin/service %{name} stop 2>&1 > /dev/null || : # /sbin/chkconfig --del %{name} 2>&1 > /dev/null || : #fi #exit 0 if [ $1 -eq 0 ] ; then # Package removal, not upgrade /bin/systemctl --no-reload disable mailgraph.service > /dev/null 2>&1 || : /bin/systemctl stop mailgraph.service > /dev/null 2>&1 || : fi %postun #if [ "$1" -ge "1" ]; then # /sbin/service %{name} condrestart 2>&1 > /dev/null || : #fi /bin/systemctl daemon-reload >/dev/null 2>&1 || : if [ $1 -ge 1 ] ; then # Package upgrade, not uninstall /bin/systemctl try-restart mailgraph.service >/dev/null 2>&1 || : fi %if ! 0%{?without_selinux} %post selinux /sbin/service %{name} status &> /dev/null ||: STATUS=$? if [ $STATUS -eq 0 ]; then /sbin/service %{name} stop &> /dev/null ||: fi for selinuxvariant in %{selinux_variants}; do /usr/sbin/semodule -s ${selinuxvariant} -i \ %{_datadir}/selinux/${selinuxvariant}/%{name}.pp &> /dev/null || : done if [ $STATUS -eq 0 ]; then /sbin/service %{name} start &> /dev/null ||: fi # Fix up non-standard file contexts /sbin/fixfiles -R %{name} restore || : /sbin/restorecon -R %{_localstatedir}/cache/%{name} || : /sbin/restorecon -R %{_localstatedir}/lib/%{name} || : %postun selinux # Clean up after package removal if [ $1 -eq 0 ]; then /sbin/service %{name} status &> /dev/null ||: STATUS=$? if [ $STATUS -eq 0 ]; then /sbin/service %{name} stop &> /dev/null ||: fi # Remove SELinux policy modules for selinuxvariant in %{selinux_variants} do /usr/sbin/semodule -s ${selinuxvariant} -r %{name} &> /dev/null || : done if [ $STATUS -eq 0 ]; then /sbin/service %{name} start &> /dev/null ||: fi /sbin/fixfiles -R %{name} restore || : # Clean up any remaining file contexts [ -d %{_localstatedir}/cache/%{name} ] && \ /sbin/restorecon -R %{_localstatedir}/cache/%{name} &> /dev/null || : [ -d %{_localstatedir}/lib/%{name} ] && \ /sbin/restorecon -R %{_localstatedir}/lib/%{name} &> /dev/null || : fi %endif %triggerun -- mailgraph < 1.14-12 # Save the current service runlevel info # User must manually run systemd-sysv-convert --apply mailgraph # to migrate them to systemd targets /usr/bin/systemd-sysv-convert --save mailgraph >/dev/null 2>&1 ||: # Run these because the SysV package being removed won't do them /sbin/chkconfig --del mailgraph >/dev/null 2>&1 || : /bin/systemctl try-restart mailgraph.service >/dev/null 2>&1 || : %files %defattr(-,root,root,-) %dir %{_localstatedir}/lib/mailgraph %dir %attr(0775,root,apache) %{_localstatedir}/cache/mailgraph %{_sbindir}/* %{_datadir}/mailgraph %{_unitdir}/mailgraph.service %config(noreplace) %{_sysconfdir}/sysconfig/mailgraph %config(noreplace) %{_sysconfdir}/httpd/conf.d/mailgraph.conf %doc CHANGES COPYING README %if ! 0%{?without_selinux} %files selinux %defattr(-,root,root,-) %{_datadir}/selinux/*/%{name}.pp %doc selinux/* %endif %changelog * Mon Jan 2 2023 ifas - %{_version}-%{_rel}.%{_iteration} - Rebuilt without selinux (bz#1629858) - source : http://repo.iotti.biz/CentOS/7/srpms/mailgraph-1.15.git20170315-27.el7.lux.src.rpm * Fri Nov 25 2016 Marcus Karlsson - 1.14-27 - Link to rrdtool.gif using url without scheme * Wed Sep 28 2016 Marcus Karlsson - 1.14-26 - Fix syntax error (rhbz#1227493) * Sun May 15 2016 Jitka Plesnikova - 1.14-25 - Perl 5.24 rebuild * Thu Feb 04 2016 Fedora Release Engineering - 1.14-24 - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild * Wed Jun 17 2015 Fedora Release Engineering - 1.14-23 - Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild * Wed Jun 03 2015 Jitka Plesnikova - 1.14-22 - Perl 5.22 rebuild * Sun Sep 14 2014 Bernard Johnson - 1.14-21 - rebuild to fix dependency on perl(:MODULE_COMPAT_5.18.0) - fix FTBFS: queuegraph-1.1-18.fc21: unknown type httpd_queuegraph_script_t (bz#1058803) - fix postscreen DNSBL rejections not counted (bz#1133356) - trim changelog to last 2 years * Thu Aug 28 2014 Jitka Plesnikova - 1.14-20 - Perl 5.20 rebuild * Sat Jun 07 2014 Fedora Release Engineering - 1.14-19 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild * Sat Aug 03 2013 Fedora Release Engineering - 1.14-18 - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild * Wed Jul 17 2013 Petr Pisar - 1.14-17 - Perl 5.18 rebuild * Thu Feb 14 2013 Fedora Release Engineering - 1.14-16 - Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild * Mon Dec 24 2012 Bernard Johnson - 1.14-15 - updated for httpd 2.4 configuration (bz #871415)