A sr.ht/searchhut/APKBUILD => sr.ht/searchhut/APKBUILD +58 -0
@@ 0,0 1,58 @@
+# Maintainer: Drew DeVault <sir@cmpwn.com>
+pkgname=searchhut
+pkgver=0_git20220714
+_commit=c2c75b565a615031fb5c41c3d259c87313bfc763
+pkgrel=0
+pkgdesc="Search engine"
+url="https://searchhut.org"
+license="AGPL-3.0"
+arch="all"
+pkgusers="$pkgname"
+pkggroups="$pkgname"
+install="$pkgname.pre-install"
+makedepends="go"
+subpackages="$pkgname-openrc"
+source="$pkgname-$pkgver.tar.gz::https://git.sr.ht/~sircmpwn/searchhut/archive/$_commit.tar.gz
+ sh-api.initd
+ sh-api.confd
+ sh-web.initd
+ sh-web.confd
+ "
+builddir="$srcdir/$pkgname-$_commit"
+options="!check" # no upstream tests
+
+export GOPATH="$srcdir"
+export GOFLAGS="$GOFLAGS -trimpath -modcacherw"
+
+build() {
+ make
+}
+
+package() {
+ mkdir -p "$pkgdir"/usr/bin
+ for bin in sh-admin sh-api sh-index sh-search sh-web
+ do
+ cp $bin "$pkgdir"/usr/bin/
+ done
+
+ install -Dm755 "$srcdir"/sh-api.initd "$pkgdir"/etc/init.d/sh-api
+ install -Dm644 "$srcdir"/sh-api.confd "$pkgdir"/etc/conf.d/sh-api
+ install -Dm755 "$srcdir"/sh-web.initd "$pkgdir"/etc/init.d/sh-web
+ install -Dm644 "$srcdir"/sh-web.confd "$pkgdir"/etc/conf.d/sh-web
+
+ mkdir -p "$pkgdir"/etc/searchhut
+ install -Dm644 config.example.ini "$pkgdir"/etc/searchhut/config.ini
+
+ mkdir -p "$pkgdir"/usr/share/searchhut/templates
+ mkdir -p "$pkgdir"/usr/share/searchhut/static
+ install -Dm644 templates/* "$pkgdir"/usr/share/searchhut/templates
+ install -Dm644 static/* "$pkgdir"/usr/share/searchhut/static
+}
+
+sha512sums="
+e6c94455ebd779dd5df5604a498451df91e277353372ffeb7ec0cc4bd367f2c674c453f9711b5d9fb731c95b5b10a01a9cff2487088e1d1aa55b0d086c4021ed searchhut-0_git20220714.tar.gz
+682a3eccdc59603392bb29ecdfaef07353dcf03d73be4e4a34f4658fada4849163abac2049d9fc988710e47c03b95db4806c7c6f8e4946c177d998f1a838f11d sh-api.initd
+37704c27c178c1e1f7d7475769ec62c5a76cf3acd8e2ab5d981b665d77c21b6135ea73f27b2b79a158fbff814bcdadbc11f31f09c9212064967c712b3bc7907c sh-api.confd
+fc7998ef7de051b4288387b5a172293a0fb6402dc6f6facdfa02f8aa628d4d307e0d2e94f40dfbd4a6bab066961d1af6a8c88bb61fe7b589748a6be0a7b0ef37 sh-web.initd
+798824b3100e41de019ccd86f565094826b7a33369f97b07ce33da323817f95b401e07fc73c3d9e3302955a1284b086d18e5355182294f07d301dbbc30ffd278 sh-web.confd
+"
A sr.ht/searchhut/searchhut.pre-install => sr.ht/searchhut/searchhut.pre-install +6 -0
@@ 0,0 1,6 @@
+#!/bin/sh
+user=searchhut
+group=searchhut
+
+addgroup -S $group 2>/dev/null || true
+adduser -S -D -h /var/lib/$user -s /sbin/nologin -G $group -g $user $user 2>/dev/null || true
A sr.ht/searchhut/sh-api.confd => sr.ht/searchhut/sh-api.confd +4 -0
@@ 0,0 1,4 @@
+# Configuration for /etc/init.d/sh-api
+
+# log destination
+error_log=/var/log/sh-api.log
A sr.ht/searchhut/sh-api.initd => sr.ht/searchhut/sh-api.initd +10 -0
@@ 0,0 1,10 @@
+#!/sbin/openrc-run
+name="sh-api"
+description="Search engine API"
+supervisor=supervise-daemon
+command=/usr/bin/sh-api
+command_user=searchhut:searchhut
+
+start_pre() {
+ [ -n "$error_log" ] && checkpath -f -o $command_user "$error_log"
+}
A sr.ht/searchhut/sh-web.confd => sr.ht/searchhut/sh-web.confd +4 -0
@@ 0,0 1,4 @@
+# Configuration for /etc/init.d/sh-web
+
+# log destination
+error_log=/var/log/sh-web.log
A sr.ht/searchhut/sh-web.initd => sr.ht/searchhut/sh-web.initd +11 -0
@@ 0,0 1,11 @@
+#!/sbin/openrc-run
+name="sh-web"
+description="Search engine web frontend"
+supervisor=supervise-daemon
+command=/usr/bin/sh-web
+command_user=searchhut:searchhut
+directory="/usr/share/searchhut"
+
+start_pre() {
+ [ -n "$error_log" ] && checkpath -f -o $command_user "$error_log"
+}