# Template file for 'fmd-server'
pkgname=fmd-server
version=0.15.0
revision=1
build_style=go
go_import_path="fmd-server"
hostmakedepends="unzip"
short_desc="Server to communicate with the FMD Android app"
maintainer="Joel Beckmeyer <joel@beckmeyer.us>"
license="GPL-3.0-or-later"
homepage="https://fmd-foss.org/"
changelog="https://gitlab.com/fmd-foss/fmd-server/-/releases"
distfiles="https://packages.fmd-foss.org/server/fmd-server-v${version}.zip
 https://gitlab.com/fmd-foss/fmd-server/-/archive/v${version}/fmd-server-v${version}.tar.gz"
checksum="027c6d807594b68c76055b54a3250f31edb83624ee6ba673e22b497ce0db5df4
 60155890fee85ccce2066f682e84a60493e174ef647b618070189e65b580987a"
skip_extraction="fmd-server-v${version}.zip"

system_accounts="_fmd_server"
make_dirs="/var/lib/fmd-server 0700 _fmd_server _fmd_server"
_fmd_server_homedir="/var/lib/fmd-server"
conf_files="/etc/fmd-server/config.yml"

post_extract() {
	unzip "$XBPS_SRCDISTDIR/$pkgname-$version/fmd-server-v${version}.zip" -d prebuilt/
	cp -r prebuilt/web .
	rm -rf prebuilt
}

post_install() {
	vsv fmd-server
	vinstall config.example.yml 640 etc/fmd-server config.yml
}
