Skip to content

Commit b12f6d0

Browse files
committed
Merge branch 'main' into fix/auditor-view-all-peers
2 parents a531869 + d2b42c8 commit b12f6d0

File tree

1 file changed

+30
-6
lines changed

1 file changed

+30
-6
lines changed

release_files/install.sh

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,21 @@ install_native_binaries() {
199199
fi
200200
}
201201

202+
# Handle macOS .pkg installer
203+
install_pkg() {
204+
case "$(uname -m)" in
205+
x86_64) ARCH="amd64" ;;
206+
arm64|aarch64) ARCH="arm64" ;;
207+
*) echo "Unsupported macOS arch: $(uname -m)" >&2; exit 1 ;;
208+
esac
209+
210+
PKG_URL=$(curl -sIL -o /dev/null -w '%{url_effective}' "https://pkgs.netbird.io/macos/${ARCH}")
211+
echo "Downloading NetBird macOS installer from https://pkgs.netbird.io/macos/${ARCH}"
212+
curl -fsSL -o /tmp/netbird.pkg "${PKG_URL}"
213+
${SUDO} installer -pkg /tmp/netbird.pkg -target /
214+
rm -f /tmp/netbird.pkg
215+
}
216+
202217
check_use_bin_variable() {
203218
if [ "${USE_BIN_INSTALL}-x" = "true-x" ]; then
204219
echo "The installation will be performed using binary files"
@@ -265,6 +280,16 @@ install_netbird() {
265280
${SUDO} pacman -Syy
266281
add_aur_repo
267282
;;
283+
pkg)
284+
# Check if the package is already installed
285+
if [ -f /Library/Receipts/netbird.pkg ]; then
286+
echo "NetBird is already installed. Please remove it before proceeding."
287+
exit 1
288+
fi
289+
290+
# Install the package
291+
install_pkg
292+
;;
268293
brew)
269294
# Remove Netbird if it had been installed using Homebrew before
270295
if brew ls --versions netbird >/dev/null 2>&1; then
@@ -274,7 +299,7 @@ install_netbird() {
274299
netbird service stop
275300
netbird service uninstall
276301

277-
# Unlik the app
302+
# Unlink the app
278303
brew unlink netbird
279304
fi
280305

@@ -312,7 +337,7 @@ install_netbird() {
312337
echo "package_manager=$PACKAGE_MANAGER" | ${SUDO} tee "$CONFIG_FILE" > /dev/null
313338

314339
# Load and start netbird service
315-
if [ "$PACKAGE_MANAGER" != "rpm-ostree" ]; then
340+
if [ "$PACKAGE_MANAGER" != "rpm-ostree" ] && [ "$PACKAGE_MANAGER" != "pkg" ]; then
316341
if ! ${SUDO} netbird service install 2>&1; then
317342
echo "NetBird service has already been loaded"
318343
fi
@@ -451,9 +476,8 @@ if type uname >/dev/null 2>&1; then
451476
# Check the availability of a compatible package manager
452477
if check_use_bin_variable; then
453478
PACKAGE_MANAGER="bin"
454-
elif [ -x "$(command -v brew)" ]; then
455-
PACKAGE_MANAGER="brew"
456-
echo "The installation will be performed using brew package manager"
479+
else
480+
PACKAGE_MANAGER="pkg"
457481
fi
458482
;;
459483
esac
@@ -471,4 +495,4 @@ case "$UPDATE_FLAG" in
471495
;;
472496
*)
473497
install_netbird
474-
esac
498+
esac

0 commit comments

Comments
 (0)