Repository navigation
Expand file tree
/
Copy pathbootstrap_macos.sh
More file actions
executable file
·67 lines (58 loc) · 2.34 KB
/
Copy pathbootstrap_macos.sh
File metadata and controls
executable file
·67 lines (58 loc) · 2.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/env bash
# One-shot macOS installer for NMLinux — installs everything from a bare
# system: Xcode Command Line Tools, Homebrew, system tools, then NMLinux
# itself via install_macos_app.sh.
#
# Usage:
# curl -fsSL https://raw.githubusercontent.com/thongor77/nmlinux/main/packaging/bootstrap_macos.sh | bash
#
# Re-running is safe: each step is skipped if already satisfied, and the
# NMLinux checkout is updated (git pull) instead of re-cloned.
#
# Pass --system to install NMLinux.app into /Applications instead of
# ~/Applications, e.g.:
# curl -fsSL .../bootstrap_macos.sh | bash -s -- --system
set -euo pipefail
REPO_URL="https://github.com/thongor77/nmlinux.git"
SRC_DIR="${HOME}/.local/share/nmlinux/src"
echo "== NMLinux macOS bootstrap =="
# --- 1. Xcode Command Line Tools (provides git + cc) ---
if ! xcode-select -p &>/dev/null; then
echo "Xcode Command Line Tools not found — requesting install (a system dialog will appear)..."
xcode-select --install
echo "Waiting for the Xcode Command Line Tools install to finish (accept the dialog)..."
until xcode-select -p &>/dev/null; do
sleep 5
done
echo "Xcode Command Line Tools installed."
else
echo "Xcode Command Line Tools already present."
fi
# --- 2. Homebrew ---
if ! command -v brew &>/dev/null; then
echo "Homebrew not found — installing (you will be asked for your password)..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
if [[ -x /opt/homebrew/bin/brew ]]; then
eval "$(/opt/homebrew/bin/brew shellenv)"
elif [[ -x /usr/local/bin/brew ]]; then
eval "$(/usr/local/bin/brew shellenv)"
fi
else
echo "Homebrew already present."
fi
# --- 3. System tools ---
echo "Installing system tools via Homebrew (nmap, mtr, curl, whois, net-snmp, samba)..."
brew install nmap mtr curl whois net-snmp samba
# --- 4. Clone or update NMLinux ---
if [[ -d "${SRC_DIR}/.git" ]]; then
echo "Updating existing NMLinux checkout in ${SRC_DIR}..."
git -C "${SRC_DIR}" pull
else
echo "Cloning NMLinux into ${SRC_DIR}..."
mkdir -p "$(dirname "${SRC_DIR}")"
git clone "${REPO_URL}" "${SRC_DIR}"
fi
# --- 5. Install the app (venv + NMLinux.app) ---
bash "${SRC_DIR}/packaging/install_macos_app.sh" "$@"
echo ""
echo "Done. Launch NMLinux with: open ~/Applications/NMLinux.app"