%define htmldir %{_localstatedir}/www/html/%{name}
%define vacationgroupid 65423
%define vacationuserid 65423
Name: postfixadmin
Version: 2.93
Release: 2mamba
Summary: A Web Based Management tool for Postfix
Group: Applications/Web
Vendor: openmamba
Distribution: openmamba
Packager: Silvan Calarco
URL: http://sourceforge.net/projects/postfixadmin/
Source: http://downloads.sourceforge.net/project/postfixadmin/postfixadmin/postfixadmin-%{version}/postfixadmin-%{version}.tar.gz
Source1: %{name}-httpd.d.conf
Source2: %{name}-vacation.conf
Patch0: %{name}-2.2.1.1-css_menu_width.patch
Patch1: %{name}-2.3-fix_php_path.patch
Patch2: postfixadmin-2.91-fetchmail-fix-extra-ssl-options.patch
Patch3: postfixadmin-2.93-mariadb-5.5.patch
Patch4: postfixadmin-2.93-fetchmail-mariadb-5.5.patch
License: GPL
## AUTOBUILDREQ-BEGIN
BuildRequires: perl-Imap
BuildRequires: perl-devel
## AUTOBUILDREQ-END
Requires: mysql >= 4.1.22, mysql-client >= 4.1.22
Requires(pre): postfix >= 2.3.8
Requires: httpd, apache-mod_php
Requires: php-mysqli >= 5.1.5
Requires: php-imap
Requires: perl-LockFile-Simple
Requires: perl-DBD-mysql
Requires: fetchmail
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-root
%description
Postfix Admin is a Web Based Management tool created for Postfix.
It is a PHP based application that handles Postfix Style Virtual Domains and Users that are stored in MySQL.
Postfix Admin supports:
- Virtual Mailboxes / Virtual Aliases / Forwarders.
- Domain to Domain forwarding / Catch-All.
- Vacation (auto-response) for Virtual Mailboxes.
- Quota / Alias & Mailbox limits per domain.
- Backup MX.
- Packaged with over 25 languages...
%package cyrus
Group: Applications/Web
Summary: Postfixadmin support files for cyrus-imap
Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release}
%description cyrus
Postfixadmin support files for cyrus-imap.
%prep
%setup -q
#%patch0 -p1
#%patch1 -p1
#%patch2 -p1
%patch3 -p1
%patch4 -p1
%build
%install
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
install -d %{buildroot}%{htmldir} %{buildroot}%{_datadir}/postfixadmin
cp -a * %{buildroot}%{htmldir}
#install -m0644 DOCUMENTS/BACKUP_MX.txt DOCUMENTS/FAQ.txt DOCUMENTS/LANGUAGE.txt \
# DOCUMENTS/POSTFIX_CONF.txt DOCUMENTS/SECURITY.txt DOCUMENTS/UPGRADE.txt \
# DOCUMENTS/DOVECOT.txt DOCUMENTS/HORDE.txt DOCUMENTS/POSTFIXADMIN.txt \
# DOCUMENTS/SUPERADMIN.txt
# %{buildroot}%{_datadir}/postfixadmin/
#install CHANGELOG.TXT %{buildroot}%{htmldir}
#rm -rf %{buildroot}%{htmldir}/DOCUMENTS
#mv %{buildroot}%{htmldir}/config.inc.php.sample %{buildroot}%{htmldir}/config.inc.php
rm -rf %{buildroot}%{htmldir}/templates/{footer,menu}.tpl.orig
#sed -i "s|AuthUserFile .*|AuthUserFile %{htmldir}/admin/.htpasswd|" %{buildroot}%{htmldir}/admin/.htaccess
install -D -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/httpd/httpd.d/postfixadmin.conf
# configure vacation support
install -d %{buildroot}/var/spool/vacation
cp %{buildroot}%{htmldir}/VIRTUAL_VACATION/vacation.pl %{buildroot}/var/spool/vacation
install -D -m 0600 %{SOURCE2} %{buildroot}%{_sysconfdir}/mail/postfixadmin/vacation.conf
cat > %{buildroot}%{_sysconfdir}/mail/postfixadmin/vacation.conf << _EOF
_EOF
# configure cyrus imap support
cp %{buildroot}%{htmldir}/ADDITIONS/cyrus/cyrus.conf %{buildroot}%{_sysconfdir}/mail/postfixadmin/cyrus.conf
rm -rf %{buildroot}%{htmldir}/debian
#rm -f %{buildroot}%{htmldir}/*.TXT
install -d -m0755 %{buildroot}%{_localstatedir}/run/fetchmail
%clean
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
#%post
## new install
#if [ $1 -eq 1 ]; then
# mysql -u root < %{_datadir}/postfixadmin/DATABASE_MYSQL.TXT
#fi
#exit 0
%pre
if [ $1 -ge 1 ]; then
/usr/sbin/groupadd vacation -g %{vacationgroupid} 2>/dev/null
/usr/sbin/useradd -c "Virtual Vacation" -u %{vacationuserid} -d /dev/null -g vacation \
-s /bin/nologin vacation 2>/dev/null
fi
exit 0
%preun
if [ $1 -eq 0 ]; then
/usr/sbin/groupdel vacation 2>/dev/null
/usr/sbin/userdel vacation 2>/dev/null
fi
exit 0
%files
%defattr(-,root,root)
%config(noreplace) %attr(0640,root,nobody) %{_sysconfdir}/httpd/httpd.d/postfixadmin.conf
%config(noreplace) %attr(0600,vacation,vacation) %{_sysconfdir}/mail/postfixadmin/vacation.conf
#%config %attr(0640,root,nobody) %{htmldir}/admin/.htaccess
#%config(noreplace) %attr(0640,root,nobody) %{htmldir}/admin/.htpasswd
%attr(0755,root,root) %dir %{htmldir}
%attr(-,apache,nobody) %{htmldir}/css/*
%config(noreplace) %attr(0640,apache,nobody) %{htmldir}/config.inc.php
%attr(-,apache,nobody) %{htmldir}/*.php
%attr(-,apache,nobody) %{htmldir}/calendar.js
%dir %{htmldir}/DOCUMENTS
%{htmldir}/DOCUMENTS/*
%dir %{htmldir}/ADDITIONS
%dir %{htmldir}/ADDITIONS/squirrelmail-plugin
%{htmldir}/ADDITIONS/squirrelmail-plugin/*
%{htmldir}/ADDITIONS/README.TXT
%{htmldir}/ADDITIONS/change_password.tgz
%{htmldir}/ADDITIONS/*.pl
%{htmldir}/ADDITIONS/import_users_from_csv.py
%{htmldir}/ADDITIONS/postfixadmin-domain-postdeletion.sh
%{htmldir}/ADDITIONS/postfixadmin-mailbox-postcreation.sh
%{htmldir}/ADDITIONS/postfixadmin-mailbox-postdeletion.sh
%{htmldir}/ADDITIONS/virtualmaildel.php
%dir %attr(-,apache,nobody) %{htmldir}/configs
%attr(-,apache,nobody) %{htmldir}/configs/menu.conf
%dir %attr(-,apache,nobody) %{htmldir}/images
%attr(-,apache,nobody) %{htmldir}/images/*.png
%attr(-,apache,nobody) %{htmldir}/images/*.gif
%dir %attr(-,apache,nobody) %{htmldir}/images/calendar
%attr(-,apache,nobody) %{htmldir}/images/calendar/*
%attr(-,apache,nobody) %{htmldir}/images/postfixadmin2.xcf
%attr(-,apache,nobody) %{htmldir}/images/index.php
%dir %attr(-,apache,nobody) %{htmldir}/languages
%attr(-,apache,nobody) %{htmldir}/languages/*
%dir %attr(-,apache,nobody) %{htmldir}/model
%attr(-,apache,nobody) %{htmldir}/model/*
%dir %attr(-,apache,nobody) %{htmldir}/scripts
%attr(-,apache,nobody) %{htmldir}/scripts/*
%dir %attr(-,apache,nobody) %{htmldir}/smarty
%attr(-,apache,nobody) %{htmldir}/smarty/*
%dir %attr(-,apache,nobody) %{htmldir}/templates
%attr(-,apache,nobody) %{htmldir}/templates/*
%dir %attr(-,apache,nobody) %{htmldir}/templates_c
%dir %attr(-,apache,nobody) %{htmldir}/users
%attr(-,apache,nobody) %{htmldir}/users/*
%attr(-,apache,nobody) %dir %{htmldir}/VIRTUAL_VACATION
%attr(-,apache,nobody) %{htmldir}/VIRTUAL_VACATION/*
%attr(-,apache,nobody)%{htmldir}/tests
%attr(0700,vacation,vacation) %dir /var/spool/vacation
%attr(0700,vacation,vacation) /var/spool/vacation/vacation.pl
%{htmldir}/CHANGELOG.TXT
%{htmldir}/GPL-LICENSE.TXT
%{htmldir}/INSTALL.TXT
%{htmldir}/LICENSE.TXT
%dir %attr(0750,vmail,vmail) %{_localstatedir}/run/fetchmail
%files cyrus
%defattr(-,root,root)
%config(noreplace) %{_sysconfdir}/mail/postfixadmin/cyrus.conf
%dir %{htmldir}/ADDITIONS/cyrus/*
%changelog
* Tue Apr 19 2016 Silvan Calarco 2.93-2mamba
- patch in Fetchmail handler for mysql/mariadb 5.5
* Sat Oct 10 2015 Automatic Build System 2.93-1mamba
- automatic version update by autodist
* Sat Nov 01 2014 Automatic Build System 2.92-1mamba
- automatic version update by autodist
* Sat Jun 21 2014 Silvan Calarco 2.91-1mamba
- update to 2.91
* Sat Jun 21 2014 Silvan Calarco 2.3.7-3mamba
- require fetchmail, perl-LockFile-Simple and other perl requirements for fetchmail.pl
- provide /var/run/fetchmail required by fetchmail.pl
* Sat Jun 21 2014 Silvan Calarco 2.3.7-2mamba
- require php-imap
* Thu Feb 27 2014 Automatic Build System 2.3.7-1mamba
- automatic update by autodist
* Tue Jan 15 2013 Automatic Build System 2.3.6-1mamba
- automatic version update by autodist
* Sat Sep 29 2012 Silvan Calarco 2.3.5-2mamba
- replace config.inc.php to match new changes; use config.local.php for custom settings
* Mon Apr 09 2012 Silvan Calarco 2.3.5-1mamba
- update to 2.3.5
* Wed Sep 21 2011 Silvan Calarco 2.3.4-1mamba
- update to 2.3.4
* Fri Jun 04 2010 Automatic Build System 2.3-1mamba
- update to 2.3
* Thu Mar 19 2009 Silvan Calarco 2.2.1.1-1mamba
- update to 2.2.1.1
* Fri May 25 2007 Silvan Calarco 2.1.0-3mamba
- change group from apache to nobody
* Thu May 24 2007 Silvan Calarco 2.1.0-2mamba
- rebuilt
* Tue Mar 13 2007 Silvan Calarco 2.1.0-1qilnx
- package created by autospec