Add Arch package recipe

This commit is contained in:
Xiretza 2024-10-21 13:53:00 +00:00
parent 691bebf6ba
commit 188e54f893
2 changed files with 72 additions and 0 deletions

51
contrib/PKGBUILD Normal file
View file

@ -0,0 +1,51 @@
# Maintainer: xiretza <aur@xiretza.xyz>
_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:

View file

@ -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