aboutsummaryrefslogtreecommitdiff
path: root/apks/lens
diff options
context:
space:
mode:
Diffstat (limited to 'apks/lens')
-rw-r--r--apks/lens/APKBUILD49
-rw-r--r--apks/lens/lens.confd9
-rw-r--r--apks/lens/lens.initd24
-rw-r--r--apks/lens/lens.pre-install6
4 files changed, 88 insertions, 0 deletions
diff --git a/apks/lens/APKBUILD b/apks/lens/APKBUILD
new file mode 100644
index 0000000..334e985
--- /dev/null
+++ b/apks/lens/APKBUILD
@@ -0,0 +1,49 @@
+# Maintainer: Gabriel A. Giovanini <mail@gabrielgio.me>
+pkgname=lens
+pkgver=0_git20233106
+pkgrel=1
+_commit=53e833f3239d670295a8547fce72162707b873c0
+pkgdesc="Simple read only file viewer"
+url="https://sr.ht/~gabrielgio/lens"
+arch="x86_64"
+license="AGPL"
+makedepends="go"
+install="$pkgname.pre-install"
+subpackages="$pkgname-openrc"
+source="$pkgname-$_commit.tar.gz::https://git.sr.ht/~gabrielgio/$pkgname/archive/$_commit.tar.gz
+
+ $pkgname.confd
+ $pkgname.initd
+ "
+builddir="$srcdir/$pkgname-$_commit"
+
+build() {
+ make
+}
+
+prepare() {
+ default_prepare
+
+ git clone --depth=1 -b 0.9.4 \
+ https://github.com/jgthms/bulma.git \
+ scss/bulma
+}
+
+check() {
+ make test
+}
+
+package() {
+ install -Dm755 bin/lens "$pkgdir"/usr/bin/lens
+
+ install -dm755 "$pkgdir"/var/lib/lens
+
+ install -Dm755 "$srcdir"/lens.initd "$pkgdir"/etc/init.d/lens
+ install -Dm644 "$srcdir"/lens.confd "$pkgdir"/etc/conf.d/lens
+}
+
+sha512sums="
+143c2305eebbec7a40ff743952efb61c017e4382914852df893a1d79aff59b19ce128d0f0e3e7abc54968ff3832bb61aa083b302c0e328739c1095f40920a40a lens-53e833f3239d670295a8547fce72162707b873c0.tar.gz
+e9e220ebb25e53ae96d3c170f013806f03133b3c1377f375f9d4d72e84a7ce3b75f93462d2571cd4d6af46aec0913bfd0a8bfb1f38109e6644af5bbf7d56b540 lens.confd
+68d4556eb3ed4acd5cc950a8dc13b407745f7d62a8cb1ecb7ceb6fd31c981bc0d48e94da72fe0abab9ad8634c2976172881d04c2dd63b14f86c75696757e2dc3 lens.initd
+"
diff --git a/apks/lens/lens.confd b/apks/lens/lens.confd
new file mode 100644
index 0000000..d7b43c8
--- /dev/null
+++ b/apks/lens/lens.confd
@@ -0,0 +1,9 @@
+aes_key=
+db_type=sqlite
+db_con=main.db
+log_level=error
+scheduler_count=8
+cache_path=/var/lib/lens/cache
+
+# comment this out for old style service management
+supervisor=supervise-daemon
diff --git a/apks/lens/lens.initd b/apks/lens/lens.initd
new file mode 100644
index 0000000..6541bd1
--- /dev/null
+++ b/apks/lens/lens.initd
@@ -0,0 +1,24 @@
+#!/sbin/openrc-run
+
+name="lens simple file server"
+
+command="/usr/bin/lens"
+command_args="--aes-key ${aes_key} --db-type ${db_type} --db-con ${db_con} --log-level ${log_level} --scheduler-count ${scheduler_count} --cache-path ${cache_path}"
+: ${command_user:="lens:lens"}
+command_background=yes
+directory="/var/lib/lens"
+pidfile="/run/lens.pid"
+
+output_log="/var/log/lens.log"
+error_log="/var/log/lens.log"
+
+depend() {
+ need net
+ after firewall
+}
+
+start_pre() {
+ checkpath -d -m 755 -o "$command_user" /var/lib/lens
+ checkpath -d -m 755 -o "$command_user" "$cache_path"
+ checkpath -f -m 644 -o "$command_user" /var/log/lens.log
+}
diff --git a/apks/lens/lens.pre-install b/apks/lens/lens.pre-install
new file mode 100644
index 0000000..f2817e1
--- /dev/null
+++ b/apks/lens/lens.pre-install
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+addgroup -S lens
+adduser -S -D -H -h /var/lib/lens -s /sbin/nologin -G lens -g lens lens
+
+exit 0