apkbuilds @ 49e92cf705771c2a47fed50f95b42ab65a49e77a

fix: Add jellyfin again
diff --git a/apks/jellyfin-web/APKBUILD b/apks/jellyfin-web/APKBUILD
new file mode 100644
index 0000000000000000000000000000000000000000..2786c4262630d1c3c9bab909e7c509265f35482c
--- /dev/null
+++ b/apks/jellyfin-web/APKBUILD
@@ -0,0 +1,28 @@
+# Maintainer: Simon Zeni <simon@bl4ckb0ne.ca>
+pkgname=jellyfin-web
+pkgver=10.8.8
+pkgrel=0
+pkgdesc="Web Client for Jellyfin"
+url="https://jellyfin.org/"
+# armv7: oom
+arch="x86_64 aarch64"
+options="!check net" # no tests
+license="GPL-2.0-only"
+install="$pkgname.post-install"
+depends="jellyfin"
+makedepends="npm"
+source="$pkgname-$pkgver.tar.gz::https://github.com/jellyfin/jellyfin-web/archive/refs/tags/v$pkgver.tar.gz"
+
+build() {
+	npm ci --no-audit
+}
+
+package() {
+	mkdir -p "$pkgdir"/usr/lib/jellyfin/jellyfin-web
+
+	cp -r "$builddir"/dist/* "$pkgdir"/usr/lib/jellyfin/jellyfin-web
+}
+
+sha512sums="
+88a829248f1d2506509a3610cc67575899df4fcb371fdd766b4a91f2005f387055ac716047293882cc494e2894f4121049c9525f468a33c99a12ff5d0c87fb19  jellyfin-web-10.8.8.tar.gz
+"
diff --git a/apks/jellyfin-web/jellyfin-web.post-install b/apks/jellyfin-web/jellyfin-web.post-install
new file mode 100644
index 0000000000000000000000000000000000000000..a6e69426fe7357daabddec8f662975f83bbecddd
--- /dev/null
+++ b/apks/jellyfin-web/jellyfin-web.post-install
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+printf "  *\n  * The default jellyfin configuration does not enable the web ui.\n"
+printf "  * Remove the '--nowebclient' option from /etc/conf.d/jellyfin to enable it.\n  *\n"
+
+exit 0
diff --git a/apks/jellyfin/APKBUILD b/apks/jellyfin/APKBUILD
new file mode 100644
index 0000000000000000000000000000000000000000..474faf35afdc746b00728f3a3f149d9227c6463f
--- /dev/null
+++ b/apks/jellyfin/APKBUILD
@@ -0,0 +1,63 @@
+# Maintainer: Simon Zeni <simon@bl4ckb0ne.ca>
+pkgname=jellyfin
+pkgver=10.8.8
+pkgrel=0
+pkgdesc="The Free Software Media System"
+pkgusers="$pkgname"
+pkggroups="$pkgname"
+install="$pkgname.pre-install"
+url="https://jellyfin.org/"
+arch="x86_64 armv7 aarch64"
+license="GPL-2.0-only"
+makedepends="dotnet6-sdk"
+depends="aspnetcore6-runtime ffmpeg"
+subpackages="$pkgname-openrc"
+source="$pkgname-$pkgver.tar.gz::https://github.com/jellyfin/jellyfin/archive/refs/tags/v$pkgver.tar.gz
+	$pkgname.initd
+	$pkgname.confd"
+
+case $CARCH in
+	x86_64) _dotnet_arch=x64;;
+	aarch64) _dotnet_arch=arm64;;
+	armv7|armhf) _dotnet_arch=arm;;
+esac
+
+# parses RID from /etc/os-release depending on if edge or production release
+# to set _runtime_id
+# shellcheck disable=SC2034
+. /etc/os-release
+[ -n "${VERSION_ID//[^_]}" ] && _runtime_id="alpine.${VERSION_ID%_*}-$_dotnet_arch" || _runtime_id="alpine.${VERSION_ID%.*}-$_dotnet_arch"
+
+build() {
+	dotnet build --configuration Release Jellyfin.Server --no-self-contained --runtime $_runtime_id
+	dotnet publish --configuration Release Jellyfin.Server --no-self-contained --output publish --runtime $_runtime_id
+}
+
+check() {
+	# check on aarch64 is broken for dotnet6-sdk v6.0.1xx due to
+	# https://github.com/microsoft/vstest/issues/2566
+	if [ "$CARCH" = "aarch64" ]; then
+		return
+	fi
+
+	dotnet test --runtime $_runtime_id
+}
+
+package() {
+	mkdir -p "$pkgdir"/usr/lib
+	cp -dr publish "$pkgdir"/usr/lib/jellyfin
+
+	mkdir -p "$pkgdir"/usr/bin
+	ln -s /usr/lib/jellyfin/jellyfin "$pkgdir"/usr/bin/jellyfin
+
+	install -Dm755 "$srcdir"/$pkgname.initd \
+		"$pkgdir"/etc/init.d/$pkgname
+	install -Dm644 "$srcdir"/$pkgname.confd \
+		"$pkgdir"/etc/conf.d/$pkgname
+}
+
+sha512sums="
+1866a8e6a730d2d2211a907aa9087c8bc7069ef53010ba652f1dbbe2c6c638a29259531e31ccf5bee797651999ec0963b2ff3588e791f3b523e43bf4a3556070  jellyfin-10.8.8.tar.gz
+364a70a953d921048a249fd370642c1782e434c850334cd55e35bbb10d1bb93482d37faa1c11da5d7acba96a084d9832e5db212b65b0fa9907c7d3afe553aaf9  jellyfin.initd
+d35eb07d11d711b8ad35c7726e151a8096609712fee3bfea00c9adeff8e56660e3cde3d9b0b2dc8a847514af4d2b32340e2b29b77facfab4f8921ba15ba671b0  jellyfin.confd
+"
diff --git a/apks/jellyfin/jellyfin.confd b/apks/jellyfin/jellyfin.confd
new file mode 100644
index 0000000000000000000000000000000000000000..6cd891ce6d9f1932bbe850fe3e41b6135ac6ad7b
--- /dev/null
+++ b/apks/jellyfin/jellyfin.confd
@@ -0,0 +1,5 @@
+supervisor=supervise-daemon
+datadir="/var/lib/jellyfin"
+cachedir="/var/cache/jellyfin"
+logdir="/var/log/jellyfin"
+opts="--nowebclient"
diff --git a/apks/jellyfin/jellyfin.initd b/apks/jellyfin/jellyfin.initd
new file mode 100644
index 0000000000000000000000000000000000000000..278d79dddae9ea4542ce580166a1e6fa3a2d94b7
--- /dev/null
+++ b/apks/jellyfin/jellyfin.initd
@@ -0,0 +1,20 @@
+#!/sbin/openrc-run
+
+name=jellyfin
+description="The Free Software Media System"
+
+command=/usr/bin/jellyfin
+command_user=jellyfin:jellyfin
+command_args="--datadir ${datadir} --cachedir ${cachedir} --logdir ${logdir} ${opts}"
+
+depend() {
+	use logger dns
+	need net
+	after firewall
+}
+
+start_pre() {
+	checkpath -d -o $command_user "$datadir"
+	checkpath -d -o $command_user "$cachedir"
+	checkpath -d -o $command_user "$logdir"
+}
diff --git a/apks/jellyfin/jellyfin.pre-install b/apks/jellyfin/jellyfin.pre-install
new file mode 100644
index 0000000000000000000000000000000000000000..6e647160debab510a6a24035d4028b66a6594e71
--- /dev/null
+++ b/apks/jellyfin/jellyfin.pre-install
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+user=jellyfin
+group=jellyfin
+
+addgroup -S $group 2>/dev/null
+adduser -S -D -h /var/lib/$user -s /sbin/nologin -G $group -g $user $user 2>/dev/null
+
+exit 0
diff --git a/pkgkit b/pkgkit
index 60d147492c403acde56fb5e4ce01076d239e65b5..4afc8e9b0090daa8072dea76a37bfae44bc759ed 100755
--- a/pkgkit
+++ b/pkgkit
@@ -17,7 +17,7 @@ }
 
 get_pkgvar() (
 	var="$1"
-set +u
+	set +u
 	. APKBUILD
 	eval 'printf "%s\n" "$'"$var"'"'
 )
@@ -93,8 +93,10 @@ 			umask 0007
 			openssl genrsa -out "$key" 2048
 		)
 	fi
+	pkey="$(basename "$key").pub"
 	sudo openssl rsa -in $key -pubout \
-		-out /etc/apk/keys/$(basename "$key").pub
+		-out /etc/apk/keys/"$pkey"
+	cp /etc/apk/keys/"$pkey" ~/.abuild/"$pkey"
 	if [ $set_default -eq 1 ]
 	then
 		echo "PACKAGER_PRIVKEY="'"'$key'"' >> \
@@ -225,7 +227,7 @@ 	arch="$(uname -m)"
 	aver="$(get_aver)"
 
 	set -x
-	path="$remote_path/$aver/$arch"
+	path="$remote_path/$aver/$repo/$arch"
 	ssh "$remote" mkdir -p "$path"
 
 	url=$(echo "$remote" | cut -d@ -f2)
@@ -253,24 +255,20 @@
 	. /etc/os-release
 	aver="$(get_aver)"
 
-    tmp_repo="/tmp/$aver/"
-	path="$remote_path/$aver/$arch"
-
-    # since my remote server is not alpine I have to download the repo localy
-	rsync --blocking-io -rP \
-		"$remote:$path/" \
-        "$tmp_repo"
+	path="$remote_path/$aver/$repo/$arch"
 
 	set -x
-    find "$tmp_repo" -type f -name '*.apk' -print0 |
-    xargs -0 apk index \
-        --rewrite-arch "$(uname -m)" \
-        -x "$tmp_repo"/APKINDEX.tar.gz \
-        -o "$tmp_repo"/APKINDEX.unsigned.tar.gz
-
-	abuild-sign "$tmp_repo/APKINDEX.unsigned.tar.gz"
-	rsync --blocking-io -rP "$tmp_repo/APKINDEX.unsigned.tar.gz" \
-        "$remote:$path/APKINDEX.tar.gz"
+	ssh "$remote" \
+		find "$path" -type f -name '*.apk' -print0 |
+		ssh "$remote" xargs -0 apk index \
+			--rewrite-arch "$(uname -m)" \
+			-x "$path"/APKINDEX.tar.gz \
+			-o "$path"/APKINDEX.unsigned.tar.gz
+	rsync --blocking-io -rP \
+		"$remote:$path/APKINDEX.unsigned.tar.gz" \
+		/tmp/APKINDEX.tar.gz
+	abuild-sign /tmp/APKINDEX.tar.gz
+	rsync --blocking-io -rP /tmp/APKINDEX.tar.gz "$remote:$path/"
 	set +x
 )