# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=icingaweb2-module-incubator
_module=${pkgname/*-/}
pkgver=0.22.0
pkgrel=0
pkgdesc="Bleeding edge libraries useful for Icinga Web 2 modules"
url="https://github.com/Icinga/icingaweb2-module-incubator"
arch="noarch !armhf !armv7 !s390x !x86"
license="MIT"
options="!check"
_php=php82
depends="icingaweb2"
pkggroups="icingaweb2"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/Icinga/$pkgname/archive/v$pkgver.tar.gz"

package() {
	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 vendor composer.json composer.lock module.info run.php \
		"$pkgdir/usr/share/webapps/icingaweb2/modules/$_module"
	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

}

sha512sums="
dd282751b3a6b213d83d48aca1343294373f34d737899d7589329dde830337bddfd2f53eaed8a4b4f4895b1ec8494732dfddca871eead179ebe4d9ec5a14bee7  icingaweb2-module-incubator-0.22.0.tar.gz
"
