From aff030a6fa0c1bf4877c2450ece89486b1b237a5 Mon Sep 17 00:00:00 2001
From: Marty Oehme <contact@martyoeh.me>
Date: Fri, 28 Mar 2025 15:13:10 +0100
Subject: [PATCH] Add netbird-bin package

Only contains the binary release for amd64 atm. Have not had time to
figure out the build process / add more arches.

Will also probably be a little buggy still. There's a system service
included which needs to run for netbird to work.

Setup is a tiny bit cumbersome in that you have to enable the service
_first_ (which will complain about no auth found) and then manually run
`netbird up` with your pre-shared key or sso or whatever method you
choose to authenticate.
---
 README.md                                 |  9 +++++----
 srcpkgs/netbird-bin/files/netbird/log/run |  3 +++
 srcpkgs/netbird-bin/files/netbird/run     |  4 ++++
 srcpkgs/netbird-bin/template              | 21 +++++++++++++++++++++
 4 files changed, 33 insertions(+), 4 deletions(-)
 create mode 100755 srcpkgs/netbird-bin/files/netbird/log/run
 create mode 100755 srcpkgs/netbird-bin/files/netbird/run
 create mode 100644 srcpkgs/netbird-bin/template

diff --git a/README.md b/README.md
index e33b524..f4c6362 100644
--- a/README.md
+++ b/README.md
@@ -32,12 +32,13 @@ Then all packages herein can be installed.
 
 - [x] bemoji
 - [x] ripgrep-all
-- [x] filtile (/src instead of bin)
-- [x] dotter (/src instead of bin)
-- [x] git-bug (/src)
+- [x] filtile (bin build only)
+- [x] dotter
+- [x] git-bug
 - [ ] bugwarrior - only in pypi for now
 - [ ] viddy / hwatch
-- [ ] netbird / protonvpn / piactl
+- [x] netbird (bin build only. After install, enable service, then run 'netbird up')
+- [ ] protonvpn / piactl
   - <https://github.com/pia-foss/desktop/issues/59>
 - [ ] taskopen
 - [ ] dstask
diff --git a/srcpkgs/netbird-bin/files/netbird/log/run b/srcpkgs/netbird-bin/files/netbird/log/run
new file mode 100755
index 0000000..36a49bd
--- /dev/null
+++ b/srcpkgs/netbird-bin/files/netbird/log/run
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+exec vlogger -t netbird -p daemon
diff --git a/srcpkgs/netbird-bin/files/netbird/run b/srcpkgs/netbird-bin/files/netbird/run
new file mode 100755
index 0000000..ac58530
--- /dev/null
+++ b/srcpkgs/netbird-bin/files/netbird/run
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+exec 2>&1
+exec netbird --log-file=console service run
diff --git a/srcpkgs/netbird-bin/template b/srcpkgs/netbird-bin/template
new file mode 100644
index 0000000..d49d529
--- /dev/null
+++ b/srcpkgs/netbird-bin/template
@@ -0,0 +1,21 @@
+# Template file for 'netbird-bin'
+pkgname=netbird-bin
+version=0.39.1
+revision=1
+archs="x86_64"
+short_desc="Connect your devices into a secure WireGuard-based overlay network with SSO, MFA and granular access controls."
+maintainer="Marty Oehme <contact@martyoeh.me>"
+license="BSD-3-Clause"
+homepage="https://github.com/netbirdio/netbird"
+distfiles="${homepage}/releases/download/v${version}/netbird_${version}_linux_amd64.tar.gz"
+checksum=ac4dbf589cf33dc1c347a6dba569cdcaf8a6915f88c6a7baffdb35fcf9b954f0
+
+do_install() {
+    vbin netbird
+}
+
+post_install() {
+    vsv netbird
+    vlicense LICENSE
+    vdoc README.md
+}