# Maintainer: Sven-Hendrik Haase <sh@lutzhaase.com>
# Contributor: Filip <fila pruda.com>
pkgname=postfixadmin
pkgver=2.91
pkgrel=2
pkgdesc="A web based interface used to manage mailboxes, virtual domains and aliases created for Postfix"
arch=('any')
license=('GPL')
url="http://postfixadmin.sourceforge.net/"
backup=(etc/webapps/postfixadmin/config.inc.php
        etc/webapps/postfixadmin/.htaccess)
depends=('php')
optdepends=('mariadb: MySQL server'
            'postgresql: PostgreSQL server')
source=(http://downloads.sourceforge.net/postfixadmin/${pkgname}-${pkgver}.tar.gz)
md5sums=('a6e12ebae8f69b489bab56601fe1e533')

package() {
  _destdir=$pkgdir/usr/share/webapps/postfixAdmin
  _destdir_etc=$pkgdir/etc/webapps/postfixadmin
  _destdir_doc=$pkgdir/usr/share/doc/postfixadmin
  
  install -dm755 ${_destdir}
  install -dm755 ${_destdir_etc}
  install -dm755 ${_destdir_doc}
  
  cd $srcdir/$pkgname-$pkgver
  cp -r * ${_destdir}
  
  # config
  mv ${_destdir}/config.inc.php ${_destdir_etc}
  ln -s /etc/webapps/postfixadmin/config.inc.php ${_destdir}/config.inc.php
  echo "#deny from all" >${_destdir_etc}/.htaccess
  ln -s /etc/webapps/postfixadmin/.htaccess ${_destdir}/.htaccess

  # template cache needs to be writeable
  chown http:http ${_destdir}/templates_c
  
  # docs
  mv ${_destdir}/{*.TXT,tests,ADDITIONS,DOCUMENTS,VIRTUAL_VACATION} ${_destdir_doc}
  rm -rf ${_destdir}/debian
}
