forked from mgile/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·87 lines (75 loc) · 3.8 KB
/
install.sh
File metadata and controls
executable file
·87 lines (75 loc) · 3.8 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/usr/bin/env bash
set -euo pipefail
DOTFILES_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
info() { echo "[info] $*"; }
success() { echo "[ok] $*"; }
warn() { echo "[warn] $*"; }
# ── Homebrew ──────────────────────────────────────────────────────────────────
install_homebrew() {
if command -v brew &>/dev/null; then
info "Homebrew already installed, updating..."
brew update --quiet
else
info "Installing Homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Add brew to PATH for this session (Apple Silicon default path)
eval "$(/opt/homebrew/bin/brew shellenv)" 2>/dev/null || eval "$(/usr/local/bin/brew shellenv)" 2>/dev/null
fi
success "Homebrew ready"
}
# ── Brew bundle ───────────────────────────────────────────────────────────────
run_brew_bundle() {
info "Installing packages from Brewfile..."
brew bundle --file="$DOTFILES_DIR/Brewfile"
success "Brew bundle complete"
}
# ── oh-my-zsh ─────────────────────────────────────────────────────────────────
install_oh_my_zsh() {
if [[ -d "$HOME/.oh-my-zsh" ]]; then
info "oh-my-zsh already installed"
else
info "Installing oh-my-zsh..."
RUNZSH=no CHSH=no sh -c \
"$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
success "oh-my-zsh installed"
fi
}
# ── Link dotfiles ─────────────────────────────────────────────────────────────
link_dotfiles() {
info "Linking dotfiles via rcup..."
rcup -d "$DOTFILES_DIR/dotfiles" -S config/nvim -S config/alacritty -S vim -v
success "Dotfiles linked"
}
# ── Neovim ────────────────────────────────────────────────────────────────────
init_nvim() {
if ! command -v nvim &>/dev/null; then
warn "nvim not found, skipping plugin install"
return
fi
info "Installing nvim plugins via lazy.nvim..."
nvim --headless "+Lazy! sync" +qa
success "Neovim ready (LSP servers will install automatically on first open)"
}
# ── tmux terminfo ─────────────────────────────────────────────────────────────
install_terminfo() {
info "Installing tmux-256color terminfo..."
tic "$DOTFILES_DIR/tmux-256color.terminfo"
success "terminfo installed"
}
# ── Main ──────────────────────────────────────────────────────────────────────
main() {
echo ""
echo "╔══════════════════════════════════╗"
echo "║ dotfiles bootstrap installer ║"
echo "╚══════════════════════════════════╝"
echo ""
install_homebrew
run_brew_bundle
install_oh_my_zsh
link_dotfiles
init_nvim
install_terminfo
echo ""
success "All done! Restart your terminal (or run: source ~/.zshrc)"
}
main "$@"