-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.sh
More file actions
executable file
·64 lines (52 loc) · 2.85 KB
/
bootstrap.sh
File metadata and controls
executable file
·64 lines (52 loc) · 2.85 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
#!/usr/bin/env bash
set -euo pipefail
DOTFILES_REPO="https://github.com/stephenyu/dotfiles.git"
DOTFILES_DIR="$HOME/dotfiles"
OS="$(uname -s)"
echo ""
echo "==> Starting bootstrap ($OS)..."
echo ""
# ── 1. Homebrew (macOS only) ───────────────────────────────────────────────────
if [ "$OS" = "Darwin" ]; then
if ! command -v brew &>/dev/null; then
echo "==> Installing Homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
# Ensure brew is on PATH (Apple Silicon path)
eval "$(/opt/homebrew/bin/brew shellenv)" 2>/dev/null || eval "$(/usr/local/bin/brew shellenv)"
fi
# ── 2. Clone dotfiles ──────────────────────────────────────────────────────────
if [ ! -d "$DOTFILES_DIR" ]; then
echo "==> Cloning dotfiles..."
git clone "$DOTFILES_REPO" "$DOTFILES_DIR"
else
echo "==> Dotfiles already cloned, pulling latest..."
git -C "$DOTFILES_DIR" pull
fi
# ── 3. Install packages (macOS only) ──────────────────────────────────────────
if [ "$OS" = "Darwin" ]; then
echo "==> Installing packages from Brewfile..."
brew bundle --file="$DOTFILES_DIR/Brewfile"
fi
# ── 4. Oh My Zsh ──────────────────────────────────────────────────────────────
if [ ! -d "$HOME/.oh-my-zsh" ]; then
echo "==> Installing Oh My Zsh..."
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
fi
# ── 5. Rust ────────────────────────────────────────────────────────────────────
if ! command -v cargo &>/dev/null; then
echo "==> Installing Rust..."
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
fi
# Ensure cargo is on PATH
# shellcheck source=/dev/null
source "$HOME/.cargo/env"
# ── 6. Cargo crates ────────────────────────────────────────────────────────────
echo "==> Installing cargo crates..."
cargo install gitstatus ccal
# ── 7. Symlink dotfiles ────────────────────────────────────────────────────────
echo "==> Symlinking dotfiles..."
make -C "$DOTFILES_DIR"
echo ""
echo "✓ Done! Open a new terminal to get started."
echo ""