# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=user-managerd
pkgver=0.8.5
pkgrel=1
pkgdesc="Daemon for handling Sailfish OS device users"
url="https://github.com/sailfishos/user-managerd"
arch="all"
license="BSD-3-Clause"
depends_dev="
	elogind-dev
	libmce-qt-dev
	libuser-dev
	qt5-qtbase-dev
	sailfish-access-control
	"
makedepends="$depends_dev"
subpackages="$pkgname-dev $pkgname-openrc"
source="https://github.com/sailfishos/user-managerd/archive/$pkgver/user-managerd-$pkgver.tar.gz
	0001-Include-linux-quota.h.patch
	user-managerd.initd
	user-managerd.confd
	"

build() {
	qmake-qt5
	make
}

package() {
	INSTALL_ROOT="$pkgdir" make install

	install -Dm755 "$srcdir"/user-managerd.initd "$pkgdir"/etc/init.d/user-managerd
	install -Dm755 "$srcdir"/user-managerd.confd "$pkgdir"/etc/conf.d/user-managerd

	# We don't ship systemd
	rm -r "$pkgdir"/usr/lib/systemd

	mkdir -p "$pkgdir"/usr/share/dbus-1/system.d/
	mv "$pkgdir"/etc/dbus-1/system.d/* "$pkgdir"/usr/share/dbus-1/system.d/
}

sha512sums="
f6a6635e6d7c233f0b3742373a505ce2b5330e09314788abc43e7a0254d73654cd79f501e10d20a1af192359d68108bb054afc431a696e60ca3b08cb4b0dac28  user-managerd-0.8.5.tar.gz
58e860fcf2015f7f8971e1c73d15a9629d324c85ae4418936a6b5a3c7e39d8430cea77a37326b6b163865ced161d0cb5c664ecf642d025edef217c83db5b846b  0001-Include-linux-quota.h.patch
487de9186cd34de6a18272c2c98f189def80c02480f77da49a1fcbe884320f67532c9ef65b63ef28ba5befec8dc40f7deb320319a9ce5ae73e69c4547deeca2a  user-managerd.initd
b841282b96110ec59a7aa539db0737327b09549d55c78dc4b2c3b28b4a6ad1facf015b3175cb6d3a38f13e47aa6314ef3dc1514a4e60dd653a97409ec54ba706  user-managerd.confd
"
