2022-05-25 19:41:03 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
2022-06-20 11:34:24 +02:00
|
|
|
export PATH=$PATH:/usr/local/bin:/opt/homebrew/bin
|
2022-05-25 19:41:03 +02:00
|
|
|
|
|
|
|
# check if wiretrustee is installed
|
|
|
|
WT_BIN=$(which wiretrustee)
|
|
|
|
if [ -n "$WT_BIN" ]
|
|
|
|
then
|
|
|
|
echo "Stopping and uninstalling Wiretrustee daemon"
|
|
|
|
wiretrustee service stop || true
|
|
|
|
wiretrustee service uninstall || true
|
|
|
|
fi
|
|
|
|
# check if netbird is installed
|
|
|
|
NB_BIN=$(which netbird)
|
|
|
|
if [ -z "$NB_BIN" ]
|
|
|
|
then
|
|
|
|
echo "Netbird daemon is not installed. Please run: brew install netbirdio/tap/netbird"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
NB_UI_VERSION=$1
|
|
|
|
NB_VERSION=$(netbird version)
|
|
|
|
if [ "X-$NB_UI_VERSION" != "X-$NB_VERSION" ]
|
|
|
|
then
|
|
|
|
echo "Netbird's daemon is running with a different version than the Netbird's UI:"
|
|
|
|
echo "Netbird UI Version: $NB_UI_VERSION"
|
|
|
|
echo "Netbird Daemon Version: $NB_VERSION"
|
|
|
|
echo "Please run: brew install netbirdio/tap/netbird"
|
|
|
|
echo "to update it"
|
|
|
|
fi
|
2023-06-06 13:02:32 +02:00
|
|
|
|
|
|
|
if [ -n "$NB_BIN" ]
|
|
|
|
then
|
2023-06-06 17:40:28 +02:00
|
|
|
echo "Stopping NetBird daemon"
|
2023-06-11 22:22:03 +02:00
|
|
|
osascript -e 'quit app "Netbird UI"' 2> /dev/null || true
|
|
|
|
netbird service stop 2> /dev/null || true
|
2023-06-06 13:02:32 +02:00
|
|
|
fi
|
|
|
|
|
2022-05-25 19:41:03 +02:00
|
|
|
# start netbird daemon service
|
|
|
|
echo "Starting Netbird daemon"
|
2023-06-11 22:22:03 +02:00
|
|
|
netbird service install 2> /dev/null || true
|
|
|
|
netbird service start || true
|
|
|
|
|
|
|
|
# start app
|
|
|
|
open /Applications/Netbird\ UI.app
|