maintainer="Affe Null <affenull2345@gmail.com>"
pkgname=unisoc-nvitem-daemon
pkgver=0_git20250618
_commit="23f3be10fd5b54bd0fedde3189b98dcfb88f16c2"
pkgrel=1
pkgdesc="NV item daemon for Unisoc modems"
url="https://git.abscue.de/linux-mainlining/unisoc-nvitem-daemon"
arch="aarch64"
license="BSD-3-Clause"
subpackages="$pkgname-openrc $pkgname-systemd"
source="$url/-/archive/$_commit/unisoc-nvitem-daemon-$_commit.tar.gz
	unisoc-nvitem-daemon.initd
	90-unisoc-nvitem-daemon.preset
	"
options="!check" # no tests
builddir="$srcdir/unisoc-nvitem-daemon-$_commit"

build() {
	gcc -o unisoc-nvitem-daemon unisoc-nvitem-daemon.c
}

package() {
	install -Dm755 unisoc-nvitem-daemon -t "$pkgdir"/usr/sbin

	install -Dm755 "$srcdir"/unisoc-nvitem-daemon.initd \
		"$pkgdir"/etc/init.d/unisoc-nvitem-daemon
}

openrc() {
	install="$subpkgname.post-install"
	default_openrc
}

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

	install -Dm644 "$builddir"/unisoc-nvitem-daemon.service \
		-t "$subpkgdir"/usr/lib/systemd/system
	install -Dm644 "$srcdir"/90-unisoc-nvitem-daemon.preset \
		-t "$subpkgdir"/usr/lib/systemd/system-preset
}

sha512sums="
eafbd3fe9fb80ad09b24e0f420fd8e1f29fd1457b003d78c6a8bf0e9ca8937547d6b1dc2147d55de517ab049f486e112d89bae38da14681aa198443dd4c3bfc0  unisoc-nvitem-daemon-23f3be10fd5b54bd0fedde3189b98dcfb88f16c2.tar.gz
65a6bd77e9e277afbe8940dbe9897a0ba0d07c0030a8cea8f2468e731ccaf1b1ecdddce6f9da0d316f62b4592af109808b64bf58c11ef83b4899cad265129c4a  unisoc-nvitem-daemon.initd
af2e929ee37e919c8b9787b075d8c4f18de2d817adb97814d97b883c10c2e444e007bd01e78302993f9ea369593459b61fb87788612b99e7c7bd9d923db2d46c  90-unisoc-nvitem-daemon.preset
"
