anubis: init

This commit is contained in:
minoplhy 2025-04-29 00:02:16 +07:00
parent 62327623c7
commit 404a7021eb
Signed by: minoplhy
GPG Key ID: 41D406044E2434BF
3 changed files with 86 additions and 0 deletions

48
anubis/APKBUILD Normal file
View File

@ -0,0 +1,48 @@
maintainer="fossdd <fossdd@pwned.life>"
pkgname=anubis
pkgver=1.17.0
pkgrel=0
pkgdesc="Block AI scrapers using a sha256 proof-of-work challenge"
url="https://github.com/TecharoHQ/anubis"
arch="all"
license="MIT"
makedepends="go npm bash zstd brotli"
pkgusers="anubis"
pkggroups="anubis"
install="$pkgname.pre-install"
subpackages="$pkgname-doc
$pkgname-openrc
"
source="$pkgname-$pkgver.tar.gz::https://github.com/TecharoHQ/anubis/archive/refs/tags/v$pkgver.tar.gz
$pkgname.initd
"
options="net !check" # check: no test suite
# secfixes:
# 1.15.2-r0:
# - CVE-2025-24369
preparre() {
default_prepare
make deps
}
build() {
make assets
make prebaked-build
}
package() {
install -Dm755 var/anubis -t "$pkgdir"/usr/bin/
install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
install -D -m 755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
install -d -m 644 "$pkgdir"/etc/$pkgname
install -d -m 755 -o $pkgusers -g $pkggroups "$pkgdir"/var/log/$pkgname
}
sha512sums="
a72a77d9a1cbf3ef1900f703595f8f12228f0192892b8fec8afdc23c4a616cdecfdcf662e6c303bca5856da523c16ef1ded2ccc4fa23d1f4b8aaea946c07d934 anubis-1.17.0.tar.gz
4ae16b3ff33eb01e351da63670c35a011a6bafab2a14adda816669ba0cd3d18254041f7992c82afcc3cd95a3bcc78ca49189bec35b4b1da9a644ec583c48ec9e anubis.initd
"

31
anubis/anubis.initd Normal file
View File

@ -0,0 +1,31 @@
#!/sbin/openrc-run
supervisor=supervise-daemon
name=anubis
command="/usr/bin/anubis"
command_user="${ANUBIS_USER:-anubis}"
CONF="${SVCNAME#*.}"
supervise_daemon_args="--stdout '${ANUBIS_LOG_FILE:-/var/log/anubis/${CONF}.log}' --stderr '${ANUBIS_LOG_FILE:-/var/log/anubis/${CONF}.log}'"
pidfile="/run/anubis-${CONF}.pid"
capabilities="^cap_net_bind_service"
extra_started_commands="reload"
depend() {
use logger dns
need net
after firewall
}
start_pre() {
if [ -f /etc/anubis/${CONF}.env ]; then
export $(grep -v '^#' /etc/anubis/${CONF}.env | xargs)
fi
}
reload() {
ebegin "Reloading ${CONF}"
start_pre
eend $?
}

View File

@ -0,0 +1,7 @@
#!/bin/sh
addgroup -S anubis 2>/dev/null
adduser -S -D -s /usr/bin/nologin -G anubis -g anubis anubis 2>/dev/null \
&& passwd -u anubis 2>/dev/null
exit 0