# Maintainer: Oliver Smith <ollieparanoid@postmarketos.org>
# Co-maintainer: Clayton Craft <clayton@craftyguy.net>
# pmbootstrap installs this, if systemd is selected in "pmbootstrap init".
pkgname=postmarketos-base-systemd
pkgver=28
pkgrel=0
pkgdesc="Meta package for running postmarketOS with systemd"
url="https://postmarketos.org"
arch="noarch"
license="GPL-3.0-or-later"
options="!check"

# systemd <-> util-linux is an expected cycial dependency
# Also we can't parse .note.dlopen yet.
#
# Optional dependencies by systemd, but needed on an actual system:
# less
# login-utils
# so:libkmod.so.2
depends="
	kbd
	kmod
	less
	linux-pam-pmos
	login-utils
	polkit>9990
	rtkit
	so:libkmod.so.2
	systemd
	systemd-services
	systemd-timesyncd
	tzdata
	"
replaces="alpine-baselayout postmarketos-base systemd systemd-logind"
replaces_priority=100

_source644="
	etc/motd.ansi
	etc/profile.d/99motd.sh
	etc/systemd/logind.conf
	usr/share/mkinitfs/files-extra/01-initramfs-base-systemd.files
	usr/lib/systemd/system-preset/90-base.preset
	usr/lib/systemd/user-preset/90-base.preset
"

_source755="
	usr/bin/setup-timezone
"

flatpath() {
	local i
	for i in $@; do
		echo "rootfs-$i" | sed s./.-.g
	done
}
source="$(flatpath $_source644 $_source755)"

package() {
	local i
	for i in $_source644; do
		install -Dm644 "$srcdir/$(flatpath "$i")" "$pkgdir/$i"
	done
	for i in $_source755; do
		install -Dm755 "$srcdir/$(flatpath "$i")" "$pkgdir/$i"
	done

	# This gets printed still so overwrite it with an empty file.
	touch $pkgdir/etc/motd
}

sha512sums="
793ee54a0313a0a20664e8dd90561376b3d5f9b870d292a77ab8fc7507f7f5c6d648e7de6ee98916be3702fcdaac5ca8b3648b33503547e419d0fe683bf77baa  rootfs-etc-motd.ansi
fbaa33425e507062a454f11bda48508f261c2144e5c23a20f567dc1cef14ce1dec57f8d934f418f5b6095509757f8503481aba9790a04c8f9f6995e65833d8c9  rootfs-etc-profile.d-99motd.sh
2faac294bb632762e247b850f09ff4b544ccff6c462efd8d4faca71ba30bdfa9c460377a0dc88e92c5dbbe251017d164064a56ac0e0410f224b45d4f5f81866c  rootfs-etc-systemd-logind.conf
15423bfda57c90ab62fe69865ca4072a0aeb83bf77d9c278257e346f4da81843d010b41003c91ae9f3fcb1c67447645e7c19078eea2bf11312051e6ad7523ad1  rootfs-usr-share-mkinitfs-files-extra-01-initramfs-base-systemd.files
9dd11b4b18712b50d93b4f7c6d7745c5da710707809d1fe6cc755ff943031f3fceae4ddef4be3aeff73051a8bbdc262d6b1307469f0fc21e0fcf1083ac309d7c  rootfs-usr-lib-systemd-system-preset-90-base.preset
c7ec5a4e7c7dcbf855f34e80adb225f52221340099216e57792b04f07e7b367e004209551e9a74152d9212926aba1b1a0a2680d3c2e35f15cca6f3cf0c9a3841  rootfs-usr-lib-systemd-user-preset-90-base.preset
605df1f004783d2e0ec5dd99a688bca27502c8c24bc05fb4dc26589b2070b0fbd1cf9bd56e6861d7cda2f8ac8147e7eb040acfd886185c01c8cf9de8b1ce2dcd  rootfs-usr-bin-setup-timezone
"
