# Template file for 'NetAuth'
pkgname=NetAuth
version=0.6.1
revision=6
build_style=go
build_helper="qemu"
go_import_path="github.com/netauth/netauth"
go_package="${go_import_path}/cmd/netauth
 ${go_import_path}/cmd/nsutil
 ${go_import_path}/cmd/netauthd"
short_desc="Network authentication and identity system"
maintainer="Michael Aldridge <maldridge@netauth.org>"
license="MIT"
homepage="https://netauth.org"
distfiles="https://github.com/NetAuth/NetAuth/archive/v$version.tar.gz"
checksum=cf84b2e63b7a59ec6e415ead1a94994b040b30fee2b27e482073371cfb0fb444

post_install() {
	for sh in bash zsh; do
		vtargetrun ${DESTDIR}/usr/bin/netauth system cli ${sh} netauth.${sh}
		vcompletion netauth.${sh} ${sh} netauth
	done
	mkdir manpages
	vtargetrun ${DESTDIR}/usr/bin/netauth system cli man manpages
	for p in manpages/*; do
		vman "${p}"
	done
	vlicense LICENSE
	vsv netauthd
}

NetAuth-server_package() {
	short_desc+=" - server"
	depends="${sourcepkg}>=${version}_${revision}"
	make_dirs="/var/lib/netauth 0755 _netauth _netauth"
	system_group="_netauth"
	system_accounts="_netauth"
	_netauth_homedir="/var/lib/netauth"
	_netauth_shell="/bin/nologin"
	_netauth_descr="Unprivileged service account"
	_netauth_pgroup="_netauth"
	pkg_install() {
		vmove usr/bin/netauthd
		vmove etc/sv/netauthd
	}
}
