add Arch Linux packaging
- Bundle the server into dist/rotrouter.cjs with esbuild (npm run build), so the package needs only nodejs at runtime and is arch=any. - Read the config and static file paths from ROTROUTER_CONFIG and ROTROUTER_PUBLIC (defaults unchanged for npm start). - PKGBUILD for rotrouter-git and a hardened systemd unit running as a DynamicUser without capabilities. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
# Maintainer: ericek111
|
||||
|
||||
pkgname=rotrouter-git
|
||||
_pkgname=RotRouter
|
||||
pkgver=r0
|
||||
pkgrel=1
|
||||
pkgdesc='Routes N1MM Logger+ antenna rotator commands to the right rotator controller by band'
|
||||
arch=('any')
|
||||
url='https://git.lixko.eu/ericek111/RotRouter'
|
||||
license=('ISC')
|
||||
depends=('nodejs')
|
||||
makedepends=('git' 'npm')
|
||||
provides=('rotrouter')
|
||||
conflicts=('rotrouter')
|
||||
backup=('etc/rotrouter/config.json')
|
||||
source=("$_pkgname::git+ssh://git@git.lixko.eu/ericek111/RotRouter.git")
|
||||
sha256sums=('SKIP')
|
||||
|
||||
pkgver() {
|
||||
cd "$_pkgname"
|
||||
printf 'r%s.%s' "$(git rev-list --count HEAD)" "$(git rev-parse --short=7 HEAD)"
|
||||
}
|
||||
|
||||
prepare() {
|
||||
cd "$_pkgname"
|
||||
npm ci --cache "$srcdir/npm-cache" --no-audit --no-fund
|
||||
}
|
||||
|
||||
build() {
|
||||
cd "$_pkgname"
|
||||
npm run build
|
||||
}
|
||||
|
||||
check() {
|
||||
cd "$_pkgname"
|
||||
npm run typecheck
|
||||
}
|
||||
|
||||
package() {
|
||||
cd "$_pkgname"
|
||||
install -Dm644 dist/rotrouter.cjs "$pkgdir/usr/lib/rotrouter/rotrouter.cjs"
|
||||
install -Dm644 public/index.html "$pkgdir/usr/share/rotrouter/public/index.html"
|
||||
install -Dm644 config.json "$pkgdir/etc/rotrouter/config.json"
|
||||
install -Dm644 packaging/arch/rotrouter.service "$pkgdir/usr/lib/systemd/system/rotrouter.service"
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
[Unit]
|
||||
Description=RotRouter - N1MM antenna rotator router
|
||||
Wants=network-online.target
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
Environment=ROTROUTER_CONFIG=/etc/rotrouter/config.json
|
||||
Environment=ROTROUTER_PUBLIC=/usr/share/rotrouter/public
|
||||
ExecStart=/usr/bin/node /usr/lib/rotrouter/rotrouter.cjs
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
|
||||
# Run as an unprivileged user that systemd allocates on start and releases on
|
||||
# stop; nothing has to be created at install time. Ports 8787 (HTTP) and
|
||||
# 12040 (N1MM UDP) are above 1024, so no capabilities are needed.
|
||||
User=rotrouter
|
||||
DynamicUser=yes
|
||||
CapabilityBoundingSet=
|
||||
AmbientCapabilities=
|
||||
NoNewPrivileges=yes
|
||||
UMask=0077
|
||||
|
||||
# Read-only view of the system; the service writes nothing to disk.
|
||||
ProtectSystem=strict
|
||||
ProtectHome=yes
|
||||
PrivateTmp=yes
|
||||
PrivateDevices=yes
|
||||
ProtectProc=invisible
|
||||
ProcSubset=pid
|
||||
ProtectClock=yes
|
||||
ProtectHostname=yes
|
||||
ProtectKernelTunables=yes
|
||||
ProtectKernelModules=yes
|
||||
ProtectKernelLogs=yes
|
||||
ProtectControlGroups=yes
|
||||
|
||||
RestrictAddressFamilies=AF_INET AF_INET6
|
||||
RestrictNamespaces=yes
|
||||
RestrictRealtime=yes
|
||||
LockPersonality=yes
|
||||
SystemCallArchitectures=native
|
||||
SystemCallFilter=@system-service
|
||||
SystemCallErrorNumber=EPERM
|
||||
# MemoryDenyWriteExecute is deliberately not set: V8's JIT needs W+X memory.
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Reference in New Issue
Block a user