# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
setvar pkgname = 'ssh-ldap-pubkey'
setvar pkgver = '1.2.0'
setvar pkgrel = '0'
setvar pkgdesc = ""Utility to manage SSH public keys stored in LDAP""
setvar url = ""https://github.com/jirutka/ssh-ldap-pubkey""
setvar arch = ""noarch""
setvar license = ""MIT""
setvar depends = ""python3 py3-pyldap py3-docopt""
setvar makedepends = ""python3-dev""
setvar install = ""$pkgname.post-install""
setvar subpackages = ""$pkgname-doc""
setvar source = ""$pkgname-$pkgver.tar.gz::https://github.com/jirutka/$pkgname/archive/v$pkgver.tar.gz
	ldap.conf.patch""
setvar builddir = ""$srcdir/$pkgname-$pkgver""

proc prepare {
	default_prepare || return 1

	sed -i 's|/etc/ldap.conf|/etc/ssh-ldap-pubkey.conf|g' bin/ssh-ldap-pubkey
}

proc build {
	cd $builddir
	python3 setup.py build
}

proc package {
	cd $builddir

	python3 setup.py install --prefix=/usr --root="$pkgdir" || return 1

	install -m 644 -D etc/ldap.conf \
		"$pkgdir"/etc/ssh-ldap-pubkey.conf || return 1

	mkdir -p "$pkgdir"/usr/share/doc/$pkgname
	cp README.md etc/openssh-lpk.schema "$pkgdir"/usr/share/doc/$pkgname/
}

setvar sha512sums = ""53ee56ba279a67c4621b9673248cfbd94a4510efb8cee82d9793824f60f671502d8045ae25727548532b547234b5dfca37c9e2d86bd73c811e2e64f7005fbec7  ssh-ldap-pubkey-1.2.0.tar.gz
5b96dd8b1150eb62db7d33d1eee5ed9b28ebaf487c6a8cab6ba1d66d14496c2fdb1c73c1c0959ccd99ea53359b8d82861b7416dc0351bfa22ccfe59b5f530564  ldap.conf.patch""