Repository navigation
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·134 lines (107 loc) · 3.67 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·134 lines (107 loc) · 3.67 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
#!/bin/bash
# Exit on error
set -e
DOTFILES_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# Inside DevPod / containers use the lean installer (stow + nvim/zsh)
if [[ -f /.dockerenv || -f /run/.containerenv || -n "${DEVCONTAINER:-}" || -n "${REMOTE_CONTAINERS:-}" ]]; then
echo "→ Container detected — running install-devpod.sh"
exec "$DOTFILES_DIR/install-devpod.sh" "$@"
fi
if [[ "$OSTYPE" != "linux-gnu"* ]]; then
echo "❌ Error: This setup is currently optimized for Linux (Ubuntu/Debian) only."
echo "Detected OSTYPE: $OSTYPE"
exit 1
fi
# --- TOOL FUNCTIONS ---
setup_alacritty() {
echo "🖥️ Setting up Alacritty..."
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
sudo apt install -y alacritty
fi
rm -rf ~/.config/alacritty
stow alacritty
# Rewrite stowed config to this binary's schema (YAML→TOML, shell→terminal.shell, …)
if alacritty migrate --help >/dev/null 2>&1; then
echo "↪ Migrating Alacritty config ($(alacritty -V 2>/dev/null || echo unknown))…"
alacritty migrate --skip-imports || alacritty migrate || \
echo "⚠ alacritty migrate failed — config left as-is"
fi
}
setup_zsh() {
echo "🐚 Setting up Zsh & Catppuccin theme..."
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
sudo apt install -y zsh zsh-syntax-highlighting zsh-autosuggestions shfmt
fi
# Clean and stow
rm -f ~/.zshrc
rm -rf ~/.zsh
mkdir -p "$HOME/.zsh"
stow zsh
# Theme logic
if [ ! -d "/tmp/catppuccin-zsh" ]; then
git clone --depth 1 https://github.com/catppuccin/zsh-syntax-highlighting.git /tmp/catppuccin-zsh
fi
cp /tmp/catppuccin-zsh/themes/catppuccin_macchiato-zsh-syntax-highlighting.zsh "$HOME/.zsh/"
# Shell switch
if [ "$SHELL" != "$(which zsh)" ]; then
echo "Changing default shell to Zsh..."
chsh -s "$(which zsh)"
fi
}
setup_font() {
FONT_NAME="JetBrainsMono"
NERD_FONT_NAME="JetBrainsMono"
FONTS_DIR="$HOME/.local/share/fonts"
echo "Creating font directory at $FONTS_DIR..."
mkdir -p "$FONTS_DIR"
echo "Downloading $FONT_NAME Nerd Font from official Nerd Fonts release..."
wget -q --show-progress \
"https://github.com/ryanoasis/nerd-fonts/releases/latest/download/${NERD_FONT_NAME}.zip" \
-O "${FONT_NAME}.zip"
echo "Extracting and installing..."
unzip -o "${FONT_NAME}.zip" -d "$FONTS_DIR/${FONT_NAME}"
echo "Cleaning up..."
rm -f "${FONT_NAME}.zip"
echo "Updating font cache..."
fc-cache -fv "$FONTS_DIR"
echo "---------------------------------------------------"
echo "Done! Set your terminal font to 'JetBrainsMono Nerd Font'."
echo "---------------------------------------------------"
}
setup_tmux() {
echo "🪟 Setting up Tmux & TPM..."
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
sudo apt install -y tmux procps
fi
rm -f ~/.tmux.conf
stow tmux
TPM_DIR="$HOME/.config/tmux/plugins/tpm"
if [ ! -d "$TPM_DIR" ]; then
git clone https://github.com/tmux-plugins/tpm "$TPM_DIR"
"$TPM_DIR/bin/install_plugins"
fi
}
setup_neovim() {
echo "🌙 Setting up Neovim..."
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
if ! command -v nvim &>/dev/null; then
sudo snap install nvim --classic
fi
fi
rm -rf ~/.config/nvim
stow nvim
}
# --- MAIN EXECUTION ---
echo "🚀 Starting Dotfiles Bootstrap..."
# 1. Essential System Tools
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
sudo apt update && sudo apt install -y stow curl git python3-venv
fi
# 2. Execute Tool Setups
cd "$DOTFILES_DIR"
setup_alacritty
setup_zsh
setup_font
setup_tmux
setup_neovim
echo "✅ Setup Complete!"