-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.sh
More file actions
executable file
·61 lines (55 loc) · 1.79 KB
/
bootstrap.sh
File metadata and controls
executable file
·61 lines (55 loc) · 1.79 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
#!/usr/bin/env bash
# Bootstrap a new dev machine before the onboarding repo is cloned.
#
# Usage (once the repo is public):
# curl -fsSL https://raw.githubusercontent.com/sa5mmm7/dev-setup/main/bootstrap.sh | bash
#
# What this does:
# 1. Installs git if missing (Xcode CLT on macOS, apt on WSL2)
# 2. Clones the onboarding repo to ~/dev-setup
# 3. Runs run-onboarding.sh
set -euo pipefail
REPO_URL="https://github.com/sa5mmm7/dev-setup.git"
CLONE_DIR="${HOME}/dev-setup"
# --- helpers ---
info() { echo "[INFO] $*"; }
error() { echo "[ERROR] $*" >&2; exit 1; }
# --- detect OS ---
if [[ "$(uname)" == "Darwin" ]]; then
OS="mac"
elif grep -qi microsoft /proc/version 2>/dev/null; then
OS="wsl2"
else
error "Unsupported OS. Run mac-onboarding/ or windows-onboarding/ manually."
fi
# --- install git if missing ---
if ! command -v git >/dev/null 2>&1; then
if [[ "${OS}" == "mac" ]]; then
echo ""
echo "Git is not installed. macOS will now prompt you to install the"
echo "Xcode Command Line Tools (this includes git)."
echo ""
echo "After the install completes, run this script again:"
echo " curl -fsSL https://raw.githubusercontent.com/sa5mmm7/dev-setup/main/bootstrap.sh | bash"
echo ""
# Trigger the macOS install dialog
git --version 2>/dev/null || true
exit 0
else
info "Installing git via apt..."
sudo apt-get update -qq
sudo apt-get install -y git
fi
fi
# --- clone or update repo ---
if [[ -d "${CLONE_DIR}/.git" ]]; then
info "Repo already exists at ${CLONE_DIR} — pulling latest..."
git -C "${CLONE_DIR}" pull --ff-only
else
info "Cloning onboarding repo to ${CLONE_DIR}..."
git clone "${REPO_URL}" "${CLONE_DIR}"
fi
# --- run onboarding ---
echo ""
info "Repo ready. Starting onboarding..."
exec bash "${CLONE_DIR}/run-onboarding.sh"