From 87a1f27eea7dfc9f8574c6c11061480841c173df Mon Sep 17 00:00:00 2001 From: Gabriel Arakaki Giovanini Date: Mon, 9 Oct 2023 12:09:44 +0200 Subject: chore: Add invidious --- apks/invidious/APKBUILD | 74 ++++++++++++++++++++++++++++++++++++ apks/invidious/invidious.initd | 13 +++++++ apks/invidious/invidious.pre-install | 7 ++++ 3 files changed, 94 insertions(+) create mode 100644 apks/invidious/APKBUILD create mode 100644 apks/invidious/invidious.initd create mode 100644 apks/invidious/invidious.pre-install (limited to 'apks/invidious') diff --git a/apks/invidious/APKBUILD b/apks/invidious/APKBUILD new file mode 100644 index 0000000..79d5ec1 --- /dev/null +++ b/apks/invidious/APKBUILD @@ -0,0 +1,74 @@ +# Maintainer: Francesco Camuffo +pkgname=invidious +pkgver=0_git20231007 +_commit=60fae015d8b5e4b0bfac8306065db07f93c4c661 +pkgrel=0 +pkgdesc="Alternative front-end to YouTube" +url="https://github.com/iv-org/invidious" +arch="x86_64" +license="AGPL-3.0-or-later" +depends=" + rsvg-convert +" +options="!check" # testing breaks for now fixing later +makedepends=" + crystal + git + libxml2-dev + openssl-dev + shards + sqlite-dev + yaml-dev + zlib-dev +" +install="$pkgname.pre-install" +pkgusers="$pkgname" +pkggroups="$pkgname" +subpackages="$pkgname-openrc" +_mocks_commit=cb16e0343c8f94182615610bfe3c503db89717a7 +source=" + $pkgname-$_commit.tar.gz::https://github.com/iv-org/invidious/archive/$_commit.tar.gz + $pkgname.initd +" +builddir="$srcdir/invidious-$_commit" + +prepare() { + sed -i src/invidious.cr \ + -e 's/\(CURRENT_BRANCH \) = .*/\1 = "master"/' \ + -e "s/\(CURRENT_COMMIT \) = .*/\1 = \"${_commit:0:7}\"/" \ + -e "s/\(CURRENT_VERSION\) = .*/\1 = \"$pkgver\"/" \ + -e "s/\(ASSET_COMMIT\) = .*/\1 = \"${_commit:0:7}\"/" + + datadir=/usr/share/webapps/invidious + # fix paths + sed -i src/invidious.cr \ + -e "s|\(public_folder\) \"assets\"|\1 \"$datadir/assets\"|" + sed -i src/invidious/helpers/i18n.cr \ + -e "s|File.read(\"locales/|File.read(\"$datadir/locales/|" + sed -i src/invidious/database/base.cr \ + -e "s|config/sql|/etc/$pkgname/\0|g" + + default_prepare +} + +build() { + shards install + crystal build \ + --release \ + -Ddisable_quic \ + src/invidious.cr +} + +package() { + install -Dm755 "$pkgname" "$pkgdir"/usr/bin/invidious + install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname + mkdir -p "$pkgdir"/usr/share/webapps/invidious + cp -r "$builddir"/assets "$builddir"/locales \ + "$pkgdir"/usr/share/webapps/invidious + install -Dm644 "$builddir"/config/config.example.yml \ + "$pkgdir"/etc/"$pkgname"/config.yml +} +sha512sums=" +bc2295d5d43ac3b793914e4baa0bdd6c4d6ff1746629b3db0b81a22ca057acb5cc28a7af984573ace936acaabedc2ce134d9ecf76386101893af408976f8f44c invidious-60fae015d8b5e4b0bfac8306065db07f93c4c661.tar.gz +ed0a2e498751927c1ad82619395a07c169f7353a9c1453381ad288ad501b915010df5b799e4f102e034f0483b9101b9a8ae40d150b3d7db80605f87b9ca6f596 invidious.initd +" diff --git a/apks/invidious/invidious.initd b/apks/invidious/invidious.initd new file mode 100644 index 0000000..ba29fce --- /dev/null +++ b/apks/invidious/invidious.initd @@ -0,0 +1,13 @@ +#!/sbin/openrc-run + +supervisor=supervise-daemon +name=invidious +command="/usr/bin/invidious" +command_user="${INVIDIOUS_USER:-invidious}" +supervise_daemon_args="--env INVIDIOUS_CONFIG_FILE='${INVIDIOUS_CONFIG_FILE:-/etc/invidious/config.yml}'" +pidfile="/run/invidious.pid" + +depend() { + need net + after firewall +} diff --git a/apks/invidious/invidious.pre-install b/apks/invidious/invidious.pre-install new file mode 100644 index 0000000..bce4a4e --- /dev/null +++ b/apks/invidious/invidious.pre-install @@ -0,0 +1,7 @@ +#!/bin/sh + +addgroup -S invidious 2>/dev/null +adduser -S -D -h /usr/share/webapps/invidious -s /sbin/nologin -G invidious \ + -g invidious invidious 2>/dev/null + +exit 0 -- cgit v1.2.3