# Maintainer: Christer Edwards <christer.edwards@gmail.com>

pkgname=salt
pkgver=0.14.0
pkgrel=1
pkgdesc="A remote execution and communication system built on zeromq"
arch=(any)
url="https://github.com/saltstack/salt"
license=("APACHE")
depends=('python2'
         'python2-yaml'
         'python2-jinja'
         'python2-pyzmq'
         'python2-crypto'
         'python2-psutil'
         'python2-msgpack'
         'python2-m2crypto')

backup=('etc/salt/master'
        'etc/salt/minion')

makedepends=()
optdepends=()
options=()
conflicts=('salt-git')

source=("http://pypi.python.org/packages/source/s/${pkgname}/${pkgname}-${pkgver}.tar.gz"
        "salt-master.service"
        "salt-syndic.service"
        "salt-minion.service")

md5sums=('0f9fa32f208356e41ac8e0976e927b41'
         '3a2b032ec37077363c049969105b128e'
         'e4c6adce5087e947c26c5c9d9fc3c9bb'
         '833d31ebee69f5c0e2c0b6c8d345b6d7')

package() {
  cd ${srcdir}/${pkgname}-${pkgver}

  python2 setup.py install --root=${pkgdir}/ --optimize=1

  install -Dm644 ${srcdir}/salt-master.service ${pkgdir}/usr/lib/systemd/system/salt-master.service
  install -Dm644 ${srcdir}/salt-syndic.service ${pkgdir}/usr/lib/systemd/system/salt-syndic.service
  install -Dm644 ${srcdir}/salt-minion.service ${pkgdir}/usr/lib/systemd/system/salt-minion.service

  mkdir -p ${pkgdir}/etc/salt/
  cp ${srcdir}/${pkgname}-${pkgver}/conf/master ${pkgdir}/etc/salt/
  cp ${srcdir}/${pkgname}-${pkgver}/conf/minion ${pkgdir}/etc/salt/
}
