# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=icingaweb2-module-businessprocess
_module=${pkgname/*-/}
pkgver=2.5.1
pkgrel=0
pkgdesc="Manage Business Processes in Icinga Web 2"
url="https://icinga.com/"
arch="noarch !x86 !armhf !armv7 !s390x"
license="GPL-2.0"
_php=php8
depends="icingaweb2-module-director"
pkggroups="icingaweb2"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/Icinga/icingaweb2-module-businessprocess/archive/v$pkgver.tar.gz"

build() {
	return 0
}

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 application library public \
		module.info run.php configuration.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 module enable $_module

EOF

}

sha512sums="
bd87cc3d1f4c673f7cacca6106320befdf1d10f312de45d4ac66b1844dc7a6ccc8faf90221d46f5c6ec3f4f05bbd7d8c84d6d8533ab7281bd8ba8d1458445e8a  icingaweb2-module-businessprocess-2.5.1.tar.gz
"
