-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·621 lines (545 loc) · 18.4 KB
/
install.sh
File metadata and controls
executable file
·621 lines (545 loc) · 18.4 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
#!/bin/bash
# Hyprland Dotfiles Installer with Gum
# Description: Interactive installer for Hyprland configuration
set -e
# Colors for output
RED='\033[0;31m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
GREEN='\033[0;32m'
ORANGE='\033[0;33m'
NC='\033[0m'
REPO_URL="https://github.com/Nurysso/Hecate.git"
# https://github.com/Nurysso/Hecate/blob/main/scripts/install/arch.sh
# https://raw.githubusercontent.com/Nurysso/Hecate/refs/heads/main/scripts/install/arch.sh
SCRIPT_BASE_URL="https://raw.githubusercontent.com/Nurysso/Hecate/main/scripts/install"
OS=""
PACKAGE_MANAGER=""
detect_os() {
if [ -f /etc/os-release ]; then
. /etc/os-release
case "$ID" in
arch | manjaro | endeavouros | cachyos)
OS="arch"
;;
fedora)
OS="fedora"
;;
ubuntu | debian | pop | linuxmint)
OS="ubuntu"
;;
*)
echo -e "${RED}Error: OS '$ID' is not supported!${NC}"
exit 1
;;
esac
else
echo -e "${RED}Error: Cannot detect OS!${NC}"
exit 1
fi
}
# Install gum based on detected OS
install_gum() {
echo -e "${YELLOW}Installing gum...${NC}"
echo ""
case "$OS" in
arch)
if command -v pacman &>/dev/null; then
sudo pacman -S --noconfirm gum
else
echo -e "${RED}pacman not found!${NC}"
return 1
fi
;;
fedora)
if command -v dnf &>/dev/null; then
sudo dnf install -y gum
else
echo -e "${RED}dnf not found!${NC}"
return 1
fi
;;
ubuntu)
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://repo.charm.sh/apt/gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/charm.gpg
echo "deb [signed-by=/etc/apt/keyrings/charm.gpg] https://repo.charm.sh/apt/ * *" | sudo tee /etc/apt/sources.list.d/charm.list
sudo apt update && sudo apt install -y gum
;;
*)
echo -e "${RED}Unsupported OS for automatic gum installation${NC}"
return 1
;;
esac
if command -v gum &>/dev/null; then
echo -e "${GREEN}✓ Gum installed successfully!${NC}"
return 0
else
echo -e "${RED}✗ Gum installation failed!${NC}"
return 1
fi
}
check_dependencies() {
local missing=()
# Check gum
if ! command -v gum &>/dev/null; then missing+=("gum"); fi
# Check figlet
if ! command -v figlet &>/dev/null; then missing+=("figlet"); fi
# Check tte
if ! command -v tte &>/dev/null; then missing+=("tte"); fi
if [ ${#missing[@]} -eq 0 ]; then
return 0
fi
echo -e "${RED}Missing dependencies: ${missing[*]}${NC}"
echo -e "${YELLOW}Required for this installer to work.${NC}"
echo ""
# Detect AUR helper
local aur_helper=""
if command -v paru &>/dev/null; then
aur_helper="paru"
elif command -v yay &>/dev/null; then
aur_helper="yay"
fi
# Prompt user to install
read -p "Would you like to install missing dependencies now? (y/n): " -n 1 -r
echo ""
if [[ $REPLY =~ ^[Yy]$ ]]; then
if install_dependencies "${missing[@]}"; then
echo ""
echo -e "${GREEN}All dependencies installed successfully!${NC}"
echo -e "${GREEN}Continuing with installation...${NC}"
echo ""
sleep 1
else
echo -e "${RED}Failed to install dependencies. Exiting.${NC}"
exit 1
fi
else
echo ""
echo -e "${YELLOW}Installation cancelled.${NC}"
echo -e "${BLUE}Install dependencies manually and run this script again.${NC}"
echo ""
echo "Manual installation instructions (Arch):"
echo -e "${GREEN} sudo pacman -S figlet gum${NC}"
echo -e "${GREEN} $aur_helper -S terminaltexteffects${NC}"
echo ""
echo "Other distros:"
case "$OS" in
fedora)
echo -e "${GREEN} sudo dnf install gum figlet${NC}"
echo -e "${GREEN} pip install terminaltexteffects${NC}"
;;
ubuntu)
echo -e "${GREEN} sudo apt install figlet${NC}"
echo -e "${GREEN} # Gum (Charm repo):${NC}"
echo -e "${GREEN} sudo mkdir -p /etc/apt/keyrings${NC}"
echo -e "${GREEN} curl -fsSL https://repo.charm.sh/apt/gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/charm.gpg${NC}"
echo -e "${GREEN} echo \"deb [signed-by=/etc/apt/keyrings/charm.gpg] https://repo.charm.sh/apt/ * *\" | sudo tee /etc/apt/sources.list.d/charm.list${NC}"
echo -e "${GREEN} sudo apt update && sudo apt install gum${NC}"
echo -e "${GREEN} pip install terminaltexteffects${NC}"
;;
*)
echo " Visit: https://github.com/charmbracelet/gum"
echo " sudo pacman -S figlet (or equivalent)"
echo " pip install terminaltexteffects"
;;
esac
echo ""
exit 1
fi
}
install_dependencies() {
local deps=("$@")
case "$OS" in
arch)
# Install official packages first
sudo pacman -S --noconfirm "${deps[@]}" 2>/dev/null || true
# Install tte via AUR helper if missing
if ! command -v tte &>/dev/null; then
local aur_helper=""
if command -v paru &>/dev/null; then
aur_helper="paru"
elif command -v yay &>/dev/null; then
aur_helper="yay"
else
echo -e "${RED}No AUR helper (paru/yay) found. Install paru/yay first.${NC}"
return 1
fi
echo "Installing terminaltexteffects via $aur_helper..."
$aur_helper -S --noconfirm terminaltexteffects || {
echo -e "${RED}Failed to install terminaltexteffects via AUR.${NC}"
echo -e "${YELLOW}Trying pip install as fallback...${NC}"
pip install terminaltexteffects || return 1
}
fi
;;
*)
# Fallback for other distros (pip for tte)
pip install terminaltexteffects || return 1
;;
esac
return 0
}
# Check if tte is installed
check_tte() {
if ! command -v tte &>/dev/null; then
gum style --foreground 220 "⚠ TTE (Terminal Text Effects) not found"
gum style --foreground 220 "Install with: pip install terminaltexteffects"
echo ""
if gum confirm "Continue without TTE effects?"; then
return 0
else
exit 1
fi
fi
}
# Use tte if available, otherwise fallback to echo
fancy_echo() {
local text="$1"
local effect="${2:-slide}"
if command -v tte &>/dev/null; then
echo "$text" | tte "$effect" --movement-speed 5 2>/dev/null || echo "$text"
else
echo "$text"
fi
}
# Check OS and display appropriate messages
check_OS() {
case "$OS" in
arch)
fancy_echo "✓ Detected OS: Arch Linux" "slide"
;;
fedora)
gum style --foreground 220 --bold "⚠️ Warning: Script has not been tested on Fedora!"
gum style --foreground 220 "Proceed at your own risk or follow the Fedora guide if available at:"
gum style --foreground 220 "https://github.com/Nurysso/Hecate/tree/main/documentation/install-fedora.md"
if ! gum confirm "Continue with Fedora installation?"; then
exit 1
fi
;;
ubuntu)
gum style --foreground 220 --bold "⚠️ Warning: Ubuntu/Debian-based OS detected!"
gum style --foreground 220 "Hecate installer support for Ubuntu is experimental."
gum style --foreground 220 "Manual installation instructions:"
gum style --foreground 220 "https://github.com/Nurysso/Hecate/tree/main/documentation/install-ubuntu.md"
if ! gum confirm "Continue with Ubuntu installation?"; then
exit 1
fi
;;
esac
}
# Download and execute OS-specific installation script
run_os_script() {
local script_name="${OS}.sh"
local script_url="${SCRIPT_BASE_URL}/${script_name}"
local temp_script="/tmp/hecate_install_${OS}.sh"
gum style --foreground 82 "Downloading ${OS} installation script..."
echo ""
if curl -fsSL "$script_url" -o "$temp_script"; then
fancy_echo "✓ Script downloaded successfully" "slide"
chmod +x "$temp_script"
echo ""
gum style --foreground 220 "Executing ${OS} installation script..."
echo ""
# Execute the script and capture exit code
# Check if script succeeded before continuing
if bash "$temp_script"; then
fancy_echo "✓ Installation script completed successfully" "beams"
rm -f "$temp_script"
return 0
else
local exit_code=$?
# Clean up temp script
rm -f "$temp_script"
# Check if it was a user cancellation (exit 1) or actual error
if [ $exit_code -eq 1 ]; then
gum style --foreground 220 "Installation cancelled by user"
else
gum style --foreground 196 "✗ Installation script failed with exit code: $exit_code"
fi
# Exit the main installer too
exit $exit_code
fi
else
gum style --foreground 196 "✗ Failed to download installation script from:"
gum style --foreground 196 " $script_url"
echo ""
gum style --foreground 220 "Please check:"
gum style --foreground 220 " 1. Your internet connection"
gum style --foreground 220 " 2. The script exists in the repository"
gum style --foreground 220 " 3. The URL is correct"
exit 1
fi
}
# Clone dotfiles
clone_dotfiles() {
gum style --border double --padding "1 2" --border-foreground 212 "Cloning Hecate Dotfiles"
if [ -d "$HECATEDIR" ]; then
if gum confirm "Hecate directory already exists. Remove and re-clone?"; then
rm -rf "$HECATEDIR"
else
gum style --foreground 220 "Using existing directory..."
return
fi
fi
gum style --foreground 220 "Cloning repository..."
if ! git clone --depth 1 "$REPO_URL" "$HECATEDIR"; then
gum style --foreground 196 "✗ Error cloning repository!"
gum style --foreground 196 "Check your internet connection and try again."
exit 1
fi
# Verify critical directories exist
if [ ! -d "$HECATEDIR/config" ]; then
gum style --foreground 196 "✗ Error: Config directory not found in cloned repo!"
exit 1
fi
fancy_echo "✓ Dotfiles cloned successfully!" "beams"
}
# Install shell scripts to ~/.local/bin
install_shell_scripts() {
gum style --border double --padding "1 2" --border-foreground 212 "Installing Shell Scripts"
mkdir -p "$HOME/.local/bin"
local scripts_dir="$HECATEDIR/config/local-bin"
if [ ! -d "$scripts_dir" ]; then
gum style --foreground 220 "⚠ Scripts directory not found at $scripts_dir"
return
fi
# Install hecate.sh
if [ -f "$scripts_dir/hecate.sh" ]; then
fancy_echo "Installing hecate script..." "slide"
cp "$scripts_dir/hecate.sh" "$HOME/.local/bin/hecate"
chmod +x "$HOME/.local/bin/hecate"
fancy_echo "✓ hecate installed to ~/.local/bin/hecate" "slide"
else
gum style --foreground 220 "⚠ hecate.sh not found at $scripts_dir/hecate.sh"
fi
# Install freya.sh
if [ -f "$scripts_dir/file_convert.sh" ]; then
fancy_echo "Installing freya script..." "slide"
cp "$scripts_dir/file_convert.sh" "$HOME/.local/bin/file_convert"
chmod +x "$HOME/.local/bin/file_convert"
fancy_echo "✓ freya installed to ~/.local/bin/file_convert" "slide"
else
gum style --foreground 220 "⚠ freya.sh not found at $scripts_dir/file_convert.sh"
fi
echo ""
gum style --foreground 82 "✓ Shell scripts installed successfully!"
}
# Move configs from cloned repo to ~/.config
move_config() {
gum style --border double --padding "1 2" --border-foreground 212 "Installing Configuration Files"
if [ ! -d "$HECATEDIR/config" ]; then
gum style --foreground 196 "Error: Config directory not found at $HECATEDIR/config"
exit 1
fi
mkdir -p "$CONFIGDIR"
mkdir -p "$HOME/.local/bin"
# Copy all config directories except shell rc files
for item in "$HECATEDIR/config"/*; do
if [ -d "$item" ]; then
local item_name=$(basename "$item")
# Skip local-bin directory (handled separately)
if [ "$item_name" = "local-bin" ]; then
continue
fi
# Handle terminal configs - only install selected terminal
case "$item_name" in
alacritty|foot|ghostty|kitty)
if [ "$item_name" = "$USER_TERMINAL" ]; then
fancy_echo "Installing $item_name config..." "slide"
cp -rT "$item" "$CONFIGDIR/$item_name"
fi
;;
*)
# Install all other configs
fancy_echo "Installing $item_name..." "slide"
cp -rT "$item" "$CONFIGDIR/$item_name"
;;
esac
fi
done
# Handle shell rc files
if [ -f "$HECATEDIR/config/zshrc" ]; then
fancy_echo "Installing .zshrc..." "slide"
cp "$HECATEDIR/config/zshrc" "$HOME/.zshrc"
fancy_echo "✓ ZSH config installed" "slide"
else
gum style --foreground 220 "⚠ zshrc not found in config directory"
fi
if [ -f "$HECATEDIR/config/bashrc" ]; then
fancy_echo "Installing .bashrc..." "slide"
cp "$HECATEDIR/config/bashrc" "$HOME/.bashrc"
fancy_echo "✓ BASH config installed" "slide"
else
gum style --foreground 220 "⚠ bashrc not found in config directory"
fi
# Install shell scripts
install_shell_scripts
# Install apps from apps directory
install_app "Pulse" "$HECATEAPPSDIR/Pulse/build/bin/Pulse"
install_app "Hecate-Settings" "$HECATEAPPSDIR/Hecate-Help/build/bin/Hecate-Settings"
install_app "Aoiler" "$HECATEAPPSDIR/Aoiler/build/bin/Aoiler"
echo ""
fancy_echo "✓ Configuration files installed successfully!" "beams"
}
# Helper function to install apps
install_app() {
local app_name="$1"
local app_path="$2"
local app_display="${3:-$app_name}"
if [ -f "$app_path" ]; then
fancy_echo "Installing $app_display..." "slide"
cp "$app_path" "$HOME/.local/bin/$app_name"
chmod +x "$HOME/.local/bin/$app_name"
fancy_echo "✓ $app_display installed to ~/.local/bin/$app_name" "slide"
else
gum style --foreground 220 "⚠ $app_display binary not found at $app_path"
fi
}
backup_config() {
gum style --border double --padding "1 2" --border-foreground 212 "Backing Up Existing Configs"
local timestamp=$(date +%Y%m%d_%H%M%S)
local backup_dir="$HOME/.cache/hecate-backup/hecate-$timestamp"
# List of config directories to check
local config_dirs=(
"alacritty" "cava" "fastfetch" "foot" "gtk-3.0" "hecate" "kitty"
"quickshell" "starship" "wallust" "waypaper" "zsh" "bash" "fish"
"ghostty" "gtk-4.0" "hypr" "matugen" "rofi" "swaync" "waybar" "wlogout"
)
# Check for shell rc files separately
local shell_files=()
[ -f "$HOME/.zshrc" ] && shell_files+=(".zshrc")
[ -f "$HOME/.bashrc" ] && shell_files+=(".bashrc")
local backed_up=false
# Backup config directories
for dir in "${config_dirs[@]}"; do
if [ -d "$HOME/.config/$dir" ]; then
if [ "$backed_up" = false ]; then
mkdir -p "$backup_dir/config"
backed_up=true
fi
fancy_echo "Backing up: $dir" "slide"
cp -r "$HOME/.config/$dir" "$backup_dir/config/"
fi
done
# Backup shell rc files
for file in "${shell_files[@]}"; do
if [ "$backed_up" = false ]; then
mkdir -p "$backup_dir"
backed_up=true
fi
fancy_echo "Backing up: $file" "slide"
cp "$HOME/$file" "$backup_dir/"
done
if [ "$backed_up" = true ]; then
echo ""
fancy_echo "✓ Backup created at: $backup_dir" "beams"
echo "$backup_dir" > "$HOME/.cache/hecate_last_backup.txt"
else
gum style --foreground 220 "No existing configs found to backup"
fi
}
code_ext() {
# Core essentials
code --install-extension golang.go
code --install-extension rust-lang.rust-analyzer
code --install-extension esbenp.prettier-vscode
code --install-extension bradlc.vscode-tailwindcss
code --install-extension dsznajder.es7-react-js-snippets
code --install-extension usernamehm.errorlens
code --install-extension eamodio.gitlens
code --install-extension dbaeumer.vscode-eslint
code --install-extension formulahendry.auto-rename-tag
code --install-extension catppuccin.catppuccin-vsc
code --install-extension catppuccin.catppuccin-vsc-icons
}
# Main function
main() {
# Parse arguments inline
case "${1:-}" in
--help | -h)
clear
echo -e "${YELLOW}Prerequisites:${NC}"
echo " • gum - Interactive CLI tool"
echo " (Will be installed automatically if missing)"
echo ""
echo " • tte - Terminal text effects"
echo " Install: pip install terminaltexteffects"
echo ""
echo " • paru (recommended) - AUR helper (Arch only)"
echo " Install: https://github.com/Morganamilo/paru#installation"
echo ""
echo -e "${YELLOW}Usage:${NC}"
echo " ./install.sh Run the full installer"
echo " ./install.sh --no-deps Skip dependency installation"
echo " ./install.sh --help Show this message"
echo " ./install.sh --dry-run Simulate installation"
echo ""
echo -e "${YELLOW}Options:${NC}"
echo " --no-deps Skip OS-specific dependency installation"
echo " Only clones repo, backs up configs, and installs dotfiles"
echo ""
echo "Supported distributions: Arch, Fedora, Ubuntu/Debian(maybe in future for now run with --no-deps)"
exit 0
;;
--dry-run)
echo -e "${BLUE}The \"I want to feel productive without doing anything mode\"${NC}"
echo -e "${YELLOW}Simulating installation...${NC}"
sleep 1
echo ""
echo -e "${GREEN}✓ System check: Passed (probably)${NC}"
echo -e "${GREEN}✓ Packages: Would install ~47 packages${NC}"
echo -e "${GREEN}✓ Configs: Would copy lots of dotfiles${NC}"
echo ""
echo -e "${YELLOW}Congratulations! You've successfully done... nothing.${NC}"
echo -e "${ORANGE}Run without --dry-run when you're ready to actually install.${NC}"
echo ""
echo -e "${RED}Pro tip: Dry runs don't make your setup any cooler.${NC}"
exit 0
;;
--no-deps)
# These steps run for both full install and --no-deps
backup_config
echo ""
clone_dotfiles
echo ""
move_config
echo ""
;;
-*)
echo -e "${RED}Unknown option: $1${NC}"
echo -e "${BLUE}Try: ./install.sh --help${NC}"
exit 1
;;
esac
# Detect OS first (needed before gum check)
detect_os
# Check deps install gum if needed
check_dependencies
# Check for tte
check_tte
# Now we can use gum for pretty output
clear
if command -v tte &>/dev/null; then
figlet -f slant "Hecate Dotfiles Installer" | tte laseretch --etch-speed 10
echo 'Preparing to install Hyprland configuration...' | tte slide --movement-speed 0.5
else
gum style \
--foreground 82 \
--border-foreground 82 \
--border double \
--align center \
--width 70 \
--margin "1 2" \
--padding "2 4" \
'Hecate Dotfiles Installer' \
'' \
'Preparing to install Hyprland configuration...'
fi
echo ""
check_OS
echo ""
run_os_script
code_ext
}
# Run main function with arguments
main "$@"