move stopping app and service to preinstall

This commit is contained in:
Pascal Fischer 2023-06-06 17:35:27 +02:00
parent a0e133bd92
commit eac492be9b
2 changed files with 13 additions and 8 deletions

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,9 +19,7 @@ mkdir -p /usr/local/bin/
exit 1 exit 1
fi fi
osascript -e 'quit app "Netbird"' || true ln -fs $APP/Contents/MacOS/netbird $AGENT
ln -s $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
@ -27,9 +27,6 @@ mkdir -p /usr/local/bin/
exit 1 exit 1
fi fi
$AGENT service stop || true
$AGENT service uninstall || true
$AGENT service install || true $AGENT service install || true
$AGENT service start || true $AGENT service start || true
@ -38,3 +35,4 @@ mkdir -p /usr/local/bin/
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