# Reference: https://postmarketos.org/uipkg
# Co-Maintainer: Pablo Correa Gomez <pabloyoyoista@postmarketos.org>
# Co-Maintainer: Achill Gilgenast <achill@achill.org>
maintainer="Newbyte <newbyte@postmarketos.org>"
pkgname=postmarketos-ui-phosh
pkgver=27
pkgrel=2
pkgdesc="(Wayland) Mobile UI using GNOME components and apps"
url="https://phosh.mobi"
arch="noarch !armhf"
license="GPL-3.0-or-later"
depends="
	!gnome-settings-daemon-mobile
	!gnome-shell-mobile
	!gnome-shell-mobile-schemas
	!mutter-mobile
	!mutter-mobile-schemas
	bluez
	cellbroadcastd
	greetd-phrog
	phosh
	postmarketos-base-ui-gnome-mobile
	postmarketos-base-ui-qt-tweaks
	postmarketos-base-ui-qt-wayland
	postmarketos-usb-moded
	sound-theme-phosh
	udiskie
	xdg-desktop-portal-phosh
	xdg-desktop-portal-wlr
	"
_pmb_recommends="
	phosh-mobile-settings
	"
_pmb_groups="feedbackd"
install="$pkgname.post-install $pkgname.post-upgrade"
source="
	01_postmarketos-ui-phosh.gschema.override
	mimeapps.list
	udiskie.desktop
	greetd.confd
	greetd-phrog.conf
	"
options="!check pmb:drm pmb:systemd"
subpackages="$pkgname-default-osk:default_osk $pkgname-openrc $pkgname-systemd"

package() {
	install -Dm644 "$srcdir"/01_postmarketos-ui-phosh.gschema.override \
		-t "$pkgdir"/usr/share/glib-2.0/schemas/
	install -Dm644 "$srcdir"/mimeapps.list \
		"$pkgdir"/usr/share/applications/mimeapps.list
	install -Dm644 "$srcdir"/udiskie.desktop \
		"$pkgdir"/etc/xdg/autostart/udiskie.desktop
}

default_osk() {
	install_if="$pkgname=$pkgver-r$pkgrel"
	depends="phosh-osk-stub"
	mkdir -p "$subpkgdir"
}

openrc() {
	install_if="$pkgname=$pkgver-r$pkgrel openrc"
	install="$subpkgname.post-install $subpkgname.post-upgrade"
	depends="greetd-openrc"
	replaces="greetd-openrc"

	install -Dm644 "$srcdir"/greetd.confd \
		"$subpkgdir"/etc/conf.d/greetd
}

systemd() {
	install_if="$pkgname=$pkgver-r$pkgrel systemd"
	depends="libcap-utils"

	install -Dm644 "$srcdir"/greetd-phrog.conf \
		"$subpkgdir"/usr/lib/systemd/system/greetd.service.d/override.conf
}

sha512sums="
3ce42ce9cd55fb80dbd5689bb2b4955b7b296f0487163a3a7ad4eeecc0f874d890aaba76071aabc103dd67d0c8258dc077f202e28325d05b77a610613d1878d9  01_postmarketos-ui-phosh.gschema.override
a741e8db9e4232334b924326c48be4e4c8f7a2382a7608926918a7491c518b2dda551e55a00d4d5fcf58c7950a78dc35d5cc5eaab53ad93a56de40887071f242  mimeapps.list
53f5c565b4ca8a12f12b63ec84a0194ef530703565d123203d41582a35a54d66afaf3a676df158ae0effe327dcfc1c6496a082ce9dbe803b2547417c3c3fad6e  udiskie.desktop
38724b931f4c94a7b716e6ed908babc81c42d7f540bf715eecccd17b82d558886f5816168171ca1c29fbe8bee9bc46ad31e55def44001047f8ac26b796a79eee  greetd.confd
62e75d0cfc1ae8ea63fff43e5f08276c8cde00d7c39f46be17ac547827bdb3a5c09569b020daa54b8acb4dce05220cbb05a0c9ba915ded401ce47f39afcdd4f0  greetd-phrog.conf
"
