Merge pull request #937 from netbirdio/fix/kill_process_on_pkg_upgrade

Stop macOS app and service on update with pkg and brew
This commit is contained in:
pascal-fischer 2023-06-07 10:10:36 +02:00 committed by GitHub
commit 7d1b6ea1fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 5 deletions

View File

@ -27,6 +27,13 @@ then
echo "Please run: brew install netbirdio/tap/netbird" echo "Please run: brew install netbirdio/tap/netbird"
echo "to update it" echo "to update it"
fi fi
if [ -n "$NB_BIN" ]
then
echo "Stopping NetBird daemon"
netbird service stop || true
fi
# start netbird daemon service # start netbird daemon service
echo "Starting Netbird daemon" echo "Starting Netbird daemon"
netbird service install || true netbird service install || true

View File

@ -1,8 +1,10 @@
#!/bin/sh #!/bin/sh
set -x
APP=/Applications/NetBird.app APP=/Applications/NetBird.app
AGENT=/usr/local/bin/netbird AGENT=/usr/local/bin/netbird
LOG_FILE=/var/log/netbird/client_install.log LOG_FILE=/var/log/netbird/client_post_install.log
mkdir -p /var/log/netbird/ mkdir -p /var/log/netbird/
mkdir -p /usr/local/bin/ mkdir -p /usr/local/bin/
@ -17,7 +19,7 @@ mkdir -p /usr/local/bin/
exit 1 exit 1
fi fi
ln -s $APP/Contents/MacOS/netbird $AGENT ln -fs $APP/Contents/MacOS/netbird $AGENT
if test -f $AGENT; then if test -f $AGENT; then
echo "NetBird binary linked successfully." echo "NetBird binary linked successfully."
else else
@ -25,11 +27,12 @@ mkdir -p /usr/local/bin/
exit 1 exit 1
fi fi
$AGENT service install $AGENT service install || true
$AGENT service start $AGENT service start || true
open $APP open $APP
echo "Finished Netbird installation successfully" echo "Finished Netbird installation successfully"
exit 0 # all good exit 0 # all good
} &> $LOG_FILE } &> $LOG_FILE

View File

@ -1,10 +1,17 @@
#!/bin/sh #!/bin/sh
LOG_FILE=/var/log/netbird/client_install.log set -x
LOG_FILE=/var/log/netbird/client_pre_install.log
AGENT=/usr/local/bin/netbird
mkdir -p /var/log/netbird/ mkdir -p /var/log/netbird/
{ {
osascript -e 'quit app "Netbird"' || true
$AGENT service stop || true
echo "Preinstall complete" echo "Preinstall complete"
exit 0 # all good exit 0 # all good
} &> $LOG_FILE } &> $LOG_FILE