Aggiungi script di build APK e template APKBUILD per WatchYourLAN

This commit is contained in:
wonka929 2026-02-21 11:33:59 +01:00
parent ef7b9a30b5
commit d1b67dbb6b
2 changed files with 84 additions and 0 deletions

44
pack/alpine/APKBUILD Normal file
View file

@ -0,0 +1,44 @@
# APKBUILD template for WatchYourLAN
# Place this file in pack/alpine/ and run the included build script on an Alpine environment
pkgname=watchyourlan
pkgver=2.4.1
pkgrel=0
pkgdesc="WatchYourLAN - network host scanner and UI"
url="https://github.com/aceberg/WatchYourLAN"
arch="x86_64"
license="MIT"
depends="inetutils-ping"
makedepends="go git"
source=""
build() {
cd "$srcdir/$pkgname-$pkgver" || return 1
export CGO_ENABLED=0
export GOOS=linux
export GOARCH=x86_64
GOPATH="" # ensure module mode
go build -ldflags "-s -w" -o watchyourlan ./backend/cmd/WatchYourLAN
}
check() {
return 0
}
package() {
installdir "$pkgdir/usr/bin"
install -Dm0755 "$srcdir/$pkgname-$pkgver/watchyourlan" "$pkgdir/usr/bin/watchyourlan"
installdir "$pkgdir/etc/watchyourlan"
if [ -f "$srcdir/$pkgname-$pkgver/configs/watchyourlan" ]; then
install -Dm0644 "$srcdir/$pkgname-$pkgver/configs/watchyourlan" "$pkgdir/etc/watchyourlan/watchyourlan"
fi
# Install systemd unit (optional; Alpine typically uses OpenRC)
if [ -f "$srcdir/$pkgname-$pkgver/configs/watchyourlan.service" ]; then
installdir "$pkgdir/usr/lib/systemd/system"
install -Dm0644 "$srcdir/$pkgname-$pkgver/configs/watchyourlan.service" "$pkgdir/usr/lib/systemd/system/watchyourlan.service"
fi
}
sha512sums=""

40
pack/alpine/build-apk.sh Normal file
View file

@ -0,0 +1,40 @@
#!/usr/bin/env sh
set -e
# Simple helper to build the APK using abuild.
# NOTE: abuild must be run on an Alpine system (or in an Alpine chroot/container)
# and NOT as root. See the README below for setup notes.
HERE=$(cd "$(dirname "$0")" && pwd)
PKGDIR=$(cd "$HERE" && pwd)
if ! command -v abuild >/dev/null 2>&1; then
echo "abuild non trovato. Installa 'abuild' in Alpine: apk add abuild alpine-sdk" >&2
exit 1
fi
if [ "$(id -u)" -eq 0 ]; then
echo "Non eseguire questo script come root. Esegui come utente normale in Alpine." >&2
exit 1
fi
# Generate abuild key if missing
if [ ! -f "$HOME/.abuild/abuild-$(whoami).rsa" ]; then
echo "Generazione chiave abuild (abuild-keygen -a -i)..."
abuild-keygen -a -i
fi
echo "Preparazione directory di build..."
tmpdir=$(mktemp -d)
trap 'rm -rf "$tmpdir"' EXIT
echo "Copia sorgenti in $tmpdir"
# copy repository into a folder named watchyourlan-<ver> as expected by abuild
cp -a "$PKGDIR/../." "$tmpdir/watchyourlan-2.4.1"
cp "$PKGDIR/APKBUILD" "$tmpdir/watchyourlan-2.4.1/"
cd "$tmpdir/watchyourlan-2.4.1"
echo "Avvio build con abuild -r (richiede pacchetti makedepends installati)..."
abuild -r
echo "Build completata. I pacchetti si trovano in ~/packages/ o nella directory configurata da abuild."