pkgbase=supplemental-web
pkgname=('supplemental-web' 'supplemental-web-slave')
pkgver=8.4
pkgrel=3
arch=('i686' 'x86_64')
license=('GPL')
backup=('data/srv/httpd/cgi/extra.cfg.txt')
source=(supplemental-web.conf supplemental-web.include extra.cfg.txt wakeonlan.sh slaveserve.py supplemental_slave.rules supplemental_web.rules )

package_supplemental-web() {
    pkgdesc="supplemental-web package for master backend"
    depends=('wol' 'etherwake' 'lighttpd' 'php' 'fcgi' 'python2' 'xymonserver' 'certmaster' 'func' 'python_aosd' 'shellinabox')
    install=supplemental-web.install
    replaces=('local-website')
    conflicts=('local-website')

    MVDIR=$pkgdir/usr/MythVantage
    install -m744 -D supplemental-web.conf $pkgdir/etc/gen_light_conf.d/supplemental-web.conf
    mkdir -p ${pkgdir}/etc/lighttpd
    install -D -m 644 ${srcdir}/supplemental-web.include ${pkgdir}/etc/lighttpd/
    install -m755 -D wakeonlan.sh $MVDIR/bin/wakeonlan.sh
    #   install -m755 -D backend_control.sh $MVDIR/bin/backend_control.sh
    mkdir -p $pkgdir/data/srv/httpd/htdocs/
    cp -rp $startdir/contents/* $pkgdir/data/srv/httpd/htdocs
    chmod -R 755 $pkgdir/data/srv/httpd/htdocs
    mkdir -p $pkgdir/data/srv/httpd/
    cp -rp $startdir/cgi $pkgdir/data/srv/httpd/
    install -m755 -D $srcdir/extra.cfg.txt $pkgdir/data/srv/httpd/cgi/extra.cfg.txt
    #sudo rules
    install -D -m400 $srcdir/supplemental_web.rules $pkgdir/etc/sudoers.d/supplemental_web
    chmod 750 $pkgdir/etc/sudoers.d
}

package_supplemental-web-slave() {
    pkgdesc="supplemental-web package for slave backend"
    depends=('python2' 'func' 'python_aosd' 'LinHES-system>=2-50')
    conflicts=("supplemental-web" "local-website")
    mkdir -p $pkgdir/data/srv/httpd/
    cp -rp $startdir/cgi $pkgdir/data/srv/httpd/
    chown -R root:root $pkgdir/data/srv/httpd/
    chmod -R 755 $pkgdir/data/srv/httpd/

    install -m755 -D $srcdir/slaveserve.py $pkgdir/data/srv/httpd/cgi/slaveserve.py
    #sudo rules
    install -D -m400 $srcdir/supplemental_slave.rules $pkgdir/etc/sudoers.d/supplemental_slave
    chmod 750 $pkgdir/etc/sudoers.d
}

md5sums=('250b30ffb725a23c019b84cce2415d57'
         'a2497205c92ad5b3aa565574afbf7f80'
         '3d8c7b430c1319d706ca420825918d2a'
         '26598fd1dfaf5d36d7b1f9620da5543c'
         'fabf825ca07502db40d78f0aae15f90b'
         'b41eeb0f0aa67ea06aedff61e53fa774'
         'd7be6bc265b2b9e775b090b6ac2448da')