# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=ldap-passwd-webui
pkgver=2.1.0
pkgrel=4
pkgdesc="Very simple web interface for changing password stored in LDAP or Active Directory (Samba 4 AD)"
url="https://github.com/jirutka/ldap-passwd-webui"
arch="noarch"
license="MIT"
depends="python3 py3-bottle py3-ldap3"
makedepends="python3-dev"
subpackages="$pkgname-waitress"
source="$pkgname-$pkgver.tar.gz::https://github.com/jirutka/$pkgname/archive/v$pkgver.tar.gz
	$pkgname.confd
	settings.patch"
options="!check"

package() {
	local destdir="$pkgdir/usr/share/webapps/$pkgname"

	mkdir -p "$destdir"
	cp -r static app.py index.tpl "$destdir"/

	install -D -m 644 settings.ini.example "$pkgdir"/etc/$pkgname.ini
}

waitress() {
	pkgdesc="Runscript for ldap-passwd-webui using Waitress WSGI server"
	depends="$pkgname=$pkgver-r$pkgrel py3-waitress"

	mkdir -p "$subpkgdir"/etc/init.d
	ln -s waitress "$subpkgdir"/etc/init.d/$pkgname
	install -D -m 644 "$srcdir"/$pkgname.confd "$subpkgdir"/etc/conf.d/$pkgname
}

sha512sums="3e54766ad13561613570160fa509bf64d5769e977593c36da4b35591d6a98556093eacb8d95db052c10e911a8365678c70faefe47b5f091bb56d448323ae7e2a  ldap-passwd-webui-2.1.0.tar.gz
a1f10fbd2261e86ac249efe6571b6c42c398cd17566b602fb0a94e1c9c755da09e73ee7a1bd839181d552ffd74ea7e99352efb51b01a1a27db707e29312b8120  ldap-passwd-webui.confd
5ef037c933c012ad057b01a81188c691b2ea99c6f80e4feb68e2d5424e373fa411844bf7681fb50750f5c4f11afacb20d84e849566e9a731c9890a0d7f5ca46b  settings.patch"
