From 73101c897757c9f7ae7ed653f42dd91f0112a20b Mon Sep 17 00:00:00 2001 From: "M. Essam" Date: Fri, 21 Feb 2025 20:39:12 +0200 Subject: [PATCH] [client] Restart netbird-ui post-install in linux deb&rpm (#2992) --- .goreleaser_ui.yaml | 4 ++++ release_files/ui-post-install.sh | 10 ++++++++++ 2 files changed, 14 insertions(+) create mode 100644 release_files/ui-post-install.sh diff --git a/.goreleaser_ui.yaml b/.goreleaser_ui.yaml index 983aa0e78..1dd649d1b 100644 --- a/.goreleaser_ui.yaml +++ b/.goreleaser_ui.yaml @@ -50,6 +50,8 @@ nfpms: - netbird-ui formats: - deb + scripts: + postinstall: "release_files/ui-post-install.sh" contents: - src: client/ui/netbird.desktop dst: /usr/share/applications/netbird.desktop @@ -67,6 +69,8 @@ nfpms: - netbird-ui formats: - rpm + scripts: + postinstall: "release_files/ui-post-install.sh" contents: - src: client/ui/netbird.desktop dst: /usr/share/applications/netbird.desktop diff --git a/release_files/ui-post-install.sh b/release_files/ui-post-install.sh new file mode 100644 index 000000000..f6e8ddf92 --- /dev/null +++ b/release_files/ui-post-install.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +# Check if netbird-ui is running +if pgrep -x -f /usr/bin/netbird-ui >/dev/null 2>&1; +then + runner=$(ps --no-headers -o '%U' -p $(pgrep -x -f /usr/bin/netbird-ui) | sed 's/^[ \t]*//;s/[ \t]*$//') + # Only re-run if it was already running + pkill -x -f /usr/bin/netbird-ui >/dev/null 2>&1 + su -l - "$runner" -c 'nohup /usr/bin/netbird-ui > /dev/null 2>&1 &' +fi