-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall
More file actions
executable file
·204 lines (167 loc) · 6.42 KB
/
install
File metadata and controls
executable file
·204 lines (167 loc) · 6.42 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
#!/usr/bin/env bash
set -e
BASEDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "${BASEDIR}"
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
info() { echo -e "${BLUE}==>${NC} $1"; }
success() { echo -e "${GREEN}==>${NC} $1"; }
warn() { echo -e "${YELLOW}==>${NC} $1"; }
error() { echo -e "${RED}==>${NC} $1"; exit 1; }
# Detect OS/Distro
detect_distro() {
if [[ -f /etc/os-release ]]; then
. /etc/os-release
case "$ID" in
fedora) echo "fedora" ;;
arch|endeavouros|manjaro) echo "arch" ;;
ubuntu|debian|pop|linuxmint) echo "ubuntu" ;;
*) echo "unknown" ;;
esac
else
echo "unknown"
fi
}
# Install packages based on distro
install_packages() {
local distro="$1"
info "Installing packages for ${distro}..."
case "$distro" in
fedora)
sudo dnf copr enable -y atim/starship 2>/dev/null || true
sudo dnf copr enable -y dejan/lazygit 2>/dev/null || true
sudo dnf install -y curl zsh neovim golang python ruby fastfetch ripgrep fzf starship nodejs npm kitty lazygit direnv git
# Rust
if ! command -v rustup &> /dev/null; then
info "Installing Rust..."
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
fi
;;
arch)
sudo pacman -Sy --noconfirm kitty kitty-terminfo zsh neovim go python ruby neofetch ripgrep fzf noto-fonts-emoji powerline-fonts git curl
# Install yay if not present
if ! command -v yay &> /dev/null; then
info "Installing yay..."
git clone https://aur.archlinux.org/yay.git /tmp/yay
(cd /tmp/yay && makepkg -si --noconfirm)
rm -rf /tmp/yay
fi
yay -S --noconfirm nvm ttf-fira-code ttf-fira-sans ttf-fira-mono ttf-fira-go 2>/dev/null || true
;;
ubuntu)
sudo add-apt-repository -y ppa:neovim-ppa/unstable 2>/dev/null || true
sudo apt update
sudo apt install -y curl zsh neovim golang python3 python3-pip ruby neofetch ripgrep fzf direnv unzip git
sudo apt install -y git-core zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libxml2-dev libxslt1-dev libcurl4-openssl-dev libffi-dev 2>/dev/null || true
# Rust
if ! command -v rustup &> /dev/null; then
info "Installing Rust..."
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
fi
;;
*)
warn "Unknown distro - skipping package installation"
warn "You may need to manually install: zsh, neovim, git, curl, ripgrep, fzf"
;;
esac
success "Packages installed!"
}
# Run dotbot for symlinks
run_dotbot() {
info "Setting up symlinks with dotbot..."
CONFIG="install.conf.yaml"
DOTBOT_DIR="dotbot"
DOTBOT_BIN="bin/dotbot"
git -C "${DOTBOT_DIR}" submodule sync --quiet --recursive
git submodule update --init --recursive "${DOTBOT_DIR}"
"${BASEDIR}/${DOTBOT_DIR}/${DOTBOT_BIN}" -d "${BASEDIR}" -c "${CONFIG}" "${@}"
success "Symlinks created!"
}
# Install zsh plugins (no oh-my-zsh needed)
install_zsh_plugins() {
info "Installing zsh plugins..."
local plugin_dir="$HOME/.zsh/plugins"
mkdir -p "$plugin_dir"
# zsh-syntax-highlighting
if [[ ! -d "$plugin_dir/zsh-syntax-highlighting" ]]; then
git clone --depth=1 https://github.com/zsh-users/zsh-syntax-highlighting.git "$plugin_dir/zsh-syntax-highlighting"
else
warn "zsh-syntax-highlighting already installed"
fi
# zsh-autosuggestions
if [[ ! -d "$plugin_dir/zsh-autosuggestions" ]]; then
git clone --depth=1 https://github.com/zsh-users/zsh-autosuggestions "$plugin_dir/zsh-autosuggestions"
else
warn "zsh-autosuggestions already installed"
fi
success "Zsh plugins installed!"
}
# Install fonts
install_fonts() {
local distro="$1"
info "Installing fonts..."
# Operator Mono
if [[ -d "$BASEDIR/Operator-Mono" ]]; then
"$BASEDIR/Operator-Mono/install.sh"
fi
# Other custom fonts
if [[ -d "$BASEDIR/fonts/Dank" ]]; then
sudo mkdir -p /usr/share/fonts/dank
sudo install -m 644 "$BASEDIR/fonts/Dank"/* /usr/share/fonts/dank/ 2>/dev/null || true
fi
if [[ -d "$BASEDIR/fonts/icomoon" ]]; then
sudo mkdir -p /usr/share/fonts/icomoon
sudo install -m 644 "$BASEDIR/fonts/icomoon"/* /usr/share/fonts/icomoon/ 2>/dev/null || true
fi
# Refresh font cache
sudo fc-cache -f
success "Fonts installed!"
}
# Change default shell to zsh
set_zsh_shell() {
if [[ "$SHELL" == *"zsh"* ]]; then
warn "Already using zsh as default shell"
return
fi
info "Setting zsh as default shell..."
local zsh_path
zsh_path=$(which zsh)
# Add zsh to /etc/shells if not present
if ! grep -q "$zsh_path" /etc/shells 2>/dev/null; then
echo "$zsh_path" | sudo tee -a /etc/shells
fi
chsh -s "$zsh_path"
success "Default shell changed to zsh!"
}
# Main installation flow
main() {
echo ""
echo -e "${GREEN}╔═══════════════════════════════════════╗${NC}"
echo -e "${GREEN}║ Dotfiles Roadwarrior Installer ║${NC}"
echo -e "${GREEN}╚═══════════════════════════════════════╝${NC}"
echo ""
local distro
distro=$(detect_distro)
info "Detected: ${distro}"
# Step 1: Install packages
install_packages "$distro"
# Step 2: Dotbot symlinks
run_dotbot "$@"
# Step 3: Zsh plugins
install_zsh_plugins
# Step 4: Install fonts
install_fonts "$distro"
# Step 5: Set zsh as default shell
set_zsh_shell
echo ""
echo -e "${GREEN}╔═══════════════════════════════════════╗${NC}"
echo -e "${GREEN}║ Setup Complete! ║${NC}"
echo -e "${GREEN}╚═══════════════════════════════════════╝${NC}"
echo ""
info "Log out and back in (or run 'zsh') to start using your new shell!"
}
main "$@"