From 188e54f893363b1beb0f85f394342335f95c0891 Mon Sep 17 00:00:00 2001 From: Xiretza Date: Mon, 21 Oct 2024 13:53:00 +0000 Subject: [PATCH] Add Arch package recipe --- contrib/PKGBUILD | 51 +++++++++++++++++++++++++++++++++++++ contrib/factoriauth.service | 21 +++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 contrib/PKGBUILD create mode 100644 contrib/factoriauth.service diff --git a/contrib/PKGBUILD b/contrib/PKGBUILD new file mode 100644 index 0000000..29f993a --- /dev/null +++ b/contrib/PKGBUILD @@ -0,0 +1,51 @@ +# Maintainer: xiretza +_pkgname=factoriauth +pkgname=$_pkgname-git +pkgver=1.0.0.r6.g63487af +pkgrel=1 +pkgdesc="An unofficial Factorio authentication server" +arch=(x86_64) +url="https://git.it-syndikat.org/xiretza/factoriauth" +license=('AGPL-3.0-or-later') +groups=() +depends=("glibc" "gcc-libs") +makedepends=("git" "cargo") +provides=("$_pkgname") +conflicts=("$_pkgname") +backup=("etc/$_pkgname/config.toml") +source=( + "$_pkgname::git+$url" + "$_pkgname.service" +) +sha256sums=('SKIP' + '06a220daeab399326b68bb094340d6d5970da29321ceb468382952de198855d3') + +pkgver() { + cd "$srcdir/$_pkgname" + + git describe --long --tags --abbrev=7 | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g' +} + +prepare() { + cd "$srcdir/$_pkgname" + + cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')" +} + +build() { + cd "$srcdir/$_pkgname" + + # https://github.com/launchbadge/sqlx/issues/3149 + CFLAGS+=" -ffat-lto-objects" + cargo build --frozen --release --all-features +} + +package() { + cd "$srcdir/$_pkgname" + + install -Dm0755 -t "$pkgdir/usr/bin/" "target/release/$_pkgname" + install -Dm0644 -T "config.toml.example" "$pkgdir/etc/$_pkgname/config.toml" + sed -i -e "s#sqlite://sqlite.db#sqlite:///var/lib/$_pkgname/sqlite.db#" "$pkgdir/etc/$_pkgname/config.toml" +} + +# vim: set et ts=4: diff --git a/contrib/factoriauth.service b/contrib/factoriauth.service new file mode 100644 index 0000000..a9cdb1b --- /dev/null +++ b/contrib/factoriauth.service @@ -0,0 +1,21 @@ +[Unit] +Description=Unofficial authentication server for factorio + +[Service] +DynamicUser=yes +ExecStart=/usr/bin/factoriauth -c /etc/factoriauth/config.toml run +StateDirectory=factoriauth +ConfigurationDirectory=factoriauth + +ProtectSystem=strict +ProtectHome=yes +AmbientCapabilities= +CapabilityBoundingSet= +RestrictNamespaces=yes +RestrictAddressFamilies=AF_INET AF_INET6 +SystemCallFilter=@system-service +PrivateDevices=yes +ProtectProc=noaccess + +[Install] +WantedBy=multi-user.target