testing/ktistec: new aport

https://github.com/toddsundsted/ktistec
Single-user ActivityPub server written in Crystal
This commit is contained in:
Celeste 2023-12-27 05:17:47 +00:00 committed by Patrycja Rosa
parent 6422e94150
commit 3f38ec148c
4 changed files with 121 additions and 0 deletions

67
testing/ktistec/APKBUILD Normal file
View File

@ -0,0 +1,67 @@
# Contributor: Celeste <cielesti@protonmail.com>
# Maintainer: Celeste <cielesti@protonmail.com>
pkgname=ktistec
pkgver=0_git20231216
_gitrev=b331b7fd82b9fd8cf76a23fe48c11adfa92c875c
pkgrel=0
pkgdesc="Single-user ActivityPub server written in Crystal"
url="https://github.com/toddsundsted/ktistec"
arch="x86_64 aarch64" # crystal
license="AGPL-3.0-or-later"
depends="tzdata"
makedepends="
crystal
libxml2-dev
musl-utils
openssl-dev
shards
sqlite-dev
"
checkdepends="yaml-dev"
install="$pkgname.pre-install"
pkgusers="ktistec"
pkggroups="ktistec"
subpackages="$pkgname-openrc"
source="$pkgname-$pkgver.tar.gz::https://github.com/toddsundsted/ktistec/archive/$_gitrev.tar.gz
ktistec.initd
ktistec.confd
"
builddir="$srcdir/$pkgname-$_gitrev"
# Spectator shard fails to compile on aarch64
[ "$CARCH" = "aarch64" ] && options="$options !check"
export CRYSTAL_CACHE_DIR="${CRYSTAL_CACHE_DIR:-"$srcdir/.cache"}"
export SHARDS_CACHE_PATH="${SHARDS_CACHE_PATH:-"$srcdir/.cache"}"
prepare() {
default_prepare
shards install --frozen
}
build() {
crystal build --no-debug --release src/ktistec/server.cr
}
check() {
crystal spec -v
}
package() {
install -Dvm755 server "$pkgdir"/usr/bin/ktistec
install -dvm750 -o ktistec -g ktistec "$pkgdir"/var/lib/ktistec
cp -a etc public "$pkgdir"/var/lib/ktistec/
ln -sv public/uploads "$pkgdir"/var/lib/ktistec/
chown -R ktistec:ktistec "$pkgdir"/var/lib/ktistec/public/uploads
install -Dm755 "$srcdir"/ktistec.initd "$pkgdir"/etc/init.d/ktistec
install -Dm644 "$srcdir"/ktistec.confd "$pkgdir"/etc/conf.d/ktistec
}
sha512sums="
547736bd88f9f379bdb83cb906ff79d261afc3220dd5414cd99fe55de99d99ef85fca37b520c939509aad356ee62f59f2e3442fdd9076c4b8a07f14d32c6d900 ktistec-0_git20231216.tar.gz
f2520a9306daf544fec456e739abf1bb1e1a188992bbd8ef4a3ce3915a342209521ceedef8fc871c659d12ca57914825a8dcebc04e0114147fe32fc7de1dcabb ktistec.initd
b8971fe3a504df6173015a33a8edd64d74144128a1247328067fe82bee796d5faa55fa00de01690fedd7a027fb55e584b98b20277faa4140b913f52e4ec094e3 ktistec.confd
"

View File

@ -0,0 +1,13 @@
# Configuration for /etc/init.d/ktistec
# Hostname to bind
#ktistec_host="0.0.0.0"
# Port to listen for connections
#ktistec_port="3000"
# Additional options to pass to Ktistec
#extra_opts=""
# Uncomment to enable process supervision
#supervisor=supervise-daemon

View File

@ -0,0 +1,30 @@
#!/sbin/openrc-run
name=ktistec
description="Ktistec is a single-user ActivityPub server written in Crystal"
command="/usr/bin/ktistec"
command_args="
${ktistec_host:+--bind $ktistec_host}
${ktistec_port:+--port $ktistec_port}
$extra_opts
"
command_background="yes"
command_user="ktistec:ktistec"
pidfile="/run/${RC_SVCNAME}.pid"
directory="/var/lib/ktistec"
output_log="/var/log/ktistec.log"
error_log="/var/log/ktistec.log"
depend() {
need localmount net
after firewall
}
start_pre() {
checkpath -f -m 0640 -o "$command_user" \
"$output_log" "$error_log"
checkpath -d -m 0750 -o "$command_user" \
"$directory" "$directory/public/uploads"
}

View File

@ -0,0 +1,11 @@
#!/bin/sh
addgroup -S ktistec 2>/dev/null
adduser -S -D -H \
-h /var/lib/ktistec \
-s /sbin/nologin \
-G ktistec \
-g "Ktistec ActivityPub server" \
ktistec 2>/dev/null
exit 0