-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap
More file actions
executable file
·183 lines (155 loc) · 5.02 KB
/
bootstrap
File metadata and controls
executable file
·183 lines (155 loc) · 5.02 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
#!/bin/bash
################################################################################
# Bootstrap Script for Dotfiles
################################################################################
#
# Description:
# Installs tmux (via apt-get or brew) if missing and then runs setup
# to set up dotfile symlinks.
#
# Usage:
# ./bootstrap
#
# Requirements:
# - apt-get (Ubuntu) or brew (macOS)
# - sudo privileges for package installation (if required by your system)
# - setup script in the same directory
#
################################################################################
set -euo pipefail
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
CYAN='\033[0;36m'
NC='\033[0m' # No Color
have_cmd() {
command -v "$1" >/dev/null 2>&1
}
print_info() {
echo -e "${CYAN}ℹ️ $1${NC}"
}
print_success() {
echo -e "${GREEN}✅ $1${NC}"
}
print_warn() {
echo -e "${YELLOW}⚠️ $1${NC}"
}
print_error() {
echo -e "${RED}❌ $1${NC}"
}
print_step() {
echo -e "${BLUE}📦 $1${NC}"
}
install_tmux() {
if have_cmd tmux; then
TMUX_VERSION=$(tmux -V | awk '{print $2}')
print_success "tmux is already installed (version $TMUX_VERSION)"
return
fi
print_step "tmux is not installed. Installing..."
if have_cmd apt-get; then
print_info "🔄 Updating package list..."
sudo apt-get update -qq
print_info "📥 Installing tmux..."
sudo apt-get install -y tmux
elif have_cmd brew; then
print_info "📥 Installing tmux via Homebrew..."
brew install tmux
else
print_error "No supported package manager found (apt-get or brew). Please install tmux and rerun."
exit 1
fi
if have_cmd tmux; then
TMUX_VERSION=$(tmux -V | awk '{print $2}')
print_success "Successfully installed tmux (version $TMUX_VERSION)"
else
print_error "tmux installation finished but tmux command not found"
exit 1
fi
}
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
DEFAULT_BASE_ROOT_DIR="${BASE_ROOT_DIR:-$HOME/.ng}"
DEFAULT_DOTFILE_SRC="${DOTFILE_SRC:-$SCRIPT_DIR}"
if [[ ! -f "$SCRIPT_DIR/setup" ]]; then
print_error "setup script not found at $SCRIPT_DIR/setup"
exit 1
fi
if RESOLVED_DOTFILE_SRC="$(cd "$DEFAULT_DOTFILE_SRC" 2>/dev/null && pwd)"; then
:
else
print_error "DOTFILE_SRC path not found: $DEFAULT_DOTFILE_SRC"
exit 1
fi
install_font() {
local font_name="JetBrainsMono"
# Check if already installed
if [[ "$(uname)" == "Darwin" ]]; then
if ls ~/Library/Fonts/*NerdFont* &>/dev/null || ls ~/Library/Fonts/*"$font_name"* &>/dev/null; then
print_success "Nerd Font already installed"
return
fi
else
if fc-list 2>/dev/null | grep -qi "nerd\|$font_name"; then
print_success "Nerd Font already installed"
return
fi
fi
print_step "Installing $font_name Nerd Font..."
if have_cmd brew; then
brew install --cask font-jetbrains-mono-nerd-font
else
# Linux: download and install manually
local font_dir="${HOME}/.local/share/fonts"
mkdir -p "$font_dir"
local tmp_dir
tmp_dir=$(mktemp -d)
local url="https://github.com/ryanoasis/nerd-fonts/releases/latest/download/${font_name}.zip"
print_info "Downloading from $url..."
if have_cmd curl; then
curl -fsSL -o "$tmp_dir/$font_name.zip" "$url"
elif have_cmd wget; then
wget -q -O "$tmp_dir/$font_name.zip" "$url"
else
print_error "Need curl or wget to download font"
rm -rf "$tmp_dir"
return 1
fi
unzip -qo "$tmp_dir/$font_name.zip" -d "$font_dir"
rm -rf "$tmp_dir"
fc-cache -f "$font_dir" 2>/dev/null
fi
print_success "$font_name Nerd Font installed"
print_warn "Set your terminal font to 'JetBrainsMono Nerd Font' for powerline symbols"
}
install_rtk() {
if have_cmd rtk; then
print_success "rtk is already installed"
return
fi
print_step "Installing rtk..."
curl -fsSL https://raw.githubusercontent.com/rtk-ai/rtk/refs/heads/master/install.sh | sh
if have_cmd rtk; then
print_success "rtk installed"
else
print_warn "rtk installation finished but rtk command not found in PATH"
fi
}
install_font
install_tmux
install_rtk
print_info "Setting up symlinks..."
print_info "BASE_ROOT_DIR=${DEFAULT_BASE_ROOT_DIR}"
print_info "DOTFILE_SRC=${RESOLVED_DOTFILE_SRC}"
BASE_ROOT_DIR="$DEFAULT_BASE_ROOT_DIR" DOTFILE_SRC="$RESOLVED_DOTFILE_SRC" bash "$SCRIPT_DIR/setup"
print_success "Symlink setup complete"
# Claude Code plugins
if have_cmd claude; then
print_step "Installing Claude Code plugins..."
claude plugin marketplace add Q00/ouroboros 2>/dev/null || true
claude plugin install ouroboros@ouroboros 2>/dev/null || true
print_success "Claude Code plugins installed"
else
print_warn "Claude Code not found — skipping plugin install"
fi