This repository was archived by the owner on Oct 16, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathinstaller.sh
More file actions
879 lines (774 loc) · 43.8 KB
/
Copy pathinstaller.sh
File metadata and controls
879 lines (774 loc) · 43.8 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
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
#!/bin/bash
# ██╗ ██╗██╗ ██╗██████╗ ██████╗ ██╗ ██╗ ██╗███╗ ██╗ █████╗
# ██║ ██║╚██╗ ██╔╝██╔══██╗██╔══██╗██║ ██║ ██║████╗ ██║██╔══██╗
# ███████║ ╚████╔╝ ██████╔╝██████╔╝██║ ██║ ██║██╔██╗ ██║███████║
# ██╔══██║ ╚██╔╝ ██╔═══╝ ██╔══██╗██║ ██║ ██║██║╚██╗██║██╔══██║
# ██║ ██║ ██║ ██║ ██║ ██║███████╗╚██████╔╝██║ ╚████║██║ ██║
# ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝╚══════╝ ╚═════╝ ╚═╝ ╚═══╝╚═╝ ╚═╝
#
# HYPRLUNA Installer for Arch Linux
# Based on the official documentation: https://hyprluna.org/docs/main-dots/installation
# --- Color Scheme (Gruvbox Dark Style, Medium Contrast) ---
C_GB_BG0_HARD="#1d2021"
C_GB_BG0="#282828"
C_GB_FG1="#ebdbb2"
C_GB_FG0="#fbf1c7"
C_GB_RED="#cc241d"
C_GB_GREEN="#98971a"
C_GB_YELLOW="#d79921"
C_GB_BLUE="#458588"
C_GB_PURPLE="#b16286"
C_GB_AQUA="#689d6a"
C_GB_GRAY="#a89984"
C_GB_ORANGE="#d65d0e"
# Mapping to script roles
C_ACCENT_PRIMARY="$C_GB_PURPLE"
C_ACCENT_SECONDARY="$C_GB_AQUA"
C_TEXT_MUTED="$C_GB_GRAY"
C_TEXT_ON_ACCENT="$C_GB_FG0"
C_WARN_TEXT="$C_GB_YELLOW"
C_INFO_TEXT="$C_GB_BLUE"
C_SUCCESS_TEXT="$C_GB_GREEN"
C_ERROR_TEXT="$C_GB_RED"
C_BORDER_COLOR="$C_GB_GRAY"
C_ANSI_PRIMARY_FG="\033[38;5;133m"
C_ANSI_SECONDARY_FG="\033[38;5;72m"
C_ANSI_TEXT_MUTED="\033[38;5;245m"
C_ANSI_TEXT_BRIGHT="\033[38;5;223m"
C_ANSI_YELLOW="\033[1;38;5;178m"
C_ANSI_GREEN="\033[38;5;106m"
C_ANSI_UNDERLINE="\033[4m"
C_ANSI_BOLD="\033[1m"
C_ANSI_RESET="\033[0m"
# --- Argument Parsing ---
BRANCH=""
REPO_URL="https://github.com/Lunaris-Project/HyprLuna.git"
show_help() {
echo "HYPRLUNA Installer for Arch Linux"
echo ""
echo "Usage: $0 [OPTIONS]"
echo ""
echo "Options:"
echo " -t Install from testers branch (development/testing version)"
echo " -m Install from main branch (stable version)"
echo " -h Show this help message"
echo ""
echo "Examples:"
echo " $0 -m # Install stable version from main branch"
echo " $0 -t # Install testing version from testers branch"
echo ""
echo "Note: You must specify either -t or -m flag to proceed with installation."
exit 0
}
# Parse command line arguments
while getopts "tmh" opt; do
case $opt in
t)
BRANCH="testers"
;;
m)
BRANCH="main"
;;
h)
show_help
;;
\?)
echo "Invalid option: -$OPTARG" >&2
echo "Use -h for help."
exit 1
;;
esac
done
# Check if branch was specified
if [ -z "$BRANCH" ]; then
echo "Error: You must specify a branch to install from."
echo ""
show_help
fi
# --- Configuration and Variables ---
HYPRLUNA_INSTALL_DIR="$HOME/HyprLuna"
PARU_CLONE_DIR="/tmp/paru_install_$$"
# AGSV1_CLONE_DIR="/tmp/agsv1_install_$$"
BACKUP_DIR="$HOME/HyprLuna-User-Bak_$(date +%Y%m%d_%H%M%S)"
PARU_LOG_FILE=$(mktemp /tmp/hyprluna_paru_log.XXXXXX)
# Packages to install with pacman (basic prerequisites)
PACMAN_PREREQ_PACKAGES=(
"base-devel" "git" "archlinux-keyring"
)
# Packages to install with paru
PARU_PACKAGES=(
"hyprland" "axel" "bc" "coreutils" "cliphist" "cmake" "curl" "rofi-wayland" "rofi-emoji" "rofi-calc" "rsync" "cpio" "wget" "ripgrep" "jq" "npm" "meson"
"typescript" "gjs" "xdg-user-dirs" "brightnessctl" "ddcutil" "pavucontrol" "wireplumber" "libdbusmenu-gtk3" "kitty"
"playerctl" "swww" "gobject-introspection" "glib2-devel" "gvfs" "glib2" "glibc" "gtk3" "gtk-layer-shell" "libpulse"
"pam" "gnome-bluetooth-3.0" "gammastep" "libsoup3" "libnotify" "networkmanager" "power-profiles-daemon" "upower"
"adw-gtk-theme-git" "qt5ct" "qt5-wayland" "fontconfig" "ttf-readex-pro" "ttf-jetbrains-mono-nerd"
"ttf-material-symbols-variable-git" "apple-fonts" "ttf-space-mono-nerd" "ttf-rubik-vf" "bibata-cursor-theme-bin"
"bibata-rainbow-cursor-theme" "bibata-extra-cursor-theme" "bibata-cursor-translucent" "ttf-gabarito-git" "fish"
"foot" "starship" "polkit-gnome" "gnome-keyring" "gnome-control-center" "blueberry" "webp-pixbuf-loader"
"gtksourceview3" "yad" "ydotool" "xdg-user-dirs-gtk" "tinyxml2" "gtkmm3" "gtksourceviewmm" "cairomm"
"xdg-desktop-portal" "xdg-desktop-portal-gtk" "xdg-desktop-portal-hyprland" "gradience" "python-libsass"
"python-pywalfox" "matugen-bin" "python-build" "python-pillow" "python-pywal" "python-setuptools-scm"
"python-wheel" "swappy" "wf-recorder" "grim" "tesseract" "tesseract-data-eng" "slurp" "dart-sass"
"python-pywayland" "python-psutil" "hypridle" "hyprutils" "hyprlock" "wlogout" "wl-clipboard" "hyprpicker"
"ghostty" "ttf-noto-sans-cjk-vf" "noto-fonts-emoji" "cava" "metar" "gowall" "go" "overskride"
"visual-studio-code-bin" "mpv" "github-desktop-bin" "sddm" "python-yapsy" "yt-dlp" "nm-connection-editor" "fastfetch" "firefox"
)
# --- Helper Functions ---
command_exists() {
command -v "$1" >/dev/null 2>&1
}
display_logo() {
gum style \
--foreground "$C_ACCENT_PRIMARY" --border double --border-foreground "$C_BORDER_COLOR" \
--align center --width 80 --margin "1 0" --padding "1" \
"██╗ ██╗██╗ ██╗██████╗ ██████╗ ██╗ ██╗ ██╗███╗ ██╗ █████╗ " \
"██║ ██║╚██╗ ██╔╝██╔══██╗██╔══██╗██║ ██║ ██║████╗ ██║██╔══██╗" \
"███████║ ╚████╔╝ ██████╔╝██████╔╝██║ ██║ ██║██╔██╗ ██║███████║" \
"██╔══██║ ╚██╔╝ ██╔═══╝ ██╔══██╗██║ ██║ ██║██║╚██╗██║██╔══██║" \
"██║ ██║ ██║ ██║ ██║ ██║███████╗╚██████╔╝██║ ╚████║██║ ██║" \
"╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝╚══════╝ ╚═════╝ ╚═╝ ╚═══╝╚═╝ ╚═╝" \
"" \
"$(gum style --foreground "$C_ACCENT_SECONDARY" 'HYPRLUNA Installer for Arch Linux')"
}
show_section_progress() {
local current=$1
local total=$2
local section_name=$3
local width=50
local progress_char="#"
local progress=$((current * 100 / total))
local filled_count=$((progress * width / 100))
local bar_str=""
if [ "$filled_count" -gt 0 ]; then
for i in $(seq 1 "$filled_count"); do
if ((i % 2 != 0)); then
bar_str+="${C_ANSI_PRIMARY_FG}${progress_char}"
else
bar_str+="${C_ANSI_SECONDARY_FG}${progress_char}"
fi
done
fi
bar_str+="${C_ANSI_RESET}"
local unfilled_count=$((width - filled_count))
if [ "$unfilled_count" -lt 0 ]; then unfilled_count=0; fi
local unfilled_spaces=""
if [ "$unfilled_count" -gt 0 ]; then
unfilled_spaces=$(printf "%${unfilled_count}s" "")
fi
printf "\n"
gum style --foreground "$C_ACCENT_PRIMARY" --bold "OVERALL INSTALLATION PROGRESS"
printf "%b%s %d%% - %s\n" "[${bar_str}" "${unfilled_spaces}]" "$progress" "$section_name"
printf "\n"
}
generate_simple_progress_bar() {
local current_val=$1
local total_val=$2
local bar_width=${3:-25}
local char="#"
local progress_val=$((current_val * 100 / total_val))
local filled_units=$((progress_val * bar_width / 100))
local bar_str=""
if [ "$filled_units" -gt 0 ]; then
for i_fill in $(seq 1 "$filled_units"); do
if ((i_fill % 2 != 0)); then
bar_str+="${C_ANSI_PRIMARY_FG}${char}"
else
bar_str+="${C_ANSI_SECONDARY_FG}${char}"
fi
done
bar_str+="${C_ANSI_RESET}"
fi
echo "$bar_str"
}
run_with_spinner() {
local title="$1"
shift
local command_to_run="$@"
local temp_log
temp_log=$(mktemp)
gum spin --spinner dot --title "$title" \
--title.foreground "$C_ACCENT_SECONDARY" --spinner.foreground "$C_ACCENT_PRIMARY" \
-- bash -c "$command_to_run" >"$temp_log" 2>&1
local ret_code=$?
if [ $ret_code -ne 0 ]; then
gum style --padding "0 1" --foreground "$C_WARN_TEXT" "Command failed with code $ret_code:"
gum style --padding "0 2" --foreground "$C_TEXT_MUTED" "$(tail -n 5 "$temp_log")"
fi
rm -f "$temp_log"
return $ret_code
}
gum_confirm() {
local prompt_message="$1"
gum confirm "$prompt_message" \
--affirmative "Yes" --negative "No" \
--prompt.foreground "$C_ACCENT_SECONDARY" \
--selected.background "$C_ACCENT_PRIMARY" --selected.foreground "$C_TEXT_ON_ACCENT" \
--unselected.foreground "$C_TEXT_MUTED"
}
# --- Initial GUM Check ---
if ! command_exists gum; then
echo "---------------------------------------------------------------------"
echo " HYPRLUNA Installer requires GUM for its graphical interface."
echo " GUM does not seem to be installed on your system."
echo "---------------------------------------------------------------------"
printf "Do you want the script to try to install GUM? (y/N): "
read -r install_gum_choice
if [[ "$install_gum_choice" =~ ^([yY])$ ]]; then
echo "Attempting to install GUM..."
if sudo pacman -S --noconfirm gum; then
echo "GUM installed successfully from official repositories."
else
echo "Attempting to install GUM from AUR..."
if ! command_exists git || ! pacman -Q base-devel >/dev/null 2>&1; then
echo "Installing git and base-devel..."
sudo pacman -S --noconfirm --needed git base-devel || {
echo "Error: Could not install git and base-devel."
echo "GUM is required to continue. Aborting."
exit 1
}
fi
temp_gum_dir=$(mktemp -d /tmp/gum_aur_XXXXXX)
if git clone https://aur.archlinux.org/gum.git "$temp_gum_dir"; then
(cd "$temp_gum_dir" && makepkg -si --noconfirm)
rm -rf "$temp_gum_dir"
else
echo "Error cloning GUM repository from AUR."
fi
fi
if command_exists gum; then
echo "GUM installed successfully. Continuing..."
sleep 1
else
echo "Error: Could not install GUM. Please install it manually."
exit 1
fi
else
echo "GUM is required to continue. Aborting."
exit 1
fi
fi
# --- Main Installer Flow ---
clear
display_logo
# Centered Welcome Message Block - MODIFIED for better list presentation
gum style --padding "1 2" --margin "1 0" --align center --width 80 --border normal --border-foreground "$C_BORDER_COLOR" \
"$(gum style --bold --foreground "$C_ACCENT_PRIMARY" 'Welcome to HYPRLUNA installer!')" \
"" \
"$(gum style --foreground "$C_TEXT_MUTED" 'This script follows the steps from the official HyprLuna documentation.')" \
"$(gum style --foreground "$C_TEXT_MUTED" "Source: $(gum style --underline --foreground "$C_ACCENT_SECONDARY" 'https://hyprluna.org/docs/main-dots/installation')")" \
"" \
"$(gum style --bold --foreground "$C_ACCENT_SECONDARY" "Installing from branch: $(gum style --foreground "$C_ACCENT_PRIMARY" "$BRANCH")")" \
"" \
"$(gum style --bold --foreground "$C_ACCENT_SECONDARY" 'The following steps will be performed:')" \
"$(
gum style --foreground "$C_TEXT_MUTED" --margin "0 0 0 2" \
"$(gum style --foreground "$C_ACCENT_PRIMARY" '→') 1. Verify & Install Prerequisites" \
"$(gum style --foreground "$C_ACCENT_PRIMARY" '→') 2. Install AUR Helper (paru)" \
"$(gum style --foreground "$C_ACCENT_PRIMARY" '→') 3. Install HyprLuna Dependencies" \
"$(gum style --foreground "$C_ACCENT_PRIMARY" '→') 4. Install AGS v1 (Aylur's GTK Shell)" \
"$(gum style --foreground "$C_ACCENT_PRIMARY" '→') 5. Backup Existing User Configurations (Optional)" \
"$(gum style --foreground "$C_ACCENT_PRIMARY" '→') 6. Clone & Set Up HyprLuna" \
"$(gum style --foreground "$C_ACCENT_PRIMARY" '→') 7. Configure SDDM (Astronaut Theme)"
)" \
"" \
"$(gum style --foreground "$C_WARN_TEXT" 'Some steps will require sudo privileges.')" \
"$(gum style --foreground "$C_TEXT_MUTED" 'The script will guide you through each step and ask for confirmation.')"
if ! gum_confirm "Are you ready to begin the HyprLuna installation?"; then
gum log --level info --level.foreground "$C_INFO_TEXT" --message.foreground "$C_TEXT_MUTED" "Installation cancelled by the user."
exit 0
fi
# --- STEP 0: BASIC PREREQUISITES ---
TOTAL_STEPS=7
CURRENT_STEP=1
show_section_progress "$CURRENT_STEP" "$TOTAL_STEPS" "STEP 0: Verifying basic prerequisites"
gum log --level info --level.foreground "$C_INFO_TEXT" --message.foreground "$C_TEXT_MUTED" "STEP 0: Verifying basic prerequisites."
missing_pacman_pkgs=()
for pkg in "${PACMAN_PREREQ_PACKAGES[@]}"; do
if ! pacman -Q "$pkg" >/dev/null 2>&1; then
missing_pacman_pkgs+=("$pkg")
fi
done
if [ ${#missing_pacman_pkgs[@]} -gt 0 ]; then
gum style --padding "0 1" --foreground "$C_WARN_TEXT" "Required packages: $(gum style --bold --foreground "$C_ACCENT_PRIMARY" "${missing_pacman_pkgs[*]}")."
if gum_confirm "Install these packages now?"; then
if ! run_with_spinner "Installing base packages..." "sudo pacman -S --noconfirm --needed ${missing_pacman_pkgs[*]}"; then
gum log --level error --level.foreground "$C_ERROR_TEXT" --message.foreground "$C_ERROR_TEXT" "Could not install base packages. Aborting."
exit 1
fi
gum log --level info --level.foreground "$C_SUCCESS_TEXT" --message.foreground "$C_SUCCESS_TEXT" "Base packages installed successfully."
else
gum log --level error --level.foreground "$C_ERROR_TEXT" --message.foreground "$C_ERROR_TEXT" "Installation cancelled. Missing base packages."
exit 1
fi
else
gum log --level info --level.foreground "$C_INFO_TEXT" --message.foreground "$C_TEXT_MUTED" "Basic prerequisites already installed."
fi
gum log --level info --level.foreground "$C_INFO_TEXT" --message.foreground "$C_TEXT_MUTED" "Updating system (recommended)."
if gum_confirm "Update the system now?"; then
run_with_spinner "Updating archlinux-keyring..." "sudo pacman -S --noconfirm --needed archlinux-keyring"
run_with_spinner "Updating the system..." "sudo pacman -Syyu --noconfirm"
else
gum log --level warn --level.foreground "$C_WARN_TEXT" --message.foreground "$C_WARN_TEXT" "System update skipped."
fi
# --- STEP 1: INSTALL AUR HELPER (paru) ---
CURRENT_STEP=2
show_section_progress "$CURRENT_STEP" "$TOTAL_STEPS" "STEP 1: Installing AUR Helper (paru)"
gum log --level info --level.foreground "$C_INFO_TEXT" --message.foreground "$C_TEXT_MUTED" "STEP 1: Installing AUR Helper (paru)."
if command_exists paru; then
gum log --level info --level.foreground "$C_INFO_TEXT" --message.foreground "$C_TEXT_MUTED" "AUR Helper 'paru' is already installed."
else
if gum_confirm "Install 'paru' now?"; then
rm -rf "$PARU_CLONE_DIR"
mkdir -p "$PARU_CLONE_DIR"
if ! run_with_spinner "Cloning paru from AUR..." "git clone https://aur.archlinux.org/paru.git $PARU_CLONE_DIR"; then
gum log --level error --level.foreground "$C_ERROR_TEXT" --message.foreground "$C_ERROR_TEXT" "Failed to clone 'paru'. Aborting."
rm -rf "$PARU_CLONE_DIR"
exit 1
fi
original_dir=$(pwd)
cd "$PARU_CLONE_DIR" || {
gum log --level error --level.foreground "$C_ERROR_TEXT" --message.foreground "$C_ERROR_TEXT" "Could not access $PARU_CLONE_DIR"
rm -rf "$PARU_CLONE_DIR"
exit 1
}
if ! run_with_spinner "Installing paru..." "makepkg -si --noconfirm"; then
gum log --level error --level.foreground "$C_ERROR_TEXT" --message.foreground "$C_ERROR_TEXT" "Failed to install 'paru'. Aborting."
cd "$original_dir"
rm -rf "$PARU_CLONE_DIR"
exit 1
fi
cd "$original_dir"
rm -rf "$PARU_CLONE_DIR"
gum log --level info --level.foreground "$C_SUCCESS_TEXT" --message.foreground "$C_SUCCESS_TEXT" "'paru' installed successfully."
else
gum log --level error --level.foreground "$C_ERROR_TEXT" --message.foreground "$C_ERROR_TEXT" "'paru' is required to continue. Aborting."
exit 1
fi
fi
# --- STEP 2: INSTALL REQUIRED PACKAGES (with paru) ---
CURRENT_STEP=3
show_section_progress "$CURRENT_STEP" "$TOTAL_STEPS" "STEP 2: Installing HyprLuna Dependencies"
gum log --level info --level.foreground "$C_INFO_TEXT" --message.foreground "$C_TEXT_MUTED" "STEP 2: Installing required packages for HyprLuna."
# Separate python packages
PYTHON_PACKAGES=()
OTHER_PACKAGES=()
for pkg in "${PARU_PACKAGES[@]}"; do
if [[ "$pkg" == python-* ]]; then
PYTHON_PACKAGES+=("$pkg")
else
OTHER_PACKAGES+=("$pkg")
fi
done
gum style --padding "0 1" --foreground "$C_ACCENT_SECONDARY" "${#PARU_PACKAGES[@]} packages will be installed (many from AUR)."
gum style --padding "0 1" --foreground "$C_TEXT_MUTED" "Installation log: $(gum style --bold --foreground "$C_INFO_TEXT" "$PARU_LOG_FILE")"
gum style --padding "0 1" --foreground "$C_WARN_TEXT" "This process can be lengthy and may involve compilations."
if gum_confirm "Proceed with package installation?"; then
TOTAL_PACKAGES=${#PARU_PACKAGES[@]}
PROCESSED_COUNT=0
FAILED_PACKAGES=()
SKIPPED_PACKAGES=()
SUCCESS_PACKAGES=()
echo "=== HyprLuna Package Installation Log ($(date)) ===" >"$PARU_LOG_FILE"
echo "Total packages to install: $TOTAL_PACKAGES" >>"$PARU_LOG_FILE"
echo "Python packages to install first: ${#PYTHON_PACKAGES[@]}" >>"$PARU_LOG_FILE"
echo "Other packages to install: ${#OTHER_PACKAGES[@]}" >>"$PARU_LOG_FILE"
echo "" >>"$PARU_LOG_FILE"
is_package_installed() {
pacman -Q "$1" &>/dev/null
}
# Install Python packages first
if [ ${#PYTHON_PACKAGES[@]} -gt 0 ]; then
gum log --level info --level.foreground "$C_INFO_TEXT" --message.foreground "$C_TEXT_MUTED" "Installing Python packages..."
echo "Installing Python packages..."
for pkg in "${PYTHON_PACKAGES[@]}"; do
PROCESSED_COUNT=$((PROCESSED_COUNT + 1))
PROGRESS=$((PROCESSED_COUNT * 100 / TOTAL_PACKAGES))
pkg_bar_fill_str=$(generate_simple_progress_bar "$PROCESSED_COUNT" "$TOTAL_PACKAGES" 25)
printf "\r%b %d%% (%d/%d) - Installing (Python): %-30.30s " "[${pkg_bar_fill_str}]" "$PROGRESS" "$PROCESSED_COUNT" "$TOTAL_PACKAGES" "$pkg"
if is_package_installed "$pkg"; then
echo "SKIPPED: $pkg is already installed." >>"$PARU_LOG_FILE"
SKIPPED_PACKAGES+=("$pkg")
else
echo "=== Installing $pkg ($PROCESSED_COUNT/$TOTAL_PACKAGES) ===" >>"$PARU_LOG_FILE"
if ! paru -S --noconfirm --needed "$pkg" >>"$PARU_LOG_FILE" 2>&1; then
FAILED_PACKAGES+=("$pkg")
echo "FAILURE: Installation of $pkg failed." >>"$PARU_LOG_FILE"
else
SUCCESS_PACKAGES+=("$pkg")
echo "SUCCESS: $pkg installed successfully." >>"$PARU_LOG_FILE"
fi
echo "" >>"$PARU_LOG_FILE"
fi
done
printf "\n"
gum log --level info --level.foreground "$C_SUCCESS_TEXT" --message.foreground "$C_TEXT_MUTED" "Python packages processed."
fi
# Install other packages
if [ ${#OTHER_PACKAGES[@]} -gt 0 ]; then
gum log --level info --level.foreground "$C_INFO_TEXT" --message.foreground "$C_TEXT_MUTED" "Installing remaining packages..."
echo "Installing remaining packages..."
for pkg in "${OTHER_PACKAGES[@]}"; do
PROCESSED_COUNT=$((PROCESSED_COUNT + 1))
PROGRESS=$((PROCESSED_COUNT * 100 / TOTAL_PACKAGES))
pkg_bar_fill_str=$(generate_simple_progress_bar "$PROCESSED_COUNT" "$TOTAL_PACKAGES" 25)
printf "\r%b %d%% (%d/%d) - Installing (Other): %-30.30s " "[${pkg_bar_fill_str}]" "$PROGRESS" "$PROCESSED_COUNT" "$TOTAL_PACKAGES" "$pkg"
if is_package_installed "$pkg"; then
echo "SKIPPED: $pkg is already installed." >>"$PARU_LOG_FILE"
SKIPPED_PACKAGES+=("$pkg")
else
echo "=== Installing $pkg ($PROCESSED_COUNT/$TOTAL_PACKAGES) ===" >>"$PARU_LOG_FILE"
if ! paru -S --noconfirm --needed "$pkg" >>"$PARU_LOG_FILE" 2>&1; then
FAILED_PACKAGES+=("$pkg")
echo "FAILURE: Installation of $pkg failed." >>"$PARU_LOG_FILE"
else
SUCCESS_PACKAGES+=("$pkg")
echo "SUCCESS: $pkg installed successfully." >>"$PARU_LOG_FILE"
fi
echo "" >>"$PARU_LOG_FILE"
fi
done
printf "\n"
gum log --level info --level.foreground "$C_SUCCESS_TEXT" --message.foreground "$C_TEXT_MUTED" "Remaining packages processed."
fi
echo "=== Installation Summary ===" >>"$PARU_LOG_FILE"
echo "Successful packages: ${#SUCCESS_PACKAGES[@]}" >>"$PARU_LOG_FILE"
echo "Skipped packages (already installed): ${#SKIPPED_PACKAGES[@]}" >>"$PARU_LOG_FILE"
echo "Failed packages: ${#FAILED_PACKAGES[@]}" >>"$PARU_LOG_FILE"
if [ ${#FAILED_PACKAGES[@]} -gt 0 ]; then
gum log --level warn --level.foreground "$C_WARN_TEXT" --message.foreground "$C_WARN_TEXT" "Some packages failed to install: $(gum style --bold --foreground "$C_ACCENT_PRIMARY" "${FAILED_PACKAGES[*]}")"
gum log --level info --level.foreground "$C_INFO_TEXT" --message.foreground "$C_TEXT_MUTED" "Check the log at $(gum style --underline --foreground "$C_INFO_TEXT" "$PARU_LOG_FILE")"
if gum_confirm "Continue despite errors?"; then
gum log --level warn --level.foreground "$C_WARN_TEXT" --message.foreground "$C_WARN_TEXT" "Continuing with installation. Some components might not work."
else
gum log --level error --level.foreground "$C_ERROR_TEXT" --message.foreground "$C_ERROR_TEXT" "Installation cancelled due to package errors."
gum_confirm "View the installation log now?" && gum pager <"$PARU_LOG_FILE"
exit 1
fi
else
gum log --level info --level.foreground "$C_SUCCESS_TEXT" --message.foreground "$C_SUCCESS_TEXT" "All packages processed successfully."
gum log --level info --level.foreground "$C_INFO_TEXT" --message.foreground "$C_TEXT_MUTED" "Installed: ${#SUCCESS_PACKAGES[@]} | Skipped: ${#SKIPPED_PACKAGES[@]}"
fi
if gum_confirm "View detailed installation log?"; then
gum pager <"$PARU_LOG_FILE"
fi
else
gum log --level error --level.foreground "$C_ERROR_TEXT" --message.foreground "$C_ERROR_TEXT" "Package installation cancelled. Aborting."
exit 1
fi
# --- STEP 3: INSTALL LATEST AGS V1 ---
CURRENT_STEP=4
show_section_progress "$CURRENT_STEP" "$TOTAL_STEPS" "STEP 3: Installing AGS v1"
gum log --level info --level.foreground "$C_INFO_TEXT" --message.foreground "$C_TEXT_MUTED" "STEP 3: Installing AGS v1 (Aylur's GTK Shell)."
if gum_confirm "Install AGS v1?"; then
gum style --padding "0 1" --foreground "$C_TEXT_MUTED" "Installing AGS v1 by copying binaries to their appropriate paths you'll be prompted for your password:"
sudo cp -r ./ags_bin_lib/com.github.Aylur.ags/ /usr/share/
sudo cp -r ./ags_bin_lib/agsv1/ /usr/lib/
sudo ln -sf /usr/share/com.github.Aylur.ags/com.github.Aylur.ags /usr/bin/agsv1
rm -rf "$AGSV1_CLONE_DIR"
gum log --level info --level.foreground "$C_SUCCESS_TEXT" --message.foreground "$C_SUCCESS_TEXT" "AGS v1 installed successfully."
else
gum log --level warn --level.foreground "$C_WARN_TEXT" --message.foreground "$C_WARN_TEXT" "AGS v1 installation skipped."
fi
# --- STEP 4: CREATE BACKUP (Optional) ---
CURRENT_STEP=5
show_section_progress "$CURRENT_STEP" "$TOTAL_STEPS" "STEP 4: Backing up existing configurations"
gum log --level info --level.foreground "$C_INFO_TEXT" --message.foreground "$C_TEXT_MUTED" "STEP 4: Backing up existing configurations."
if gum_confirm "Create a backup of your configurations in '$BACKUP_DIR'?"; then
mkdir -p "$BACKUP_DIR"
dirs_to_backup=("$HOME/.config" "$HOME/.local" "$HOME/.fonts" "$HOME/.ags" "$HOME/Pictures")
total_dirs=${#dirs_to_backup[@]}
processed_dirs=0
echo "Creating backup of configurations..."
for dir_path in "${dirs_to_backup[@]}"; do
processed_dirs=$((processed_dirs + 1))
progress=$((processed_dirs * 100 / total_dirs))
dir_name=$(basename "$dir_path")
backup_bar_fill_str=$(generate_simple_progress_bar "$processed_dirs" "$total_dirs" 25)
printf "\r%b %d%% (%d/%d) - Backing up: %-30.30s " "[${backup_bar_fill_str}]" "$progress" "$processed_dirs" "$total_dirs" "$dir_name"
if [ -d "$dir_path" ]; then
rsync -aq "$dir_path" "$BACKUP_DIR/" >/dev/null 2>&1 || {
echo "Error backing up $dir_name." >>"$PARU_LOG_FILE"
}
else
echo "$dir_name not found for backup." >>"$PARU_LOG_FILE"
fi
done
printf "\n"
gum log --level info --level.foreground "$C_SUCCESS_TEXT" --message.foreground "$C_TEXT_MUTED" "Backup completed in $(gum style --underline --foreground "$C_INFO_TEXT" "$BACKUP_DIR")."
else
gum log --level warn --level.foreground "$C_WARN_TEXT" --message.foreground "$C_WARN_TEXT" "Backup creation skipped."
fi
# --- STEP 5: CLONE AND CONFIGURE HYPRLUNA ---
CURRENT_STEP=6
show_section_progress "$CURRENT_STEP" "$TOTAL_STEPS" "STEP 5: Cloning and configuring HyprLuna"
gum log --level info --level.foreground "$C_INFO_TEXT" --message.foreground "$C_TEXT_MUTED" "STEP 5: Cloning and configuring HyprLuna."
if [ -d "$HYPRLUNA_INSTALL_DIR" ]; then
gum log --level warn --level.foreground "$C_WARN_TEXT" --message.foreground "$C_WARN_TEXT" "Directory $(gum style --bold "$HYPRLUNA_INSTALL_DIR") already exists."
# Check if it's a git repository
if [ -d "$HYPRLUNA_INSTALL_DIR/.git" ]; then
# Offer options for existing repository
repo_action=$(gum choose --header="What would you like to do with the existing HyprLuna installation?" \
--cursor.foreground="$C_ACCENT_PRIMARY" \
--selected.foreground="$C_TEXT_ON_ACCENT" --selected.background="$C_ACCENT_PRIMARY" \
"Skip (keep existing installation)" \
"Update (pull latest changes)" \
"Reinstall (remove and clone again)")
case "$repo_action" in
"Skip (keep existing installation)")
gum log --level info --level.foreground "$C_INFO_TEXT" --message.foreground "$C_TEXT_MUTED" "Keeping existing HyprLuna installation."
;;
"Update (pull latest changes)")
gum log --level info --level.foreground "$C_INFO_TEXT" --message.foreground "$C_TEXT_MUTED" "Updating existing HyprLuna installation..."
original_dir_update=$(pwd)
cd "$HYPRLUNA_INSTALL_DIR" || {
gum log --level error --level.foreground "$C_ERROR_TEXT" --message.foreground "$C_ERROR_TEXT" "Could not access $HYPRLUNA_INSTALL_DIR. Aborting."
exit 1
}
# Switch to the specified branch and pull latest changes
if ! run_with_spinner "Switching to $BRANCH branch..." "git checkout $BRANCH"; then
gum log --level error --level.foreground "$C_ERROR_TEXT" --message.foreground "$C_ERROR_TEXT" "Could not switch to $BRANCH branch. Aborting."
cd "$original_dir_update" || true
exit 1
fi
if ! run_with_spinner "Updating HyprLuna from $BRANCH branch..." "git pull origin $BRANCH"; then
gum log --level error --level.foreground "$C_ERROR_TEXT" --message.foreground "$C_ERROR_TEXT" "Could not update HyprLuna from $BRANCH branch. Aborting."
cd "$original_dir_update" || true
exit 1
fi
gum log --level info --level.foreground "$C_SUCCESS_TEXT" --message.foreground "$C_SUCCESS_TEXT" "HyprLuna updated successfully from $BRANCH branch."
cd "$original_dir_update" || true
;;
"Reinstall (remove and clone again)")
gum log --level warn --level.foreground "$C_WARN_TEXT" --message.foreground "$C_WARN_TEXT" "Removing existing installation for a fresh clone..."
if ! run_with_spinner "Deleting existing directory $HYPRLUNA_INSTALL_DIR..." "rm -rf $HYPRLUNA_INSTALL_DIR"; then
gum log --level error --level.foreground "$C_ERROR_TEXT" --message.foreground "$C_ERROR_TEXT" "Could not delete directory $HYPRLUNA_INSTALL_DIR. Aborting."
exit 1
fi
gum log --level info --level.foreground "$C_SUCCESS_TEXT" --message.foreground "$C_SUCCESS_TEXT" "Directory $HYPRLUNA_INSTALL_DIR deleted."
# Clone fresh repository
if ! run_with_spinner "Cloning HyprLuna ($BRANCH branch)..." "git clone -b $BRANCH $REPO_URL $HYPRLUNA_INSTALL_DIR"; then
gum log --level error --level.foreground "$C_ERROR_TEXT" --message.foreground "$C_ERROR_TEXT" "Could not clone HyprLuna from $BRANCH branch. Aborting."
exit 1
fi
;;
esac
else
# Directory exists but not a git repository
gum log --level warn --level.foreground "$C_WARN_TEXT" --message.foreground "$C_WARN_TEXT" "Directory exists but is not a git repository."
if gum_confirm "Remove existing directory and clone HyprLuna?"; then
if ! run_with_spinner "Deleting existing directory $HYPRLUNA_INSTALL_DIR..." "rm -rf $HYPRLUNA_INSTALL_DIR"; then
gum log --level error --level.foreground "$C_ERROR_TEXT" --message.foreground "$C_ERROR_TEXT" "Could not delete directory $HYPRLUNA_INSTALL_DIR. Aborting."
exit 1
fi
gum log --level info --level.foreground "$C_SUCCESS_TEXT" --message.foreground "$C_SUCCESS_TEXT" "Directory $HYPRLUNA_INSTALL_DIR deleted."
# Clone fresh repository
if ! run_with_spinner "Cloning HyprLuna ($BRANCH branch)..." "git clone -b $BRANCH $REPO_URL $HYPRLUNA_INSTALL_DIR"; then
gum log --level error --level.foreground "$C_ERROR_TEXT" --message.foreground "$C_ERROR_TEXT" "Could not clone HyprLuna from $BRANCH branch. Aborting."
exit 1
fi
else
gum log --level error --level.foreground "$C_ERROR_TEXT" --message.foreground "$C_ERROR_TEXT" "Cannot continue without a proper HyprLuna installation. Aborting."
exit 1
fi
fi
else
# Directory doesn't exist, clone fresh
if ! run_with_spinner "Cloning HyprLuna ($BRANCH branch)..." "git clone -b $BRANCH $REPO_URL $HYPRLUNA_INSTALL_DIR"; then
gum log --level error --level.foreground "$C_ERROR_TEXT" --message.foreground "$C_ERROR_TEXT" "Could not clone HyprLuna from $BRANCH branch. Aborting."
exit 1
fi
fi
# Success message based on the action taken (repo_action may not be set if directory didn't exist)
if [ -n "${repo_action:-}" ]; then
if [ "$repo_action" = "Skip (keep existing installation)" ]; then
gum log --level info --level.foreground "$C_SUCCESS_TEXT" --message.foreground "$C_TEXT_MUTED" "Using existing HyprLuna installation at $(gum style --underline --foreground "$C_INFO_TEXT" "$HYPRLUNA_INSTALL_DIR")."
elif [ "$repo_action" = "Update (pull latest changes)" ]; then
gum log --level info --level.foreground "$C_SUCCESS_TEXT" --message.foreground "$C_TEXT_MUTED" "HyprLuna updated from $BRANCH branch at $(gum style --underline --foreground "$C_INFO_TEXT" "$HYPRLUNA_INSTALL_DIR")."
else
gum log --level info --level.foreground "$C_SUCCESS_TEXT" --message.foreground "$C_TEXT_MUTED" "HyprLuna ($BRANCH branch) cloned to $(gum style --underline --foreground "$C_INFO_TEXT" "$HYPRLUNA_INSTALL_DIR")."
fi
else
gum log --level info --level.foreground "$C_SUCCESS_TEXT" --message.foreground "$C_TEXT_MUTED" "HyprLuna ($BRANCH branch) cloned to $(gum style --underline --foreground "$C_INFO_TEXT" "$HYPRLUNA_INSTALL_DIR")."
fi
original_dir_step5=$(pwd)
cd "$HYPRLUNA_INSTALL_DIR" || {
gum log --level error --level.foreground "$C_ERROR_TEXT" --message.foreground "$C_ERROR_TEXT" "Could not access $HYPRLUNA_INSTALL_DIR. Aborting."
exit 1
}
# Only apply configuration files if not using "Skip" option
if [ "${repo_action:-}" != "Skip (keep existing installation)" ]; then
gum log --level info --level.foreground "$C_INFO_TEXT" --message.foreground "$C_TEXT_MUTED" "Copying configuration files..."
else
gum log --level info --level.foreground "$C_INFO_TEXT" --message.foreground "$C_TEXT_MUTED" "Skipping configuration files (using existing installation)..."
fi
setup_actions=(
"rsync -aq --remove-source-files .config/ $HOME/.config/"
"rsync -aq --remove-source-files .local/ $HOME/.local/"
"rsync -aq --remove-source-files .cache/ $HOME/.cache/"
"[ -d .vscode ] && rsync -aq --remove-source-files .vscode/ $HOME/.vscode/ || echo 'Directory .vscode not found in repo.'"
"[ -d .fonts ] && rsync -aq --remove-source-files .fonts/ $HOME/.fonts/ && fc-cache -f || echo 'Directory .fonts not found in repo.'"
"[ -d .ags ] && rsync -aq --remove-source-files .ags/ $HOME/.ags/ || echo 'Directory .ags not found in repo.'"
"[ -d Pictures ] && rsync -aq Pictures/ $HOME/Pictures/ || echo 'Directory Pictures not found in repo.'"
"[ -d $HOME/.config/hypr/scripts ] && chmod -R +x $HOME/.config/hypr/scripts/ || echo 'Hypr scripts directory not found for chmod.'"
"[ -d $HOME/.config/ags/scripts/hyprland ] && chmod -R +x $HOME/.config/ags/scripts/hyprland/ || echo 'AGS/Hyprland scripts directory not found for chmod.'"
"[ -d $HOME/.config/ags/modules/sideleft/tools ] && chmod -R +x $HOME/.config/ags/modules/sideleft/tools/changeres.sh || echo 'AGS/modules/sideleft/tools scripts directory not found for chmod.'"
"sudo systemctl enable sddm.service"
"hyprpm update"
"hyprpm add https://github.com/hyprwm/hyprland-plugins"
"hyprpm enable hyprexpo"
"hyprpm reload"
"hyprctl reload"
"chmod +x ~/.config/ags/lunactl"
"sudo cp ~/.config/ags/lunactl /usr/bin/"
"chmod +x /usr/bin/lunactl"
)
total_actions=${#setup_actions[@]}
# Only execute setup actions if not using "Skip" option
if [ "${repo_action:-}" != "Skip (keep existing installation)" ]; then
echo "Copying configuration files..." | tee -a "$PARU_LOG_FILE"
echo "--- Start of Setup Actions ---" >>"$PARU_LOG_FILE"
for i in "${!setup_actions[@]}"; do
action="${setup_actions[$i]}"
action_num=$((i + 1))
progress=$((action_num * 100 / total_actions))
setup_bar_fill_str=$(generate_simple_progress_bar "$action_num" "$total_actions" 25)
printf "\r%b %d%% (%d/%d) - Applying configuration... " "[${setup_bar_fill_str}]" "$progress" "$action_num" "$total_actions"
echo "Executing setup_action $action_num/$total_actions: $action" >>"$PARU_LOG_FILE"
action_output_tmp=$(mktemp)
if eval "$action" >"$action_output_tmp" 2>&1; then
echo "SUCCESS: $action" >>"$PARU_LOG_FILE"
else
ret_code=$?
echo "FAILURE ($ret_code): $action" >>"$PARU_LOG_FILE"
echo "Failure output:" >>"$PARU_LOG_FILE"
cat "$action_output_tmp" >>"$PARU_LOG_FILE"
fi
rm -f "$action_output_tmp"
done
printf "\n"
echo "--- End of Setup Actions ---" >>"$PARU_LOG_FILE"
gum log --level info --level.foreground "$C_SUCCESS_TEXT" --message.foreground "$C_SUCCESS_TEXT" "HyprLuna configuration applied."
else
echo "Skipping configuration files (using existing installation)..." >>"$PARU_LOG_FILE"
gum log --level info --level.foreground "$C_INFO_TEXT" --message.foreground "$C_TEXT_MUTED" "Using existing HyprLuna configuration."
fi
cd "$original_dir_step5" || true
# --- STEP 6: CONFIGURE SDDM ---
CURRENT_STEP=7
show_section_progress "$CURRENT_STEP" "$TOTAL_STEPS" "STEP 6: Configuring SDDM"
gum log --level info --level.foreground "$C_INFO_TEXT" --message.foreground "$C_TEXT_MUTED" "STEP 6: Configuring SDDM (sddm-astronaut-theme)."
if ! pacman -Q sddm &>/dev/null; then
gum log --level warn --level.foreground "$C_WARN_TEXT" --message.foreground "$C_WARN_TEXT" "SDDM is not installed."
if gum_confirm "Install SDDM now?"; then
if ! run_with_spinner "Installing SDDM..." "sudo pacman -S --noconfirm sddm"; then
gum log --level error --level.foreground "$C_ERROR_TEXT" --message.foreground "$C_ERROR_TEXT" "Could not install SDDM. Skipping theme configuration."
else
gum log --level info --level.foreground "$C_SUCCESS_TEXT" --message.foreground "$C_SUCCESS_TEXT" "SDDM installed successfully."
fi
else
gum log --level warn --level.foreground "$C_WARN_TEXT" --message.foreground "$C_WARN_TEXT" "SDDM not installed. Skipping theme configuration."
fi
fi
if pacman -Q sddm &>/dev/null; then
gum style --padding "0 1" --foreground "$C_TEXT_MUTED" "The next step will configure the SDDM Astronaut theme." \
"$(gum style --bold --foreground "$C_WARN_TEXT" 'IMPORTANT: Select OPTION 1 when prompted.')"
if gum_confirm "Configure SDDM Astronaut theme?"; then
sddm_setup_url="https://raw.githubusercontent.com/keyitdev/sddm-astronaut-theme/master/setup.sh"
if ! curl -s --head --fail "$sddm_setup_url" >/dev/null; then
gum log --level error --level.foreground "$C_ERROR_TEXT" --message.foreground "$C_ERROR_TEXT" "Cannot access SDDM configuration script."
gum log --level warn --level.foreground "$C_WARN_TEXT" --message.foreground "$C_WARN_TEXT" "You can install it manually later."
else
sddm_cmd="sh -c \"\$(curl -fsSL $sddm_setup_url)\""
gum style --border normal --border-foreground "$C_BORDER_COLOR" --padding "1" --align center \
"$(gum style --foreground "$C_ACCENT_SECONDARY" 'Running SDDM Astronaut Theme script...')" \
"$(gum style --foreground "$C_WARN_TEXT" 'SELECT OPTION 1 when prompted.')" \
"This installer will temporarily yield control."
eval "$sddm_cmd"
sddm_script_ret_code=$?
if [[ $sddm_script_ret_code -eq 0 ]]; then
gum log --level info --level.foreground "$C_SUCCESS_TEXT" --message.foreground "$C_SUCCESS_TEXT" "SDDM theme configured successfully."
if ! systemctl is-enabled sddm.service &>/dev/null; then
run_with_spinner "Enabling SDDM..." "sudo systemctl enable sddm.service"
gum log --level info --level.foreground "$C_INFO_TEXT" --message.foreground "$C_TEXT_MUTED" "SDDM enabled as a startup service."
fi
else
gum log --level error --level.foreground "$C_ERROR_TEXT" --message.foreground "$C_ERROR_TEXT" "SDDM theme configuration failed."
fi
fi
else
gum log --level warn --level.foreground "$C_WARN_TEXT" --message.foreground "$C_WARN_TEXT" "SDDM theme configuration skipped."
gum style --foreground "$C_TEXT_MUTED" "You can configure it later with:"
echo "sh -c \"\$(curl -fsSL https://raw.githubusercontent.com/keyitdev/sddm-astronaut-theme/master/setup.sh)\""
fi
else
gum log --level warn --level.foreground "$C_WARN_TEXT" --message.foreground "$C_WARN_TEXT" "SDDM is not installed. Skipping theme configuration."
fi
# --- FINAL CLEANUP ---
# rm -rf "$PARU_CLONE_DIR" "$AGSV1_CLONE_DIR" 2>/dev/null
gum log --level info --level.foreground "$C_INFO_TEXT" --message.foreground "$C_TEXT_MUTED" "Cleanup of temporary files completed."
# --- FINAL MESSAGE ---
clear
display_logo
BOX_CONTENT_WIDTH=63
printf_box_line() {
local text_content="$1"
local text_len_visible
text_len_visible=$(echo -e "$text_content" | sed -r "s/\x1B\[([0-9]{1,3}(;[0-9]{1,2})?)?[mGK]//g" | wc -c)
text_len_visible=$((text_len_visible - 1))
local padding_needed=$((BOX_CONTENT_WIDTH - text_len_visible))
if [ $padding_needed -lt 0 ]; then padding_needed=0; fi
local padding_spaces
padding_spaces=$(printf "%${padding_needed}s" "")
echo -e "${C_ANSI_PRIMARY_FG}│${C_ANSI_RESET} ${text_content}${padding_spaces} ${C_ANSI_PRIMARY_FG}│${C_ANSI_RESET}"
}
printf "\n\n"
echo -e "${C_ANSI_PRIMARY_FG}┌$(printf '%*s' "$BOX_CONTENT_WIDTH" '' | tr ' ' '─')┐${C_ANSI_RESET}"
printf_box_line ""
printf_box_line " ${C_ANSI_BOLD}HYPRLUNA INSTALLATION COMPLETE!${C_ANSI_RESET} "
printf_box_line ""
echo -e "${C_ANSI_PRIMARY_FG}├$(printf '%*s' "$BOX_CONTENT_WIDTH" '' | tr ' ' '─')┤${C_ANSI_RESET}"
printf_box_line "${C_ANSI_SECONDARY_FG}Summary:${C_ANSI_RESET}"
printf_box_line "${C_ANSI_TEXT_BRIGHT}- System prerequisites installed${C_ANSI_RESET}"
printf_box_line "${C_ANSI_TEXT_BRIGHT}- HyprLuna packages installed${C_ANSI_RESET}"
printf_box_line "${C_ANSI_TEXT_BRIGHT}- AGS v1 installed (if selected)${C_ANSI_RESET}"
printf_box_line "${C_ANSI_TEXT_BRIGHT}- HyprLuna configured${C_ANSI_RESET}"
printf_box_line "${C_ANSI_TEXT_BRIGHT}- SDDM configured (if selected)${C_ANSI_RESET}"
printf_box_line ""
printf_box_line "${C_ANSI_YELLOW}NEXT STEPS:${C_ANSI_RESET}"
printf_box_line "${C_ANSI_TEXT_BRIGHT}1. REBOOT YOUR SYSTEM to apply all changes${C_ANSI_RESET}"
printf_box_line "${C_ANSI_TEXT_BRIGHT}2. In SDDM, select Hyprland as your session${C_ANSI_RESET}"
printf_box_line "${C_ANSI_TEXT_BRIGHT}3. Log in to enjoy your new setup${C_ANSI_RESET}"
printf_box_line ""
log_line_text="${C_ANSI_TEXT_BRIGHT}Installation log: ${C_ANSI_UNDERLINE}${PARU_LOG_FILE}${C_ANSI_RESET}"
printf_box_line "$log_line_text"
echo -e "${C_ANSI_PRIMARY_FG}└$(printf '%*s' "$BOX_CONTENT_WIDTH" '' | tr ' ' '─')┘${C_ANSI_RESET}"
if [ -d "$BACKUP_DIR" ]; then
echo -e "\n${C_ANSI_TEXT_BRIGHT}Backup created in: ${C_ANSI_UNDERLINE}$BACKUP_DIR${C_ANSI_RESET}\n"
fi
echo -e "\n${C_ANSI_BOLD}${C_ANSI_GREEN}Enjoy your new HYPRLUNA setup!${C_ANSI_RESET}\n"
BOX_RESTART_WIDTH=63
echo -e "${C_ANSI_PRIMARY_FG}┌$(printf '%*s' "$BOX_RESTART_WIDTH" '' | tr ' ' '─')┐${C_ANSI_RESET}"
restart_options_text=" ${C_ANSI_YELLOW}REBOOT OPTIONS:${C_ANSI_RESET} "
restart_options_len=$(echo -e "$restart_options_text" | sed -r "s/\x1B\[([0-9]{1,3}(;[0-9]{1,2})?)?[mGK]//g" | wc -c)
restart_options_len=$((restart_options_len - 1))
restart_padding_needed=$((BOX_RESTART_WIDTH - restart_options_len))
if [ $restart_padding_needed -lt 0 ]; then restart_padding_needed=0; fi
restart_padding_spaces=$(printf "%${restart_padding_needed}s" "")
echo -e "${C_ANSI_PRIMARY_FG}│${C_ANSI_RESET} ${restart_options_text}${restart_padding_spaces} ${C_ANSI_PRIMARY_FG}│${C_ANSI_RESET}"
echo -e "${C_ANSI_PRIMARY_FG}└$(printf '%*s' "$BOX_RESTART_WIDTH" '' | tr ' ' '─')┘${C_ANSI_RESET}"
printf "${C_ANSI_TEXT_BRIGHT}Reboot the system now? (y/n): ${C_ANSI_RESET}"
read -r choice
if [[ "$choice" =~ ^[Yy]$ ]]; then
echo -e "${C_ANSI_GREEN}Rebooting the system...${C_ANSI_RESET}"
sudo systemctl reboot
else
printf "${C_ANSI_TEXT_BRIGHT}Restart display manager service? (will log you out) (y/n): ${C_ANSI_RESET}"
read -r choice
if [[ "$choice" =~ ^[Yy]$ ]]; then
echo -e "${C_ANSI_GREEN}Restarting display manager service...${C_ANSI_RESET}"
sudo systemctl restart display-manager.service
else
echo -e "${C_ANSI_YELLOW}Remember to reboot to apply all changes.${C_ANSI_RESET}"
fi
fi
exit 0