blob: 4bf25d83a68785b044023655ab561e2bd8a1ee7c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# Maintainer: Dylan Sandall <thebudman6@proton.me>
pkgname=wingman-git
_pkgname=wingman
pkgver=0.1.4.r79.gd0e45e4
pkgrel=1
pkgdesc="Run multiple NetBird networks on one machine at once — isolated configs, sockets, and WireGuard interfaces"
arch=('any')
url="https://github.com/dsandall/wingman"
license=('MIT')
# netbird is provided by the AUR package of the same name (wingman shells out
# to the `netbird` binary and is non-functional without it). libcap provides
# setcap/getcap: wingman grants CAP_NET_ADMIN to netbird so a rootless daemon
# can create its WireGuard interface (see the .install and the pacman hook).
# polkit carries the rule that lets a rootless daemon configure systemd-resolved
# per-interface DNS (see the shipped 50-wingman-netbird-dns.rules).
depends=('python' 'python-typer' 'netbird' 'libcap' 'polkit')
makedepends=('git' 'python-build' 'python-installer' 'python-wheel' 'python-hatchling')
provides=('wingman')
conflicts=('wingman')
install="$pkgname.install"
source=("$_pkgname::git+https://github.com/dsandall/wingman.git")
sha256sums=('SKIP')
pkgver() {
cd "$srcdir/$_pkgname"
# <pyproject version>.r<commit count>.g<short sha> — base version stays the
# single source of truth in pyproject.toml.
local base
base=$(grep -m1 '^version' pyproject.toml | sed -E 's/.*"(.*)".*/\1/')
printf '%s.r%s.g%s' "$base" "$(git rev-list --count HEAD)" \
"$(git rev-parse --short=7 HEAD)"
}
build() {
cd "$srcdir/$_pkgname"
python -m build --wheel --no-isolation
}
package() {
cd "$srcdir/$_pkgname"
python -m installer --destdir="$pkgdir" dist/*.whl
install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$_pkgname/LICENSE"
install -Dm644 README.md "$pkgdir/usr/share/doc/$_pkgname/README.md"
# Pacman hook that reapplies CAP_NET_ADMIN to netbird after every netbird
# (re)install/upgrade — pacman strips file caps, so without this a rootless
# daemon silently loses the ability to create its WireGuard interface.
install -Dm644 packaging/arch/wingman-netbird-setcap.hook \
"$pkgdir/usr/share/libalpm/hooks/wingman-netbird-setcap.hook"
# polkit rule letting a rootless daemon set its interface's DNS via
# systemd-resolved. Unlike the file capability above, polkit rules survive
# package upgrades, so this needs no reapply hook — just ship the file.
install -Dm644 packaging/arch/wingman-netbird-dns.rules \
"$pkgdir/usr/share/polkit-1/rules.d/50-wingman-netbird-dns.rules"
}
|