diff --git a/release_files/darwin-ui-installer.sh b/release_files/darwin-ui-installer.sh index 8bc194f80..c7fc55fd6 100644 --- a/release_files/darwin-ui-installer.sh +++ b/release_files/darwin-ui-installer.sh @@ -27,6 +27,13 @@ then echo "Please run: brew install netbirdio/tap/netbird" echo "to update it" fi + +if [ -n "$NB_BIN" ] +then + echo "Stopping NetBird daemon" + netbird service stop || true +fi + # start netbird daemon service echo "Starting Netbird daemon" netbird service install || true diff --git a/release_files/darwin_pkg/postinstall b/release_files/darwin_pkg/postinstall index 503a2a2b5..33fa4bfee 100755 --- a/release_files/darwin_pkg/postinstall +++ b/release_files/darwin_pkg/postinstall @@ -1,8 +1,10 @@ #!/bin/sh +set -x + APP=/Applications/NetBird.app 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 /usr/local/bin/ @@ -17,7 +19,7 @@ mkdir -p /usr/local/bin/ exit 1 fi - ln -s $APP/Contents/MacOS/netbird $AGENT + ln -fs $APP/Contents/MacOS/netbird $AGENT if test -f $AGENT; then echo "NetBird binary linked successfully." else @@ -25,11 +27,12 @@ mkdir -p /usr/local/bin/ exit 1 fi - $AGENT service install - $AGENT service start + $AGENT service install || true + $AGENT service start || true open $APP echo "Finished Netbird installation successfully" exit 0 # all good } &> $LOG_FILE + diff --git a/release_files/darwin_pkg/preinstall b/release_files/darwin_pkg/preinstall index 83f571ac6..cdea1465c 100755 --- a/release_files/darwin_pkg/preinstall +++ b/release_files/darwin_pkg/preinstall @@ -1,10 +1,17 @@ #!/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/ { + osascript -e 'quit app "Netbird"' || true + $AGENT service stop || true + echo "Preinstall complete" exit 0 # all good } &> $LOG_FILE +