fix: TUI mit drei Backends (gum/whiptail/basic) + gum auto-install auf frischen Systemen
- tui.sh: komplett überarbeitet mit _strip_format() für basic mode
- whiptail als mittleres Fallback-Backend hinzugefügt
- Alle #{bold}/#{normal}-Markups entfernt, saubere ANSI-API (tui_info/tui_bold/...)
- install.sh: detect_environment() installiert gum vor allen Prompts
- Kein seq-Dependency mehr (printf -v statt seq)
- packages.sh/preflight.sh/homelab.sh/optional.sh auf neue TUI-API migriert
This commit is contained in:
@@ -10,7 +10,7 @@ module_should_skip() { return 1; }
|
||||
module_prereqs() {
|
||||
require pacman pacman
|
||||
is_arch || {
|
||||
log_error "This module requires an Arch-based system"
|
||||
tui_error "This module requires an Arch-based system"
|
||||
return 1
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,7 @@ module_main() {
|
||||
local all_packages=()
|
||||
|
||||
if ((OMERON_FRESH_INSTALL)); then
|
||||
tui_format "#{bold}Fresh install mode — installing everything#{normal}"
|
||||
tui_bold "Fresh install mode — installing everything"
|
||||
groups=(
|
||||
"hyprland"
|
||||
"gpu"
|
||||
@@ -34,7 +34,7 @@ module_main() {
|
||||
"development"
|
||||
)
|
||||
else
|
||||
tui_format "#{bold}Existing system — checking for missing packages#{normal}"
|
||||
tui_bold "Existing system — checking for missing packages"
|
||||
groups=(
|
||||
"hyprland"
|
||||
"audio"
|
||||
@@ -64,37 +64,38 @@ module_main() {
|
||||
fi
|
||||
done
|
||||
|
||||
tui_format ""
|
||||
tui_format "#{bold}Package Summary:#{normal}"
|
||||
tui_format " Total packages: ${total}"
|
||||
tui_format " Already installed: ${existing}"
|
||||
tui_format " To install: ${missing}"
|
||||
tui_format ""
|
||||
tui_separator
|
||||
tui_bold "Package Summary"
|
||||
tui_info "Total packages: $(tui_bold "$total")"
|
||||
tui_success "Already installed: $(tui_bold "$existing")"
|
||||
if ((missing > 0)); then
|
||||
tui_warn "To install: $(tui_bold "$missing")"
|
||||
fi
|
||||
printf '\n'
|
||||
|
||||
if ((missing == 0)); then
|
||||
log_success "All packages already installed"
|
||||
tui_success "All packages already installed"
|
||||
return 0
|
||||
fi
|
||||
|
||||
if ! tui_confirm "Install ${missing} missing packages?"; then
|
||||
log_info "Package installation skipped by user"
|
||||
tui_info "Package installation skipped by user"
|
||||
return 0
|
||||
fi
|
||||
|
||||
if ((OMERON_FRESH_INSTALL)); then
|
||||
log_info "Running system update first..."
|
||||
tui_info "Running system update first..."
|
||||
sudo_run pacman -Syu --noconfirm 2>&1 | tail -3 || true
|
||||
fi
|
||||
|
||||
local pacman_pkgs=()
|
||||
local aur_pkgs=()
|
||||
local gpu_pkgs=()
|
||||
local pkg
|
||||
|
||||
for pkg in "${all_packages[@]}"; do
|
||||
if is_package_installed "$pkg"; then
|
||||
continue
|
||||
fi
|
||||
|
||||
if pacman -Si "$pkg" >/dev/null 2>&1; then
|
||||
pacman_pkgs+=("$pkg")
|
||||
else
|
||||
@@ -103,22 +104,22 @@ module_main() {
|
||||
done
|
||||
|
||||
if ((${#pacman_pkgs[@]})); then
|
||||
log_info "Installing ${#pacman_pkgs[@]} pacman packages..."
|
||||
tui_info "Installing ${#pacman_pkgs[@]} pacman packages..."
|
||||
tui_spin "Installing core packages..." sudo_run pacman -S --needed --noconfirm "${pacman_pkgs[@]}"
|
||||
log_success "Core packages installed"
|
||||
tui_success "Core packages installed"
|
||||
fi
|
||||
|
||||
if ((${#aur_pkgs[@]})); then
|
||||
if have paru || have yay; then
|
||||
log_info "Installing ${#aur_pkgs[@]} AUR packages..."
|
||||
install_aur "${aur_pkgs[@]}" || log_warn "Some AUR packages may not have been installed"
|
||||
tui_info "Installing ${#aur_pkgs[@]} AUR packages..."
|
||||
install_aur "${aur_pkgs[@]}" || tui_warn "Some AUR packages may not have been installed"
|
||||
else
|
||||
log_warn "No AUR helper found. Install manually: ${aur_pkgs[*]}"
|
||||
tui_warn "No AUR helper found. Install manually: ${aur_pkgs[*]}"
|
||||
fi
|
||||
fi
|
||||
|
||||
log_success "Package installation complete"
|
||||
log_info "Installed: $((missing - ${#aur_pkgs[@]})) | AUR/optional: ${#aur_pkgs[@]}"
|
||||
tui_success "Package installation complete"
|
||||
tui_info "Installed: $((missing - ${#aur_pkgs[@]})) | AUR/optional: ${#aur_pkgs[@]}"
|
||||
}
|
||||
|
||||
get_group_packages() {
|
||||
|
||||
@@ -13,7 +13,7 @@ module_should_skip() { return 1; }
|
||||
module_prereqs() {
|
||||
require pacman pacman
|
||||
is_arch || {
|
||||
log_error "This module requires an Arch-based system"
|
||||
tui_error "This module requires an Arch-based system"
|
||||
return 1
|
||||
}
|
||||
}
|
||||
@@ -25,50 +25,47 @@ module_main() {
|
||||
export OMERON_DETECTED_GPU
|
||||
|
||||
system_summary
|
||||
printf '\n'
|
||||
|
||||
if is_fresh_install; then
|
||||
OMERON_FRESH_INSTALL=1
|
||||
export OMERON_FRESH_INSTALL
|
||||
|
||||
tui_format ""
|
||||
tui_format "#{bold}#{yellow}⚠ Fresh system detected!#{normal}"
|
||||
tui_format "Hyprland is not installed and no desktop session is running."
|
||||
tui_format ""
|
||||
tui_warn "Fresh system detected!"
|
||||
tui_info "Hyprland is not installed and no desktop session is running."
|
||||
printf '\n'
|
||||
|
||||
local gpu_name
|
||||
gpu_name="$(lspci -nn 2>/dev/null | grep -i 'vga\|3d\|display' | sed 's/.*: //' | head -1 || echo "unknown")"
|
||||
gpu_name="$(lspci -nn 2>/dev/null | grep -E '\[0300\]|\[0302\]|\[0380\]' | sed 's/.*: //' | head -1 || echo "unknown")"
|
||||
|
||||
tui_format "#{bold}This installation will:#{normal}"
|
||||
tui_format " • Hyprland compositor + tools"
|
||||
tui_format " • GPU drivers for: ${gpu_name}"
|
||||
tui_format " • Audio system (PipeWire)"
|
||||
tui_format " • Network services (NetworkManager)"
|
||||
tui_format " • Fonts and icon themes"
|
||||
tui_format " • Dotfiles deployment"
|
||||
tui_format ""
|
||||
tui_bold "This installation will:"
|
||||
tui_list \
|
||||
"Hyprland compositor + tools" \
|
||||
"GPU drivers for: ${gpu_name}" \
|
||||
"Audio system (PipeWire)" \
|
||||
"Network services (NetworkManager)" \
|
||||
"Fonts and icon themes" \
|
||||
"Dotfiles deployment"
|
||||
printf '\n'
|
||||
|
||||
if ! tui_confirm "Proceed with full system setup?"; then
|
||||
log_info "Fresh installation aborted by user"
|
||||
tui_info "Fresh installation aborted by user"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if ! have paru && ! have yay; then
|
||||
log_info "No AUR helper found. Installing paru..."
|
||||
tui_info "No AUR helper found. Installing paru..."
|
||||
install_aur_helper
|
||||
fi
|
||||
|
||||
if ! have gum; then
|
||||
log_info "Installing gum for better TUI..."
|
||||
sudo_run pacman -S --needed --noconfirm gum 2>/dev/null || true
|
||||
tui_style
|
||||
if ((!OMERON_HAS_GUM)) && have pacman; then
|
||||
tui_install_gum 2>/dev/null || true
|
||||
fi
|
||||
|
||||
log_success "Preflight complete — ready for full installation"
|
||||
tui_success "Preflight complete — ready for full installation"
|
||||
else
|
||||
tui_format ""
|
||||
tui_format "#{bold}#{green}✓ Existing Hyprland system detected#{normal}"
|
||||
tui_format "Will check for missing packages and updates."
|
||||
tui_format ""
|
||||
tui_success "Existing Hyprland system detected"
|
||||
tui_info "Will check for missing packages and updates."
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -84,7 +81,7 @@ install_aur_helper() {
|
||||
local build_dir
|
||||
build_dir="$(mktemp -d)"
|
||||
|
||||
log_info "Building paru from AUR..."
|
||||
tui_info "Building paru from AUR..."
|
||||
sudo_run pacman -S --needed --noconfirm rustup 2>/dev/null || true
|
||||
|
||||
if have rustup; then
|
||||
@@ -93,10 +90,10 @@ install_aur_helper() {
|
||||
|
||||
if git clone https://aur.archlinux.org/paru.git "$build_dir/paru" 2>/dev/null; then
|
||||
(cd "$build_dir/paru" && makepkg -si --needed --noconfirm) 2>&1 | tail -5 || {
|
||||
log_warn "paru build failed, trying yay..."
|
||||
tui_warn "paru build failed, trying yay..."
|
||||
if git clone https://aur.archlinux.org/yay.git "$build_dir/yay" 2>/dev/null; then
|
||||
(cd "$build_dir/yay" && makepkg -si --needed --noconfirm) 2>&1 | tail -5 || {
|
||||
log_warn "yay build failed too. Install manually: paru -S paru-bin"
|
||||
tui_warn "yay build failed too. Install manually: paru -S paru-bin"
|
||||
}
|
||||
fi
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user