-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall_linux.sh
More file actions
executable file
·726 lines (617 loc) · 22.5 KB
/
install_linux.sh
File metadata and controls
executable file
·726 lines (617 loc) · 22.5 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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
#!/usr/bin/env bash
# ========================================
# Linux Dotfiles Bootstrap Script
# ========================================
# One-liner for fresh machine:
# bash <(curl -fsSL https://raw.githubusercontent.com/cedi/dotfiles/main/install_linux.sh)
#
# Features:
# - Self-bootstrapping: installs git, clones repo
# - Interactive menu for component selection
# - Preset modes: full, core, server, extras
# - Smart detection: skips already-installed tools
# - Idempotent: safe to run multiple times
# - Non-interactive mode: ./install_linux.sh --yes --preset server
set -e
# ═══════════════════════════════════════════════════════════════
# Configuration
# ═══════════════════════════════════════════════════════════════
GITHUB_REPO="cedi/dotfiles"
DOTFILES_DIR="${HOME}/.dotfiles"
AUTO_YES=false
PRESET=""
# Colors
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
BOLD='\033[1m'
# ═══════════════════════════════════════════════════════════════
# Package Lists
# ═══════════════════════════════════════════════════════════════
# Minimal packages for server preset (homelab/Pi)
SERVER_APT_PACKAGES=(
fish tmux stow fzf
bat ripgrep tree
git neovim gnupg
htop curl wget unzip
)
# Core packages for development (includes server packages)
CORE_APT_PACKAGES=(
"${SERVER_APT_PACKAGES[@]}"
build-essential
ca-certificates
libdbus-1-3 libdbus-1-dev
pkg-config
jq
python3 python3-pip
)
# Extra packages (networking, media, build tools)
EXTRAS_APT_PACKAGES=(
mosh socat rsync tcpdump
lldpad fastfetch
apt-transport-https
)
# ═══════════════════════════════════════════════════════════════
# Parse Arguments
# ═══════════════════════════════════════════════════════════════
while [[ $# -gt 0 ]]; do
case $1 in
-y | --yes)
AUTO_YES=true
shift
;;
-p | --preset)
PRESET="$2"
shift 2
;;
-h | --help)
echo "Usage: $0 [OPTIONS]"
echo ""
echo "Options:"
echo " -y, --yes Non-interactive mode"
echo " -p, --preset PRESET Installation preset (full, core, server, extras)"
echo " -h, --help Show this help message"
echo ""
echo "Presets:"
echo " full - Workstation: all tools + runtimes + k8s"
echo " core - Dev server: shell, editor, k8s, cloud tools"
echo " server - Homelab/Pi: shell, editor, stow only (default)"
echo " extras - Extra apt packages only"
exit 0
;;
*)
shift
;;
esac
done
# ═══════════════════════════════════════════════════════════════
# Helper Functions
# ═══════════════════════════════════════════════════════════════
print_header() {
echo -e "\n${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo -e "${BOLD}$1${NC}"
echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
}
print_status() {
local status=$1
local message=$2
case $status in
"ok") echo -e " ${GREEN}✓${NC} $message" ;;
"skip") echo -e " ${YELLOW}○${NC} $message ${YELLOW}(already installed)${NC}" ;;
"install") echo -e " ${BLUE}→${NC} $message" ;;
"error") echo -e " ${RED}✗${NC} $message" ;;
esac
}
is_installed() {
command -v "$1" &>/dev/null
}
confirm() {
if $AUTO_YES; then return 0; fi
local prompt="$1 [Y/n] "
read -r -p "$prompt" response
[[ -z "$response" || "$response" =~ ^[Yy]$ ]]
}
detect_arch() {
case $(uname -m) in
x86_64) echo "amd64" ;;
aarch64) echo "arm64" ;;
armv7l) echo "arm" ;;
*) echo "unknown" ;;
esac
}
# ═══════════════════════════════════════════════════════════════
# Bootstrap (for fresh machines)
# ═══════════════════════════════════════════════════════════════
bootstrap_dotfiles() {
# If dotfiles already exist, pull latest updates
if [[ -d "$DOTFILES_DIR" ]]; then
if [[ -d "$DOTFILES_DIR/.git" ]]; then
print_status "install" "Updating dotfiles repository..."
if git -C "$DOTFILES_DIR" pull --ff-only 2>/dev/null; then
print_status "ok" "Dotfiles updated"
else
print_status "skip" "Dotfiles up to date (or merge required)"
fi
fi
return 0
fi
print_header "Bootstrap: Fresh Machine Detected"
echo -e " ${YELLOW}~/.dotfiles not found. Setting up from scratch...${NC}\n"
# Ensure git is available
if ! is_installed git; then
print_status "install" "Installing git..."
sudo apt-get update
sudo apt-get install -y git
print_status "ok" "git installed"
else
print_status "skip" "git"
fi
# Clone dotfiles repository
print_status "install" "Cloning dotfiles repository..."
git clone "https://github.com/${GITHUB_REPO}.git" "$DOTFILES_DIR"
print_status "ok" "Dotfiles cloned to $DOTFILES_DIR"
echo -e "\n ${GREEN}Bootstrap complete!${NC} Continuing with installation...\n"
}
# ═══════════════════════════════════════════════════════════════
# Installation Functions
# ═══════════════════════════════════════════════════════════════
ensure_dirs() {
print_header "Preparing directories"
mkdir -p "$HOME/.config"
mkdir -p "$HOME/.local/bin"
print_status "ok" "~/.config and ~/.local/bin exist"
}
install_apt_packages() {
local packages=("$@")
local name="${packages[0]}"
unset 'packages[0]'
print_header "APT Packages: $name"
print_status "install" "Updating apt cache..."
sudo apt-get update
print_status "install" "Installing $name packages..."
if sudo apt-get install -y "${packages[@]}"; then
print_status "ok" "$name packages installed"
else
print_status "error" "Some $name packages failed (continuing...)"
fi
}
install_eza() {
print_header "External Repo: eza"
if is_installed eza; then
print_status "skip" "eza"
return 0
fi
print_status "install" "Adding eza repository..."
sudo mkdir -p /etc/apt/keyrings
wget -qO- https://raw.githubusercontent.com/eza-community/eza/main/deb.asc | sudo gpg --dearmor -o /etc/apt/keyrings/gierens.gpg 2>/dev/null || true
echo "deb [signed-by=/etc/apt/keyrings/gierens.gpg] http://deb.gierens.de stable main" | sudo tee /etc/apt/sources.list.d/gierens.list >/dev/null
sudo chmod 644 /etc/apt/keyrings/gierens.gpg /etc/apt/sources.list.d/gierens.list 2>/dev/null || true
sudo apt-get update
sudo apt-get install -y eza
print_status "ok" "eza installed"
}
install_gh_cli() {
print_header "External Repo: GitHub CLI"
if is_installed gh; then
print_status "skip" "GitHub CLI"
return 0
fi
print_status "install" "Adding GitHub CLI repository..."
sudo mkdir -p /etc/apt/keyrings
wget -qO- https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg >/dev/null
sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list >/dev/null
sudo apt-get update
sudo apt-get install -y gh
print_status "ok" "GitHub CLI installed"
}
install_oh_my_posh() {
print_header "Binary Tool: oh-my-posh"
if is_installed oh-my-posh; then
print_status "skip" "oh-my-posh"
return 0
fi
local arch
arch=$(detect_arch)
local url="https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/posh-linux-${arch}"
print_status "install" "Downloading oh-my-posh..."
sudo wget -q "$url" -O /usr/local/bin/oh-my-posh
sudo chmod +x /usr/local/bin/oh-my-posh
print_status "ok" "oh-my-posh installed"
}
install_zoxide() {
print_header "Binary Tool: zoxide"
if is_installed zoxide; then
print_status "skip" "zoxide"
return 0
fi
print_status "install" "Installing zoxide..."
curl -sS https://raw.githubusercontent.com/ajeetdsouza/zoxide/main/install.sh | bash -s -- --bin-dir "$HOME/.local/bin" 2>/dev/null
print_status "ok" "zoxide installed"
}
install_mise() {
print_header "Binary Tool: mise"
if is_installed mise; then
print_status "skip" "mise"
return 0
fi
print_status "install" "Installing mise..."
curl -fsSL https://mise.run | sh
print_status "ok" "mise installed"
}
install_yq() {
print_header "Binary Tool: yq"
if is_installed yq; then
print_status "skip" "yq"
return 0
fi
local arch
arch=$(detect_arch)
local url="https://github.com/mikefarah/yq/releases/latest/download/yq_linux_${arch}"
print_status "install" "Downloading yq..."
sudo wget -q "$url" -O /usr/local/bin/yq
sudo chmod +x /usr/local/bin/yq
print_status "ok" "yq installed"
}
install_delta() {
print_header "Binary Tool: delta"
if is_installed delta; then
print_status "skip" "delta"
return 0
fi
local arch
arch=$(detect_arch)
local deb_arch
case $arch in
amd64) deb_arch="amd64" ;;
arm64) deb_arch="arm64" ;;
*)
print_status "error" "Unsupported architecture for delta"
return 1
;;
esac
print_status "install" "Downloading delta..."
local tmp_dir
tmp_dir=$(mktemp -d)
local version
version=$(curl -sL https://api.github.com/repos/dandavison/delta/releases/latest | grep '"tag_name"' | sed -E 's/.*"([^"]+)".*/\1/')
wget -q "https://github.com/dandavison/delta/releases/download/${version}/git-delta_${version}_${deb_arch}.deb" -O "${tmp_dir}/delta.deb"
sudo dpkg -i "${tmp_dir}/delta.deb"
rm -rf "${tmp_dir}"
print_status "ok" "delta installed"
}
install_kubectl() {
print_header "Kubernetes: kubectl"
if is_installed kubectl; then
print_status "skip" "kubectl"
return 0
fi
print_status "install" "Adding Kubernetes repository..."
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.31/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg 2>/dev/null || true
echo "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.31/deb/ /" | sudo tee /etc/apt/sources.list.d/kubernetes.list >/dev/null
sudo apt-get update
sudo apt-get install -y kubectl
print_status "ok" "kubectl installed"
}
install_kubectx() {
print_header "Kubernetes: kubectx/kubens"
if is_installed kubectx; then
print_status "skip" "kubectx"
return 0
fi
local arch
arch=$(detect_arch)
local version
version=$(curl -sL https://api.github.com/repos/ahmetb/kubectx/releases/latest | grep '"tag_name"' | sed -E 's/.*"v?([^"]+)".*/\1/')
print_status "install" "Downloading kubectx/kubens..."
local tmp_dir
tmp_dir=$(mktemp -d)
wget -q "https://github.com/ahmetb/kubectx/releases/download/v${version}/kubectx_v${version}_linux_${arch}.tar.gz" -O "${tmp_dir}/kubectx.tar.gz"
wget -q "https://github.com/ahmetb/kubectx/releases/download/v${version}/kubens_v${version}_linux_${arch}.tar.gz" -O "${tmp_dir}/kubens.tar.gz"
tar -xzf "${tmp_dir}/kubectx.tar.gz" -C "${tmp_dir}"
tar -xzf "${tmp_dir}/kubens.tar.gz" -C "${tmp_dir}"
sudo mv "${tmp_dir}/kubectx" /usr/local/bin/
sudo mv "${tmp_dir}/kubens" /usr/local/bin/
rm -rf "${tmp_dir}"
print_status "ok" "kubectx/kubens installed"
}
install_k9s() {
print_header "Kubernetes: k9s"
if is_installed k9s; then
print_status "skip" "k9s"
return 0
fi
local arch
arch=$(detect_arch)
local version
version=$(curl -sL https://api.github.com/repos/derailed/k9s/releases/latest | grep '"tag_name"' | sed -E 's/.*"([^"]+)".*/\1/')
print_status "install" "Downloading k9s..."
local tmp_dir
tmp_dir=$(mktemp -d)
wget -q "https://github.com/derailed/k9s/releases/download/${version}/k9s_Linux_${arch}.tar.gz" -O "${tmp_dir}/k9s.tar.gz"
tar -xzf "${tmp_dir}/k9s.tar.gz" -C "${tmp_dir}"
sudo mv "${tmp_dir}/k9s" /usr/local/bin/
rm -rf "${tmp_dir}"
print_status "ok" "k9s installed"
}
install_helm() {
print_header "Kubernetes: Helm"
if is_installed helm; then
print_status "skip" "Helm"
return 0
fi
print_status "install" "Installing Helm..."
curl -fsSL https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
print_status "ok" "Helm installed"
}
install_krew() {
print_header "Kubernetes: Krew"
if [[ -d "${HOME}/.krew" ]]; then
print_status "skip" "Krew"
return 0
fi
print_status "install" "Installing Krew..."
(
cd "$(mktemp -d)"
OS="$(uname | tr '[:upper:]' '[:lower:]')"
ARCH="$(uname -m | sed -e 's/x86_64/amd64/' -e 's/\(arm\)\(64\)\?.*/\1\2/' -e 's/aarch64$/arm64/')"
KREW="krew-${OS}_${ARCH}"
curl -fsSLO "https://github.com/kubernetes-sigs/krew/releases/latest/download/${KREW}.tar.gz"
tar zxf "${KREW}.tar.gz"
./"${KREW}" install krew
) &>/dev/null
print_status "ok" "Krew installed"
}
install_stow() {
print_header "Dotfiles (GNU Stow)"
if ! is_installed stow; then
print_status "error" "stow not installed - install apt packages first"
return 1
fi
print_status "install" "Symlinking dotfiles..."
cd "$DOTFILES_DIR"
# Stow will skip already-linked files; use --restow to handle updates
if stow --restow . 2>/dev/null; then
print_status "ok" "Dotfiles linked"
else
# If restow fails, try regular stow
if stow . 2>/dev/null; then
print_status "ok" "Dotfiles linked"
else
print_status "error" "Stow failed - check for conflicts"
return 1
fi
fi
}
install_mise_runtimes() {
print_header "Language Runtimes (mise)"
if ! is_installed mise; then
print_status "error" "mise not installed - install binary tools first"
return 1
fi
# Activate mise for this session
eval "$(~/.local/bin/mise activate bash 2>/dev/null || mise activate bash)"
print_status "install" "Installing global runtimes..."
if mise install --yes 2>/dev/null; then
print_status "ok" "Runtimes installed"
else
print_status "error" "Some runtimes failed to install"
fi
}
install_git_tool() {
print_header "Git-Tool"
if is_installed git-tool; then
print_status "skip" "git-tool"
return 0
fi
if ! is_installed mise; then
print_status "error" "mise not installed - install binary tools first"
return 1
fi
print_status "install" "Installing Linux keychain build dependencies..."
sudo apt-get update
if ! sudo apt-get install -y libdbus-1-dev libdbus-1-3 pkg-config; then
print_status "error" "git-tool dependencies failed to install"
return 1
fi
# Make mise shims available and ensure Rust/Cargo exists for the source build.
eval "$(~/.local/bin/mise activate bash 2>/dev/null || mise activate bash)"
if ! is_installed cargo; then
print_status "install" "Installing Rust toolchain for git-tool..."
if ! mise install rust --yes 2>/dev/null; then
print_status "error" "Rust toolchain failed to install"
return 1
fi
eval "$(~/.local/bin/mise activate bash 2>/dev/null || mise activate bash)"
fi
if ! is_installed cargo; then
print_status "error" "cargo not available after Rust installation"
return 1
fi
print_status "install" "Installing git-tool via Cargo..."
if cargo install --git https://github.com/SierraSoftworks/git-tool.git; then
print_status "ok" "git-tool installed"
else
print_status "error" "git-tool installation failed"
return 1
fi
}
# ═══════════════════════════════════════════════════════════════
# Main Menu
# ═══════════════════════════════════════════════════════════════
show_welcome() {
clear
echo -e "${CYAN}"
echo " ╔═══════════════════════════════════════════════════════╗"
echo " ║ Linux Dotfiles Bootstrap ║"
echo " ╚═══════════════════════════════════════════════════════╝"
echo -e "${NC}"
echo " This script will set up your development environment."
echo " It's safe to run multiple times - existing tools are skipped."
echo ""
}
show_menu() {
echo -e "${BOLD}What would you like to install?${NC}\n" >&2
echo " 1) Full installation (workstation: all tools + runtimes)" >&2
echo " 2) Core tools (dev server: shell, editor, k8s, cloud)" >&2
echo " 3) Server minimal (homelab: shell, editor, stow only)" >&2
echo " 4) Extras only (networking, build tools)" >&2
echo " 5) Custom (choose components)" >&2
echo " 6) Exit" >&2
echo "" >&2
read -r -p "Selection [3]: " choice
echo "${choice:-3}"
}
run_custom_menu() {
local components=()
echo -e "\n${BOLD}Select components to install:${NC}\n" >&2
confirm " Server APT packages (fish, tmux, neovim, etc.)?" && components+=("server_apt")
confirm " Core APT packages (build-essential, jq, python)?" && components+=("core_apt")
confirm " Extra APT packages (mosh, tcpdump, fastfetch)?" && components+=("extras_apt")
confirm " eza (modern ls)?" && components+=("eza")
confirm " GitHub CLI?" && components+=("gh")
confirm " oh-my-posh (prompt theme)?" && components+=("oh_my_posh")
confirm " zoxide (smart cd)?" && components+=("zoxide")
confirm " mise (runtime manager)?" && components+=("mise")
confirm " yq (YAML processor)?" && components+=("yq")
confirm " delta (git diff)?" && components+=("delta")
confirm " Symlink dotfiles (stow)?" && components+=("stow")
confirm " Language runtimes (mise install)?" && components+=("runtimes")
confirm " Git-Tool (repo workflow helper)?" && components+=("git_tool")
confirm " Kubernetes tools (kubectl, kubectx, k9s, helm)?" && components+=("k8s")
confirm " Krew (kubectl plugin manager)?" && components+=("krew")
echo "${components[@]}"
}
run_full() {
ensure_dirs
install_apt_packages "Core" "${CORE_APT_PACKAGES[@]}"
install_apt_packages "Extras" "${EXTRAS_APT_PACKAGES[@]}"
install_eza
install_gh_cli
install_oh_my_posh
install_zoxide
install_mise
install_yq
install_delta
install_stow
install_mise_runtimes
install_git_tool
install_kubectl
install_kubectx
install_k9s
install_helm
install_krew
}
run_core() {
ensure_dirs
install_apt_packages "Core" "${CORE_APT_PACKAGES[@]}"
install_eza
install_gh_cli
install_oh_my_posh
install_zoxide
install_mise
install_yq
install_delta
install_stow
install_git_tool
install_kubectl
install_kubectx
install_k9s
install_helm
install_krew
}
run_server() {
ensure_dirs
install_apt_packages "Server" "${SERVER_APT_PACKAGES[@]}"
install_eza
install_oh_my_posh
install_zoxide
install_mise
install_stow
}
run_extras() {
install_apt_packages "Extras" "${EXTRAS_APT_PACKAGES[@]}"
}
run_custom() {
IFS=' ' read -ra components <<<"$(run_custom_menu)"
ensure_dirs
for comp in "${components[@]}"; do
case $comp in
server_apt) install_apt_packages "Server" "${SERVER_APT_PACKAGES[@]}" ;;
core_apt) install_apt_packages "Core" "${CORE_APT_PACKAGES[@]}" ;;
extras_apt) install_apt_packages "Extras" "${EXTRAS_APT_PACKAGES[@]}" ;;
eza) install_eza ;;
gh) install_gh_cli ;;
oh_my_posh) install_oh_my_posh ;;
zoxide) install_zoxide ;;
mise) install_mise ;;
yq) install_yq ;;
delta) install_delta ;;
stow) install_stow ;;
runtimes) install_mise_runtimes ;;
git_tool) install_git_tool ;;
k8s)
install_kubectl
install_kubectx
install_k9s
install_helm
;;
krew) install_krew ;;
esac
done
}
# ═══════════════════════════════════════════════════════════════
# Main
# ═══════════════════════════════════════════════════════════════
main() {
# Validate platform
if [[ $(uname -s) == "Darwin" ]]; then
echo -e "${RED}Error: This script is for Linux only. Use install_macos.sh instead.${NC}"
exit 1
fi
# Bootstrap: clone dotfiles if this is a fresh machine
bootstrap_dotfiles
show_welcome
local choice
if [[ -n "$PRESET" ]]; then
# Preset mode
case $PRESET in
full) choice="1" ;;
core) choice="2" ;;
server) choice="3" ;;
extras) choice="4" ;;
*)
echo -e "${RED}Error: Unknown preset '$PRESET'. Use: full, core, server, extras${NC}"
exit 1
;;
esac
elif $AUTO_YES; then
choice="3" # Default to server in non-interactive mode
else
choice=$(show_menu)
fi
case $choice in
1) run_full ;;
2) run_core ;;
3) run_server ;;
4) run_extras ;;
5) run_custom ;;
6)
echo "Exiting."
exit 0
;;
*)
echo "Invalid option"
exit 1
;;
esac
print_header "Done!"
echo -e " ${GREEN}Your environment is ready.${NC}"
echo -e " Restart your terminal or run: ${CYAN}exec fish${NC}"
echo ""
}
main "$@"