Skip to content

Commit

Permalink
Restart netbird-ui post-install in linux deb&rpm
Browse files Browse the repository at this point in the history
  • Loading branch information
mohamed-essam committed Jan 15, 2025
1 parent e4a25b6 commit bfaddab
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .goreleaser_ui.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
10 changes: 10 additions & 0 deletions release_files/ui-post-install.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit bfaddab

Please sign in to comment.