# Reference: <https://postmarketos.org/devicepkg>
maintainer="winbo-yml-exe <winbo.yml@proton.me>"
pkgname=device-raspberry-pi5
pkgver=9
pkgrel=0
pkgdesc="Raspberry Pi 5"
url="https://postmarketos.org"
license="MIT"
arch="aarch64"
options="!check !archcheck"
depends="
	linux-firmware-brcm
	linux-rpi
	postmarketos-base
	raspberrypi-bootloader
	"
makedepends="devicepkg-dev"
subpackages="
	$pkgname-openrc
	$pkgname-plasma-bigscreen:plasma_bigscreen
	$pkgname-udev
	"
source="
	deviceinfo
	kernel-cmdline.conf
	modules-initfs
	usercfg.txt
	95-vchiq-permissions.rules
	enforce-platform.sh
	"

build() {
	devicepkg_build $startdir $pkgname
}

package() {
	devicepkg_package $startdir $pkgname
	install -Dm644 "$srcdir"/usercfg.txt "$pkgdir"/boot/usercfg.txt
	install -Dm644 "$srcdir"/95-vchiq-permissions.rules \
		"$pkgdir"/usr/lib/udev/rules.d/95-vchiq-permissions.rules
	install -Dm755 "$srcdir"/enforce-platform.sh -t "$pkgdir"/etc/profile.d/
}

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

	mkdir -p "$subpkgdir"
}

plasma_bigscreen() {
	pkgdesc="$pkgdesc (Plasma Bigscreen)"
	install_if="$pkgname plasma-bigscreen"

	amove etc/profile.d
}


sha512sums="
c1059c3e57d72fddec025bd2b541d957d4eadfbec0d4cfc3eaee58b2d59acc250631472666ef47bb2a32507c9a5e7894c9f13a9049c3d1756c3f0fd634f04e13  deviceinfo
44ea1c4fd2933e392e2379c66c52fa5a542290272e9d7f6806739af72fa052ca908aed2d9f0df9c212b2efc51b05304ddbe1568090e248fe2f69c664d4b7ca23  kernel-cmdline.conf
1c89943bcf0d26244211b52774de8453780d246e35c5cb5cb15012741128ceed646ae9ab7adc47221e53bfeb65c68130d21cdf9c3d7e9f4d57c5d0d889300f8c  modules-initfs
4e832421e47dd0faf443a7a949aae83cc6d4a80fd816df5c6d9d72ac4ae23f803863b9b63903a14b18ae585e6abc5c8703376a003967b74dc30040dc544aa2e9  usercfg.txt
7e5505cb07d5b4a81bd28443d508336b5c547356538f1c06f91ed93ad0d7d456d4f74f1d24df5a2e08c17e74f0a66607352ac4874e967e9a91dfec9522d2d58d  95-vchiq-permissions.rules
5ebdd05414792b82073a6453517c19458863809cdfb25e7d8857030c1feb69cbebc02c5309e6a14373125d83e5e673a20f2006520a34148af17219fb1863dd95  enforce-platform.sh
"
