All checks were successful
Update Dispatches / refresh-news (push) Successful in 2s
add apple interactive menu support
69 lines
2.5 KiB
Bash
69 lines
2.5 KiB
Bash
#!/bin/bash
|
|
# -----------------------------------------------------------------------
|
|
# Dynasty Module: Universal NetBird Strike v1.1 (Dual-Native UI)
|
|
# -----------------------------------------------------------------------
|
|
|
|
# --- 1. OS & Architecture Detection ---
|
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
OS="macOS"
|
|
ARCH=$(uname -m)
|
|
NB_VERSION="0.30.1"
|
|
|
|
if [[ "$ARCH" == "arm64" ]]; then
|
|
FILE_NAME="netbird_ui_darwin_arm64.pkg"
|
|
else
|
|
FILE_NAME="netbird_ui_darwin_amd64.pkg"
|
|
fi
|
|
PKG_URL="https://github.com/netbirdio/netbird/releases/download/v${NB_VERSION}/${FILE_NAME}"
|
|
else
|
|
OS="Linux"
|
|
fi
|
|
|
|
# --- 2. Execution Logic ---
|
|
echo "-------------------------------------------------"
|
|
echo "Initiating NetBird Strike v1.1 on $OS"
|
|
echo "-------------------------------------------------"
|
|
|
|
if [[ "$OS" == "macOS" ]]; then
|
|
# macOS Native Strike
|
|
if ! command -v netbird &> /dev/null; then
|
|
echo "ACTION: Downloading Native Package for $ARCH..."
|
|
curl -L "$PKG_URL" -o "/tmp/netbird.pkg"
|
|
|
|
echo "ACTION: Installing (Admin Password Required)..."
|
|
sudo installer -pkg "/tmp/netbird.pkg" -target /
|
|
rm "/tmp/netbird.pkg"
|
|
else
|
|
echo "STATUS: NetBird is already manifested on this Mac."
|
|
fi
|
|
else
|
|
# Linux Strike
|
|
if ! command -v netbird &> /dev/null; then
|
|
echo "ACTION: Fetching Linux Repository..."
|
|
curl -sSL https://pkgs.netbird.io/install.sh | sudo bash
|
|
else
|
|
echo "STATUS: NetBird already exists in this realm."
|
|
fi
|
|
fi
|
|
|
|
# --- 3. The Dual-Native UI Prompt ---
|
|
if [[ "$OS" == "macOS" ]]; then
|
|
# Native macOS Popup Box
|
|
SETUP_KEY=$(osascript -e 'display dialog "Enter your NetBird Setup Key (Leave blank for UI login):" default answer "" with title "Dynasty NetBird Manifest" buttons {"Cancel", "Strike"} default button "Strike"' -e 'text returned of result' 2>/dev/null)
|
|
# If user hits Cancel, exit gracefully
|
|
if [ $? -ne 0 ]; then
|
|
echo "Operation Cancelled."
|
|
exit 0
|
|
fi
|
|
else
|
|
# Native Linux Terminal Box (Fallback to read if no whiptail)
|
|
if command -v whiptail >/dev/null 2>&1; then
|
|
SETUP_KEY=$(whiptail --title "NetBird Manifest" --inputbox "Enter your Setup Key (Leave blank for UI login):" 10 60 3>&1 1>&2 2>&3)
|
|
else
|
|
echo "-------------------------------------------------"
|
|
read -p "Enter Setup Key (or leave blank for UI login): " SETUP_KEY < /dev/tty
|
|
fi
|
|
fi
|
|
|
|
# --- 4. Final Connection ---
|
|
if [[ -n "$SETUP_ |