apkbuilds @ e89c3ae528d667a63b9716653f9f926bf416f2ee

feat: add initial photoview APKBUILD
diff --git a/apks/photoview/APKBUILD b/apks/photoview/APKBUILD
new file mode 100644
index 0000000000000000000000000000000000000000..ab6003ccbae6cd90e3136bf1e643e8b2f7d01ca9
--- /dev/null
+++ b/apks/photoview/APKBUILD
@@ -0,0 +1,63 @@
+# Maintainer: Gabriel Giovanini <mail@gabrielgio.me>
+pkgname=photoview
+pkgver=2.3.13
+pkgrel=2
+pkgdesc="Photo gallery for self-hosted personal servers"
+url="https://github.com/photoview/photoview"
+arch="x86_64"
+license="AGPL-3.0"
+install="$pkgname.pre-install"
+makedepends="go 
+    npm
+    dlib-dev
+    yaml-dev
+    libheif-dev
+    jpeg-dev
+    blas-dev
+    lapack-dev
+    exiftool
+    ffmpeg-dev"
+subpackages="$pkgname-openrc"
+source="$pkgname-$pkgver.tar.gz::https://github.com/photoview/photoview/archive/v$pkgver.tar.gz
+    $pkgname.pre-install
+    $pkgname.initd
+    $pkgname.confd"
+builddir="$srcdir/$pkgname-$pkgver"
+
+build() {
+    cd "$srcdir/$pkgname-$pkgver/api"
+    go build -o "$pkgname" server.go
+
+    cd "$srcdir/$pkgname-$pkgver/ui"
+    npm ci --yes --omit=dev --ignore-scripts
+    npm run build
+}
+
+check() {
+    cd "$srcdir/$pkgname-$pkgver/api"
+    go test ./...
+
+    cd "$srcdir/$pkgname-$pkgver/ui"
+    npm install
+    CI=true npm run test
+}
+
+package() {
+    install -Dm755 api/"$pkgname" "$pkgdir/usr/bin/$pkgname"
+    install -d "${pkgdir}/var/cache/${pkgname}/media_cache"
+
+    cd "$srcdir/$pkgname-$pkgver/ui/dist"
+    find * -type f -exec install -Dm0644 "{}" "${pkgdir}/usr/share/webapps/${pkgname}/{}" \;
+
+    install -d "${pkgdir}/var/lib/${pkgname}"
+
+	install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
+	install -Dm644 "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname
+}
+
+sha512sums="
+63feaaa33257a5f529fe87f354b1937f7eac60faf1ec0d01c1ca91bf6929b08b680359c044879e9ab96329690baa543e19d4cf0237b20fda152c39631496cd59  photoview-2.3.13.tar.gz
+25ab91023866397d7e7557c546606212c1c59f97d7a4f1dc091b717c5daaadcb35ab82552bc7ee723baf9b5dd8a76114e027ab453e4db9469931378655c82a29  photoview.pre-install
+e93390bbd9cf50f4838fdbe217656722781d07dcedebbbef27060df69107ebd5f04b8dec54f1802318e6da8f3a3c9c74a301c208e92713d3c785c7e35f14f55b  photoview.initd
+41e8ac7cca9051b7420de9c4fb67bad0168ac1ecc4ff63761defb1e025b0cbc8264443e2488af18b21ecd189d63cf2037103d3a6d6ba83eaf362c578f765da31  photoview.confd
+"
diff --git a/apks/photoview/photoview.confd b/apks/photoview/photoview.confd
new file mode 100644
index 0000000000000000000000000000000000000000..0c90d9ef153572ecc7c734f5ea4f0e96844fbe7e
--- /dev/null
+++ b/apks/photoview/photoview.confd
@@ -0,0 +1,17 @@
+# Available options mysql (default), postgres and sqlite.
+PHOTOVIEW_DATABASE_DRIVER=sqlite
+PHOTOVIEW_SQLITE_PATH=/var/lib/photoview/photoview.db
+
+# PHOTOVIEW_MYSQL_URL=
+# PHOTOVIEW_POSTGRES_URL=
+
+PHOTOVIEW_LISTEN_IP=localhost
+PHOTOVIEW_LISTEN_PORT=4001
+PHOTOVIEW_SERVE_UI=1
+PHOTOVIEW_UI_PATH=/usr/share/webapps/photoview/
+PHOTOVIEW_MEDIA_CACHE=/var/cache/photoview/media_cache
+
+# disable features
+PHOTOVIEW_DISABLE_FACE_RECOGNITION=1
+PHOTOVIEW_DISABLE_VIDEO_ENCODING=0
+PHOTOVIEW_DISABLE_RAW_PROCESSING=0
diff --git a/apks/photoview/photoview.initd b/apks/photoview/photoview.initd
new file mode 100644
index 0000000000000000000000000000000000000000..04a799c90d4c2b5910bce2028724061911ee584b
--- /dev/null
+++ b/apks/photoview/photoview.initd
@@ -0,0 +1,40 @@
+#!/sbin/openrc-run
+supervisor=supervise-daemon
+
+command="/usr/bin/photoview"
+command_background="yes"
+command_user="photoview:photoview"
+
+# database
+export PHOTOVIEW_DATABASE_DRIVER
+export PHOTOVIEW_SQLITE_PATH
+export PHOTOVIEW_MYSQL_URL
+export PHOTOVIEW_POSTGRES_URL
+
+export PHOTOVIEW_LISTEN_IP
+export PHOTOVIEW_LISTEN_PORT
+export PHOTOVIEW_SERVE_UI
+export PHOTOVIEW_UI_PATH
+export PHOTOVIEW_MEDIA_CACHE
+
+# features
+export PHOTOVIEW_DISABLE_FACE_RECOGNITION
+export PHOTOVIEW_DISABLE_VIDEO_ENCODING
+export PHOTOVIEW_DISABLE_RAW_PROCESSING
+
+logdir="/var/log/photoview"
+error_log="$logdir/${SVCNAME}.log"
+pidfile="/var/run/${SVCNAME}.pid"
+
+depend() {
+	need net
+	after firewall
+}
+
+start_pre() {
+    checkpath -d -o $command_user -m755 $logdir
+    checkpath -d -o $command_user -m755 /var/cache/photoview/media_cache
+    checkpath -d -o $command_user -m755 /var/lib/photoview
+    checkpath -d -o $command_user -m755 /usr/share/webapps/photoview
+    checkpath -f -o $command_user -m644 $error_log
+}
diff --git a/apks/photoview/photoview.pre-install b/apks/photoview/photoview.pre-install
new file mode 100644
index 0000000000000000000000000000000000000000..a493b21631e607bcda180413ba6adbc69e52b8e4
--- /dev/null
+++ b/apks/photoview/photoview.pre-install
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+addgroup -S photoview 2>/dev/null
+adduser -S -D -h /var/lib/photoview -s /sbin/nologin -G photoview -g photoview photoview 2>/dev/null
+
+exit 0