# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=icingaweb2-module-fileshipper
_module=${pkgname/*-/}
pkgver=1.0.0
pkgrel=1
pkgdesc="Provide CSV, JSON, XML and YAML files as an Import Source for the Icinga Director"
url="http://www.icinga.org"
arch="noarch !armhf"
license="GPL-2.0"
_php=php7
depends="icingaweb2-module-director ${_php}-xml"
pkggroups="icingaweb2"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/Icinga/$pkgname/archive/v$pkgver.tar.gz"
builddir="$srcdir/$pkgname-$pkgver"

build() {
	cd "$builddir"
	return 0
}

package() {
	cd "$builddir"
	mkdir -p "$pkgdir/etc/icingaweb2/modules/$_module"
	mkdir -p "$pkgdir/usr/share/doc/$pkgname"
	mkdir -p "$pkgdir/usr/share/webapps/icingaweb2/modules/$_module"
	cp -a library module.info run.php \
		"$pkgdir/usr/share/webapps/icingaweb2/modules/$_module"
	cp -a doc "$pkgdir/usr/share/doc/$pkgname"
	chgrp -R $pkggroups "$pkgdir/etc/icingaweb2/modules/$_module"
	cat >"$pkgdir"/usr/share/doc/$pkgname/README.alpine <<EOF
You need to fix /etc/icingaweb2/modules/$_module with the owner of the user of your webserver

For nginx, as example:
    # chown -R nginx /etc/icingaweb2/modules/$_module
or
    # chown -R nobody /etc/icingaweb2/modules/$_module

For Apache:
    # chown -R apache /etc/icingaweb2/modules/$_module

For lighttpd:
    # chown -R lighttpd /etc/icingaweb2/modules/$_module

Remember to enable the module with:

    # icingacli module enable $_module

EOF

}

md5sums="ad53558be08e7953c9533772dbff1311  icingaweb2-module-fileshipper-1.0.0.tar.gz"
sha256sums="ccaaf02022ffc3769aafaeec397675b41cf06801540d6901c4f086e4e3d95d9b  icingaweb2-module-fileshipper-1.0.0.tar.gz"
sha512sums="05c1a6d1313edd795aae1adbe4b21027ff03e4a5bcdb8555ade7c79b9e1cd2e7fa510cd3b2e76b0e7b0ca6e32f6ad6b4763b911038d32de95e305637b3e2aafa  icingaweb2-module-fileshipper-1.0.0.tar.gz"
