Add AUR package (PKGBUILD) with systemd service and test script
All checks were successful
CI / test (push) Successful in 2m11s
All checks were successful
CI / test (push) Successful in 2m11s
- deploy/aur/PKGBUILD: builds from source, installs binary + man page + systemd unit - deploy/aur/.SRCINFO: AUR metadata - deploy/aur/test-aur.sh: tests PKGBUILD in Docker Arch container - Supports x86_64, aarch64, armv7h architectures Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
15
deploy/aur/.SRCINFO
Normal file
15
deploy/aur/.SRCINFO
Normal file
@@ -0,0 +1,15 @@
|
||||
pkgbase = btest-rs
|
||||
pkgdesc = MikroTik Bandwidth Test (btest) server and client with EC-SRP5 auth
|
||||
pkgver = 0.6.0
|
||||
pkgrel = 1
|
||||
url = https://github.com/manawenuz/btest-rs
|
||||
arch = x86_64
|
||||
arch = aarch64
|
||||
arch = armv7h
|
||||
license = MIT
|
||||
license = Apache-2.0
|
||||
makedepends = cargo
|
||||
source = btest-rs-0.6.0.tar.gz::https://github.com/manawenuz/btest-rs/archive/refs/tags/v0.6.0.tar.gz
|
||||
sha256sums = SKIP
|
||||
|
||||
pkgname = btest-rs
|
||||
58
deploy/aur/PKGBUILD
Normal file
58
deploy/aur/PKGBUILD
Normal file
@@ -0,0 +1,58 @@
|
||||
# Maintainer: Siavash Sameni <manwe at manko dot yoga>
|
||||
pkgname=btest-rs
|
||||
pkgver=0.6.0
|
||||
pkgrel=1
|
||||
pkgdesc="MikroTik Bandwidth Test (btest) server and client with EC-SRP5 auth"
|
||||
arch=('x86_64' 'aarch64' 'armv7h')
|
||||
url="https://github.com/manawenuz/btest-rs"
|
||||
license=('MIT' 'Apache-2.0')
|
||||
depends=()
|
||||
makedepends=('cargo')
|
||||
source=("$pkgname-$pkgver.tar.gz::https://github.com/manawenuz/btest-rs/archive/refs/tags/v$pkgver.tar.gz")
|
||||
sha256sums=('SKIP')
|
||||
|
||||
prepare() {
|
||||
cd "$pkgname-$pkgver"
|
||||
export RUSTUP_TOOLCHAIN=stable
|
||||
cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')"
|
||||
}
|
||||
|
||||
build() {
|
||||
cd "$pkgname-$pkgver"
|
||||
export RUSTUP_TOOLCHAIN=stable
|
||||
export CARGO_TARGET_DIR=target
|
||||
cargo build --frozen --release
|
||||
}
|
||||
|
||||
package() {
|
||||
cd "$pkgname-$pkgver"
|
||||
install -Dm755 "target/release/btest" "$pkgdir/usr/bin/btest"
|
||||
install -Dm644 "LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
|
||||
install -Dm644 "docs/man/btest.1" "$pkgdir/usr/share/man/man1/btest.1"
|
||||
install -Dm644 "README.md" "$pkgdir/usr/share/doc/$pkgname/README.md"
|
||||
|
||||
# systemd service
|
||||
install -Dm644 /dev/stdin "$pkgdir/usr/lib/systemd/system/btest.service" <<EOF
|
||||
[Unit]
|
||||
Description=MikroTik Bandwidth Test Server (btest-rs)
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/usr/bin/btest -s
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
DynamicUser=yes
|
||||
NoNewPrivileges=yes
|
||||
ProtectSystem=strict
|
||||
ProtectHome=yes
|
||||
PrivateTmp=yes
|
||||
AmbientCapabilities=CAP_NET_BIND_SERVICE
|
||||
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
|
||||
LimitNOFILE=65535
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
}
|
||||
40
deploy/aur/test-aur.sh
Executable file
40
deploy/aur/test-aur.sh
Executable file
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env bash
|
||||
# Test the PKGBUILD in a Docker Arch Linux container.
|
||||
# Usage: ./deploy/aur/test-aur.sh
|
||||
set -euo pipefail
|
||||
|
||||
cd "$(dirname "$0")/../.."
|
||||
|
||||
echo "=== Testing AUR PKGBUILD in Arch Linux container ==="
|
||||
|
||||
docker run --rm -v "$(pwd):/src:ro" archlinux:latest bash -c '
|
||||
set -euo pipefail
|
||||
|
||||
# Install base-devel and rust
|
||||
pacman -Syu --noconfirm base-devel rustup git
|
||||
rustup default stable
|
||||
|
||||
# Create build user (makepkg refuses to run as root)
|
||||
useradd -m builder
|
||||
echo "builder ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
|
||||
|
||||
# Copy source and PKGBUILD
|
||||
su builder -c "
|
||||
mkdir -p /tmp/build && cd /tmp/build
|
||||
cp /src/deploy/aur/PKGBUILD .
|
||||
|
||||
# Build the package
|
||||
makepkg -si --noconfirm
|
||||
|
||||
# Verify
|
||||
echo ''
|
||||
echo '=== Installed ==='
|
||||
btest --version
|
||||
btest --help | head -5
|
||||
echo ''
|
||||
echo '=== Files ==='
|
||||
pacman -Ql btest-rs
|
||||
echo ''
|
||||
echo '=== SUCCESS ==='
|
||||
"
|
||||
'
|
||||
Reference in New Issue
Block a user