diff --git a/debianito.sh b/debianito.sh index 4e4f323..ba9fe9b 100644 --- a/debianito.sh +++ b/debianito.sh @@ -17,20 +17,20 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" MODULES_DIR="${SCRIPT_DIR}/modules" source "${MODULES_DIR}/utils.sh" -[ -f "${MODULES_DIR}/sysinfo.sh" ] && source "${MODULES_DIR}/sysinfo.sh" +[ -f "${MODULES_DIR}/sysinfo.sh" ] && source "${MODULES_DIR}/sysinfo.sh" source "${MODULES_DIR}/sudo_config.sh" source "${MODULES_DIR}/repos/repo_detect.sh" source "${MODULES_DIR}/repos.sh" -[ -f "${MODULES_DIR}/firmware.sh" ] && source "${MODULES_DIR}/firmware.sh" +[ -f "${MODULES_DIR}/firmware.sh" ] && source "${MODULES_DIR}/firmware.sh" [ -f "${MODULES_DIR}/bluetooth.sh" ] && source "${MODULES_DIR}/bluetooth.sh" -[ -f "${MODULES_DIR}/gpu.sh" ] && source "${MODULES_DIR}/gpu.sh" -[ -f "${MODULES_DIR}/kernel.sh" ] && source "${MODULES_DIR}/kernel.sh" -[ -f "${MODULES_DIR}/gaming.sh" ] && source "${MODULES_DIR}/gaming.sh" -[ -f "${MODULES_DIR}/extras.sh" ] && source "${MODULES_DIR}/extras.sh" -[ -f "${MODULES_DIR}/zram.sh" ] && source "${MODULES_DIR}/zram.sh" +[ -f "${MODULES_DIR}/gpu.sh" ] && source "${MODULES_DIR}/gpu.sh" +[ -f "${MODULES_DIR}/kernel.sh" ] && source "${MODULES_DIR}/kernel.sh" +[ -f "${MODULES_DIR}/gaming.sh" ] && source "${MODULES_DIR}/gaming.sh" +[ -f "${MODULES_DIR}/extras.sh" ] && source "${MODULES_DIR}/extras.sh" +[ -f "${MODULES_DIR}/zram.sh" ] && source "${MODULES_DIR}/zram.sh" [ -f "${MODULES_DIR}/extras/java.sh" ] && source "${MODULES_DIR}/extras/java.sh" -[ -f "${MODULES_DIR}/rescue.sh" ] && source "${MODULES_DIR}/rescue.sh" -[ -f "${MODULES_DIR}/swap.sh" ] && source "${MODULES_DIR}/swap.sh" +[ -f "${MODULES_DIR}/rescue.sh" ] && source "${MODULES_DIR}/rescue.sh" +[ -f "${MODULES_DIR}/swap.sh" ] && source "${MODULES_DIR}/swap.sh" [ -f "${MODULES_DIR}/desktop_display.sh" ] && source "${MODULES_DIR}/desktop_display.sh" [ -f "${MODULES_DIR}/system/system_prefs.sh" ] && source "${MODULES_DIR}/system/system_prefs.sh" [ -f "${MODULES_DIR}/system/audio.sh" ] && source "${MODULES_DIR}/system/audio.sh" @@ -38,19 +38,18 @@ source "${MODULES_DIR}/repos.sh" # ── Bullseye-specific modules (loaded only on Debian 11) ── if [ -d "${MODULES_DIR}/bullseye" ]; then [ -f "${MODULES_DIR}/bullseye/legacy.sh" ] && source "${MODULES_DIR}/bullseye/legacy.sh" - [ -f "${MODULES_DIR}/bullseye/repos.sh" ] && source "${MODULES_DIR}/bullseye/repos.sh" + [ -f "${MODULES_DIR}/bullseye/repos.sh" ] && source "${MODULES_DIR}/bullseye/repos.sh" [ -f "${MODULES_DIR}/bullseye/extras.sh" ] && source "${MODULES_DIR}/bullseye/extras.sh" fi -REPOS_CONFIGURED=false DEBIAN_VERSION="" DEBIAN_CODENAME="" main_menu() { # Auto-adjust TUI dimensions for small terminals if [ "${LINES:-24}" -lt $((TUI_ALTO + 6)) ] || [ "${COLUMNS:-80}" -lt $((TUI_ANCHO + 6)) ]; then - TUI_ALTO=$(( ${LINES:-24} - 4 > 8 ? ${LINES:-24} - 4 : 8)) - TUI_ANCHO=$(( ${COLUMNS:-80} - 4 > 50 ? ${COLUMNS:-80} - 4 : 50)) + TUI_ALTO=$((${LINES:-24} - 4 > 8 ? ${LINES:-24} - 4 : 8)) + TUI_ANCHO=$((${COLUMNS:-80} - 4 > 50 ? ${COLUMNS:-80} - 4 : 50)) TUI_ALTO_LISTA=$((TUI_ALTO - 10 > 4 ? TUI_ALTO - 10 : 4)) fi @@ -78,58 +77,81 @@ main_menu() { clear case "$choice" in - 1) _show_sysinfo ;; - 2) config_sudo || true ;; - 3) _system_preferences_menu ;; - 4) - if [ "$DEBIAN_VERSION" = "11" ] && type configure_repos_bullseye &>/dev/null; then - configure_repos_bullseye || true - else - configure_repos || true - fi - STATE_REFRESHED=true - ;; - 5) - if [ "$DEBIAN_VERSION" = "11" ] && type install_firmware_bullseye &>/dev/null; then - install_firmware_bullseye || true - else - install_firmware || true - fi - ;; - 6) - local gpu_sub - gpu_sub=$(_menu "Graphics Drivers" "" 12 50 2 \ - "1" "Radeon/Intel Mesa" \ - "2" "NVIDIA Drivers") - [ -z "$gpu_sub" ] && continue - clear - case $gpu_sub in - 1) _install_amd_intel_stack || true ;; - 2) _install_nvidia_stack || true ;; - esac - STATE_REFRESHED=true - ;; - 7) show_kernel_menu || true ;; - 8) - if [ "$DEBIAN_VERSION" = "11" ] && type install_gaming_bullseye &>/dev/null; then - install_gaming_bullseye || true - else - install_gaming || true - fi - STATE_REFRESHED=true - ;; - 9) zram_menu || true ;; - 10) manage_swap || true; STATE_REFRESHED=true ;; - 11) - if [ "$DEBIAN_VERSION" = "11" ] && type install_extras_bullseye &>/dev/null; then - install_extras_bullseye || true - else - install_extras || true - fi - ;; - 12) rescue_boot || true ;; - 13) manage_desktop_display || true ;; - 14) echo "Exiting."; exit 0 ;; + 1) _show_sysinfo ;; + 2) config_sudo || true ;; + 3) + _system_preferences_menu + STATE_REFRESHED=true + ;; + 4) + if [ "$DEBIAN_VERSION" = "11" ] && type configure_repos_bullseye &>/dev/null; then + configure_repos_bullseye || true + else + configure_repos || true + fi + STATE_REFRESHED=true + ;; + 5) + if [ "$DEBIAN_VERSION" = "11" ] && type install_firmware_bullseye &>/dev/null; then + install_firmware_bullseye || true + else + install_firmware || true + fi + STATE_REFRESHED=true + ;; + 6) + local gpu_sub + gpu_sub=$(_menu "Graphics Drivers" "" 12 50 2 \ + "1" "Radeon/Intel Mesa" \ + "2" "NVIDIA Drivers") + [ -z "$gpu_sub" ] && continue + clear + case $gpu_sub in + 1) _install_amd_intel_stack || true ;; + 2) _install_nvidia_stack || true ;; + esac + STATE_REFRESHED=true + ;; + 7) + show_kernel_menu || true + STATE_REFRESHED=true + ;; + 8) + if [ "$DEBIAN_VERSION" = "11" ] && type install_gaming_bullseye &>/dev/null; then + install_gaming_bullseye || true + else + install_gaming || true + fi + STATE_REFRESHED=true + ;; + 9) + zram_menu || true + STATE_REFRESHED=true + ;; + 10) + manage_swap || true + STATE_REFRESHED=true + ;; + 11) + if [ "$DEBIAN_VERSION" = "11" ] && type install_extras_bullseye &>/dev/null; then + install_extras_bullseye || true + else + install_extras || true + fi + STATE_REFRESHED=true + ;; + 12) + rescue_boot || true + STATE_REFRESHED=true + ;; + 13) + manage_desktop_display || true + STATE_REFRESHED=true + ;; + 14) + echo "Exiting." + exit 0 + ;; esac if $STATE_REFRESHED; then refresh_system_state @@ -139,6 +161,10 @@ main_menu() { check_root check_sudo +if ! command -v whiptail >/dev/null 2>&1; then + echo -e "${YELLOW}[+] whiptail not found. Installing required TUI dependencies...${NC}" + _ensure_apt_updated && sudo apt-get install -y whiptail +fi if ! _check_network; then echo -e "${YELLOW}──────────────────────────────────────────${NC}" echo -e "${YELLOW} No internet connectivity detected.${NC}" @@ -152,6 +178,7 @@ _ensure_time_synced detect_debian_version detect_cpu_ram detect_kernel +_init_lspci_cache detect_gpu detect_network detect_displayserver diff --git a/modules/bullseye/extras.sh b/modules/bullseye/extras.sh index 39efd96..b4cc8bf 100644 --- a/modules/bullseye/extras.sh +++ b/modules/bullseye/extras.sh @@ -61,20 +61,21 @@ Instalar?"; then _cat_customization_bullseye() { local sub - sub=$(_menu "Customization (Bullseye)" "Select type:" $TUI_ALTO $TUI_ANCHO $TUI_ALTO_LISTA \ - "1" "Desktop Themes (GTK/KDE)" \ - "2" "Icon Themes" \ - "3" "Cursor Themes" \ - "4" "Fonts" \ - "5" "Terminals" \ - ) + sub=$( + _menu "Customization (Bullseye)" "Select type:" $TUI_ALTO $TUI_ANCHO $TUI_ALTO_LISTA \ + "1" "Desktop Themes (GTK/KDE)" \ + "2" "Icon Themes" \ + "3" "Cursor Themes" \ + "4" "Fonts" \ + "5" "Terminals" + ) [ -z "$sub" ] && return case $sub in - 1) _cat_themes_bullseye ;; - 2) _cat_icons_bullseye ;; - 3) _cat_cursors_bullseye ;; - 4) _cat_fonts_bullseye ;; - 5) _cat_terminals ;; + 1) _cat_themes_bullseye ;; + 2) _cat_icons_bullseye ;; + 3) _cat_cursors_bullseye ;; + 4) _cat_fonts_bullseye ;; + 5) _cat_terminals ;; esac } @@ -82,17 +83,19 @@ _cat_themes_bullseye() { local item_count=6 local lista_alto=$((item_count > TUI_ALTO_LISTA ? TUI_ALTO_LISTA : item_count)) local choices - choices=$(_checklist "Desktop Themes (Bullseye)" "Check [*] the packages you want installed/updated on your system.\n" $TUI_ALTO $TUI_ANCHO $lista_alto \ - "arc-theme" "Arc GTK theme" "$(_state arc-theme)" \ - "blackbird-gtk-theme" "Blackbird GTK theme" "$(_state blackbird-gtk-theme)" \ - "bluebird-gtk-theme" "Bluebird GTK theme" "$(_state bluebird-gtk-theme)" \ - "breeze-gtk-theme" "Breeze GTK theme (KDE port)" "$(_state breeze-gtk-theme)" \ - "greybird-gtk-theme" "Greybird GTK theme" "$(_state greybird-gtk-theme)" \ - "numix-gtk-theme" "Numix GTK theme" "$(_state numix-gtk-theme)" \ - ) + choices=$( + _checklist "Desktop Themes (Bullseye)" "Check [*] the packages you want installed/updated on your system.\n" $TUI_ALTO $TUI_ANCHO $lista_alto \ + "arc-theme" "Arc GTK theme" "$(_state arc-theme)" \ + "blackbird-gtk-theme" "Blackbird GTK theme" "$(_state blackbird-gtk-theme)" \ + "bluebird-gtk-theme" "Bluebird GTK theme" "$(_state bluebird-gtk-theme)" \ + "breeze-gtk-theme" "Breeze GTK theme (KDE port)" "$(_state breeze-gtk-theme)" \ + "greybird-gtk-theme" "Greybird GTK theme" "$(_state greybird-gtk-theme)" \ + "numix-gtk-theme" "Numix GTK theme" "$(_state numix-gtk-theme)" + ) clear [ -z "$choices" ] && return - local cleaned; cleaned=$(echo "$choices" | tr -d '"') + local cleaned + cleaned=$(echo "$choices" | tr -d '"') for pkg in $cleaned; do ! is_installed "$pkg" && _run_install "$pkg" || echo "$pkg already installed." done @@ -101,24 +104,25 @@ _cat_themes_bullseye() { _cat_icons_bullseye() { local items=( - "breeze-icon-theme" "Breeze icon theme" "$(_state breeze-icon-theme)" - "deepin-icon-theme" "Deepin icon theme" "$(_state deepin-icon-theme)" - "moka-icon-theme" "Moka icon theme" "$(_state moka-icon-theme)" - "numix-icon-theme" "Numix icon theme" "$(_state numix-icon-theme)" - "numix-icon-theme-circle" "Numix Circle icon theme" "$(_state numix-icon-theme-circle)" - "obsidian-icon-theme" "Obsidian icon theme" "$(_state obsidian-icon-theme)" - "papirus-icon-theme" "Papirus icon theme" "$(_state papirus-icon-theme)" - "paper-icon-theme" "Paper icon theme" "$(_state paper-icon-theme)" - "suru-icon-theme" "Suru icon theme" "$(_state suru-icon-theme)" + "breeze-icon-theme" "Breeze icon theme" "$(_state breeze-icon-theme)" + "deepin-icon-theme" "Deepin icon theme" "$(_state deepin-icon-theme)" + "moka-icon-theme" "Moka icon theme" "$(_state moka-icon-theme)" + "numix-icon-theme" "Numix icon theme" "$(_state numix-icon-theme)" + "numix-icon-theme-circle" "Numix Circle icon theme" "$(_state numix-icon-theme-circle)" + "obsidian-icon-theme" "Obsidian icon theme" "$(_state obsidian-icon-theme)" + "papirus-icon-theme" "Papirus icon theme" "$(_state papirus-icon-theme)" + "paper-icon-theme" "Paper icon theme" "$(_state paper-icon-theme)" + "suru-icon-theme" "Suru icon theme" "$(_state suru-icon-theme)" ) local item_count=${#items[@]} local lista_alto=$((item_count > TUI_ALTO_LISTA ? TUI_ALTO_LISTA : item_count)) local choices choices=$(_checklist "Icon Themes (Bullseye)" "Check [*] the packages you want installed/updated on your system.\n" $TUI_ALTO $TUI_ANCHO $lista_alto \ - "${items[@]}" ) + "${items[@]}") clear [ -z "$choices" ] && return - local cleaned; cleaned=$(echo "$choices" | tr -d '"') + local cleaned + cleaned=$(echo "$choices" | tr -d '"') for pkg in $cleaned; do ! is_installed "$pkg" && _run_install "$pkg" || echo "$pkg already installed." done @@ -129,16 +133,18 @@ _cat_cursors_bullseye() { local item_count=5 local lista_alto=$((item_count > TUI_ALTO_LISTA ? TUI_ALTO_LISTA : item_count)) local choices - choices=$(_checklist "Cursor Themes (Bullseye)" "Check [*] the packages you want installed/updated on your system.\n" $TUI_ALTO $TUI_ANCHO $lista_alto \ - "breeze-cursor-theme" "Breeze cursors (KDE)" "$(_state breeze-cursor-theme)" \ - "chameleon-cursor-theme" "Chameleon cursors" "$(_state chameleon-cursor-theme)" \ - "dmz-cursor-theme" "DMZ cursors" "$(_state dmz-cursor-theme)" \ - "oxygencursors" "Oxygen cursors (KDE legacy)" "$(_state oxygencursors)" \ - "xcursor-themes" "X11 base cursors" "$(_state xcursor-themes)" \ - ) + choices=$( + _checklist "Cursor Themes (Bullseye)" "Check [*] the packages you want installed/updated on your system.\n" $TUI_ALTO $TUI_ANCHO $lista_alto \ + "breeze-cursor-theme" "Breeze cursors (KDE)" "$(_state breeze-cursor-theme)" \ + "chameleon-cursor-theme" "Chameleon cursors" "$(_state chameleon-cursor-theme)" \ + "dmz-cursor-theme" "DMZ cursors" "$(_state dmz-cursor-theme)" \ + "oxygencursors" "Oxygen cursors (KDE legacy)" "$(_state oxygencursors)" \ + "xcursor-themes" "X11 base cursors" "$(_state xcursor-themes)" + ) clear [ -z "$choices" ] && return - local cleaned; cleaned=$(echo "$choices" | tr -d '"') + local cleaned + cleaned=$(echo "$choices" | tr -d '"') for pkg in $cleaned; do ! is_installed "$pkg" && _run_install "$pkg" || echo "$pkg already installed." done @@ -149,15 +155,17 @@ _cat_fonts_bullseye() { local item_count=4 local lista_alto=$((item_count > TUI_ALTO_LISTA ? TUI_ALTO_LISTA : item_count)) local choices - choices=$(_checklist "Fonts (Bullseye)" "Check [*] the packages you want installed/updated on your system.\n" $TUI_ALTO $TUI_ANCHO $lista_alto \ - "fonts-firacode" "Fira Code monospace font" "$(_state fonts-firacode)" \ - "fonts-noto" "Noto fonts (Google)" "$(_state fonts-noto)" \ - "fonts-dejavu-core" "DejaVu core fonts" "$(_state fonts-dejavu-core)" \ - "ttf-mscorefonts-installer" "Microsoft Core Fonts" "$(_state ttf-mscorefonts-installer)" \ - ) + choices=$( + _checklist "Fonts (Bullseye)" "Check [*] the packages you want installed/updated on your system.\n" $TUI_ALTO $TUI_ANCHO $lista_alto \ + "fonts-firacode" "Fira Code monospace font" "$(_state fonts-firacode)" \ + "fonts-noto" "Noto fonts (Google)" "$(_state fonts-noto)" \ + "fonts-dejavu-core" "DejaVu core fonts" "$(_state fonts-dejavu-core)" \ + "ttf-mscorefonts-installer" "Microsoft Core Fonts" "$(_state ttf-mscorefonts-installer)" + ) clear [ -z "$choices" ] && return - local cleaned; cleaned=$(echo "$choices" | tr -d '"') + local cleaned + cleaned=$(echo "$choices" | tr -d '"') for pkg in $cleaned; do ! is_installed "$pkg" && _run_install "$pkg" || echo "$pkg already installed." done @@ -169,29 +177,34 @@ _cat_download_bullseye() { local item_count1=2 local lista_alto1=$((item_count1 > TUI_ALTO_LISTA ? TUI_ALTO_LISTA : item_count1)) - choices1=$(_checklist "Downloaders" "Check [*] the packages you want installed/updated on your system.\n" $TUI_ALTO $TUI_ANCHO $lista_alto1 \ - "aria2" "Multiprotocol downloader (CLI)" "$(_state aria2)" \ - "filezilla" "FTP/SFTP client (GUI)" "$(_state filezilla)" \ - ) + choices1=$( + _checklist "Downloaders" "Check [*] the packages you want installed/updated on your system.\n" $TUI_ALTO $TUI_ANCHO $lista_alto1 \ + "aria2" "Multiprotocol downloader (CLI)" "$(_state aria2)" \ + "filezilla" "FTP/SFTP client (GUI)" "$(_state filezilla)" + ) clear local item_count2=8 local lista_alto2=$((item_count2 > TUI_ALTO_LISTA ? TUI_ALTO_LISTA : item_count2)) - choices2=$(_checklist "Torrent Clients" "Check [*] the packages you want installed/updated on your system.\n" $TUI_ALTO $TUI_ANCHO $lista_alto2 \ - "deluge" "BitTorrent client (GTK)" "$(_state deluge)" \ - "deluged" "BitTorrent daemon/server" "$(_state deluged)" \ - "mktorrent" "Torrent metainfo creator (CLI)" "$(_state mktorrent)" \ - "qbittorrent" "BitTorrent client (Qt)" "$(_state qbittorrent)" \ - "qbittorrent-nox" "BitTorrent WebUI/CLI" "$(_state qbittorrent-nox)" \ - "transmission-cli" "BitTorrent client (CLI)" "$(_state transmission-cli)" \ - "transmission-gtk" "BitTorrent client (GTK)" "$(_state transmission-gtk)" \ - "transmission-qt" "BitTorrent client (Qt)" "$(_state transmission-qt)" \ - ) + choices2=$( + _checklist "Torrent Clients" "Check [*] the packages you want installed/updated on your system.\n" $TUI_ALTO $TUI_ANCHO $lista_alto2 \ + "deluge" "BitTorrent client (GTK)" "$(_state deluge)" \ + "deluged" "BitTorrent daemon/server" "$(_state deluged)" \ + "mktorrent" "Torrent metainfo creator (CLI)" "$(_state mktorrent)" \ + "qbittorrent" "BitTorrent client (Qt)" "$(_state qbittorrent)" \ + "qbittorrent-nox" "BitTorrent WebUI/CLI" "$(_state qbittorrent-nox)" \ + "transmission-cli" "BitTorrent client (CLI)" "$(_state transmission-cli)" \ + "transmission-gtk" "BitTorrent client (GTK)" "$(_state transmission-gtk)" \ + "transmission-qt" "BitTorrent client (Qt)" "$(_state transmission-qt)" + ) clear local cleaned cleaned=$(echo "$choices1 $choices2" | tr -d '"') - [ -z "$cleaned" ] && { echo "No download tools selected."; return; } + [ -z "$cleaned" ] && { + echo "No download tools selected." + return + } for pkg in $cleaned; do if ! is_installed "$pkg"; then @@ -207,39 +220,41 @@ _cat_internet_bullseye() { local item_count=11 local lista_alto=$((item_count > TUI_ALTO_LISTA ? TUI_ALTO_LISTA : item_count)) local choices - choices=$(_checklist "Internet (Bullseye)" "Check [*] the packages you want installed/updated on your system.\n" $TUI_ALTO $TUI_ANCHO $lista_alto \ - "chromium" "Chromium web browser" "$(_state chromium)" \ - "dillo" "Lightweight graphical browser" "$(_state dillo)" \ - "elinks" "Text-mode web browser" "$(_state elinks)" \ - "epiphany-browser" "GNOME web browser" "$(_state epiphany-browser)" \ - "falkon" "KDE web browser (QtWebEngine)" "$(_state falkon)" \ - "firefox-esr" "Firefox ESR (official Debian)" "$(_state firefox-esr)" \ - "konqueror" "KDE file manager / web browser" "$(_state konqueror)" \ - "qutebrowser" "Keyboard-driven browser (Qt)" "$(_state qutebrowser)" \ - "thunderbird" "Email client" "$(_state thunderbird)" \ - "torbrowser-launcher" "Tor Browser launcher" "$(_state torbrowser-launcher)" \ - "w3m" "Text-mode browser + deps" "$(_state w3m)" \ - ) + choices=$( + _checklist "Internet (Bullseye)" "Check [*] the packages you want installed/updated on your system.\n" $TUI_ALTO $TUI_ANCHO $lista_alto \ + "chromium" "Chromium web browser" "$(_state chromium)" \ + "dillo" "Lightweight graphical browser" "$(_state dillo)" \ + "elinks" "Text-mode web browser" "$(_state elinks)" \ + "epiphany-browser" "GNOME web browser" "$(_state epiphany-browser)" \ + "falkon" "KDE web browser (QtWebEngine)" "$(_state falkon)" \ + "firefox-esr" "Firefox ESR (official Debian)" "$(_state firefox-esr)" \ + "konqueror" "KDE file manager / web browser" "$(_state konqueror)" \ + "qutebrowser" "Keyboard-driven browser (Qt)" "$(_state qutebrowser)" \ + "thunderbird" "Email client" "$(_state thunderbird)" \ + "torbrowser-launcher" "Tor Browser launcher" "$(_state torbrowser-launcher)" \ + "w3m" "Text-mode browser + deps" "$(_state w3m)" + ) clear [ -z "$choices" ] && return - local cleaned; cleaned=$(echo "$choices" | tr -d '"') + local cleaned + cleaned=$(echo "$choices" | tr -d '"') for pkg in $cleaned; do case $pkg in - w3m) - local need=() - ! is_installed "w3m" && need+=("w3m") - ! is_installed "w3m-img" && need+=("w3m-img") - ! is_installed "ca-certificates" && need+=("ca-certificates") - ! is_installed "xsel" && need+=("xsel") - [ ${#need[@]} -gt 0 ] && _run_install_batch "${need[@]}" || echo "Already installed." - ;; - *) - if ! is_installed "$pkg"; then - _run_install "$pkg" - else - echo "$pkg already installed." - fi - ;; + w3m) + local need=() + ! is_installed "w3m" && need+=("w3m") + ! is_installed "w3m-img" && need+=("w3m-img") + ! is_installed "ca-certificates" && need+=("ca-certificates") + ! is_installed "xsel" && need+=("xsel") + [ ${#need[@]} -gt 0 ] && _run_install_batch "${need[@]}" || echo "Already installed." + ;; + *) + if ! is_installed "$pkg"; then + _run_install "$pkg" + else + echo "$pkg already installed." + fi + ;; esac done echo -e "${GREEN}Internet tools installed.${NC}" @@ -249,13 +264,15 @@ _cat_players_bullseye() { local item_count=2 local lista_alto=$((item_count > TUI_ALTO_LISTA ? TUI_ALTO_LISTA : item_count)) local choices - choices=$(_checklist "Media Players (Bullseye)" "Check [*] the packages you want installed/updated on your system.\n" $TUI_ALTO $TUI_ANCHO $lista_alto \ - "mpv" "Lightweight media player" "$(_state mpv)" \ - "vlc" "VLC media player" "$(_state vlc)" \ - ) + choices=$( + _checklist "Media Players (Bullseye)" "Check [*] the packages you want installed/updated on your system.\n" $TUI_ALTO $TUI_ANCHO $lista_alto \ + "mpv" "Lightweight media player" "$(_state mpv)" \ + "vlc" "VLC media player" "$(_state vlc)" + ) clear [ -z "$choices" ] && return - local cleaned; cleaned=$(echo "$choices" | tr -d '"') + local cleaned + cleaned=$(echo "$choices" | tr -d '"') for pkg in $cleaned; do if ! is_installed "$pkg"; then _run_install "$pkg" @@ -270,24 +287,26 @@ _cat_design_bullseye() { local item_count=13 local lista_alto=$((item_count > TUI_ALTO_LISTA ? TUI_ALTO_LISTA : item_count)) local choices - choices=$(_checklist "Multimedia & Design (Bullseye)" "Check [*] the packages you want installed/updated on your system.\n" $TUI_ALTO $TUI_ANCHO $lista_alto \ - "ardour" "Digital audio workstation" "$(_state ardour)" \ - "audacity" "Audio editor/recorder" "$(_state audacity)" \ - "blender" "3D modeling/animation suite" "$(_state blender)" \ - "ffmpeg" "Multimedia framework (CLI)" "$(_state ffmpeg)" \ - "gimp" "Image editor" "$(_state gimp)" \ - "handbrake" "Video transcoder (DVD ripper)" "$(_state handbrake)" \ - "inkscape" "Vector graphics editor" "$(_state inkscape)" \ - "kdenlive" "Video editor (KDE)" "$(_state kdenlive)" \ - "krita" "Digital painting/illustration" "$(_state krita)" \ - "obs-studio" "Screen recording/streaming" "$(_state obs-studio)" \ - "openshot-qt" "Video editor (simple)" "$(_state openshot-qt)" \ - "scribus" "Desktop publishing (DTP)" "$(_state scribus)" \ - "shotcut" "Video editor (cross-platform)" "$(_state shotcut)" \ - ) + choices=$( + _checklist "Multimedia & Design (Bullseye)" "Check [*] the packages you want installed/updated on your system.\n" $TUI_ALTO $TUI_ANCHO $lista_alto \ + "ardour" "Digital audio workstation" "$(_state ardour)" \ + "audacity" "Audio editor/recorder" "$(_state audacity)" \ + "blender" "3D modeling/animation suite" "$(_state blender)" \ + "ffmpeg" "Multimedia framework (CLI)" "$(_state ffmpeg)" \ + "gimp" "Image editor" "$(_state gimp)" \ + "handbrake" "Video transcoder (DVD ripper)" "$(_state handbrake)" \ + "inkscape" "Vector graphics editor" "$(_state inkscape)" \ + "kdenlive" "Video editor (KDE)" "$(_state kdenlive)" \ + "krita" "Digital painting/illustration" "$(_state krita)" \ + "obs-studio" "Screen recording/streaming" "$(_state obs-studio)" \ + "openshot-qt" "Video editor (simple)" "$(_state openshot-qt)" \ + "scribus" "Desktop publishing (DTP)" "$(_state scribus)" \ + "shotcut" "Video editor (cross-platform)" "$(_state shotcut)" + ) clear [ -z "$choices" ] && return - local cleaned; cleaned=$(echo "$choices" | tr -d '"') + local cleaned + cleaned=$(echo "$choices" | tr -d '"') for pkg in $cleaned; do if ! is_installed "$pkg"; then _run_install "$pkg" @@ -302,20 +321,22 @@ _cat_programming_bullseye() { local item_count=9 local lista_alto=$((item_count > TUI_ALTO_LISTA ? TUI_ALTO_LISTA : item_count)) local choices - choices=$(_checklist "Code Editors & IDEs (Bullseye)" "Check [*] the packages you want installed/updated on your system.\n" $TUI_ALTO $TUI_ANCHO $lista_alto \ - "vim" "Classic terminal editor" "$(_state vim)" \ - "vim-gtk3" "Vim with GTK3 GUI" "$(_state vim-gtk3)" \ - "neovim" "Modern vim fork" "$(_state neovim)" \ - "nano" "Simple terminal editor" "$(_state nano)" \ - "emacs" "Extensible editor / IDE" "$(_state emacs)" \ - "kate" "KDE advanced text editor" "$(_state kate)" \ - "mousepad" "Xfce text editor" "$(_state mousepad)" \ - "gedit" "GNOME text editor" "$(_state gedit)" \ - "geany" "Lightweight IDE" "$(_state geany)" \ - ) + choices=$( + _checklist "Code Editors & IDEs (Bullseye)" "Check [*] the packages you want installed/updated on your system.\n" $TUI_ALTO $TUI_ANCHO $lista_alto \ + "vim" "Classic terminal editor" "$(_state vim)" \ + "vim-gtk3" "Vim with GTK3 GUI" "$(_state vim-gtk3)" \ + "neovim" "Modern vim fork" "$(_state neovim)" \ + "nano" "Simple terminal editor" "$(_state nano)" \ + "emacs" "Extensible editor / IDE" "$(_state emacs)" \ + "kate" "KDE advanced text editor" "$(_state kate)" \ + "mousepad" "Xfce text editor" "$(_state mousepad)" \ + "gedit" "GNOME text editor" "$(_state gedit)" \ + "geany" "Lightweight IDE" "$(_state geany)" + ) clear [ -z "$choices" ] && return - local cleaned; cleaned=$(echo "$choices" | tr -d '"') + local cleaned + cleaned=$(echo "$choices" | tr -d '"') for pkg in $cleaned; do if ! is_installed "$pkg"; then _run_install "$pkg" @@ -330,62 +351,64 @@ _cat_dev_bullseye() { local item_count=14 local lista_alto=$((item_count > TUI_ALTO_LISTA ? TUI_ALTO_LISTA : item_count)) local choices - choices=$(_checklist "Servers & Dev Tools (Bullseye)" "Check [*] the packages you want installed/updated on your system.\n" $TUI_ALTO $TUI_ANCHO $lista_alto \ - "apache2" "Apache web server" "$(_state apache2)" \ - "build-essential" "C/C++ build tools (gcc, make)" "$(_state build-essential)" \ - "docker" "Docker container runtime" "$(_state docker.io)" \ - "mariadb-server" "MariaDB database server" "$(_state mariadb-server)" \ - "netcat-openbsd" "TCP/IP networking utility" "$(_state netcat-openbsd)" \ - "nginx" "Nginx web server" "$(_state nginx)" \ - "openssh-server" "SSH server" "$(_state openssh-server)" \ - "openssl" "OpenSSL cryptography toolkit" "$(_state openssl)" \ - "postgresql" "PostgreSQL database server" "$(_state postgresql)" \ - "python3-pip" "Python 3 pip + venv + dev" "$(_state python3-pip)" \ - "redis-server" "Redis key-value store" "$(_state redis-server)" \ - "sqlite3" "SQLite database engine" "$(_state sqlite3)" \ - "jellyfin" "Jellyfin Media Server (Web GUI on port 8096)" OFF \ - "openjdk-dev-env" "Adoptium Temurin JDK (17, 21, 25 LTS)$(_any_jdk_installed_desc)" "$(_any_jdk_state)" \ - ) + choices=$( + _checklist "Servers & Dev Tools (Bullseye)" "Check [*] the packages you want installed/updated on your system.\n" $TUI_ALTO $TUI_ANCHO $lista_alto \ + "apache2" "Apache web server" "$(_state apache2)" \ + "build-essential" "C/C++ build tools (gcc, make)" "$(_state build-essential)" \ + "docker" "Docker container runtime" "$(_state docker.io)" \ + "mariadb-server" "MariaDB database server" "$(_state mariadb-server)" \ + "netcat-openbsd" "TCP/IP networking utility" "$(_state netcat-openbsd)" \ + "nginx" "Nginx web server" "$(_state nginx)" \ + "openssh-server" "SSH server" "$(_state openssh-server)" \ + "openssl" "OpenSSL cryptography toolkit" "$(_state openssl)" \ + "postgresql" "PostgreSQL database server" "$(_state postgresql)" \ + "python3-pip" "Python 3 pip + venv + dev" "$(_state python3-pip)" \ + "redis-server" "Redis key-value store" "$(_state redis-server)" \ + "sqlite3" "SQLite database engine" "$(_state sqlite3)" \ + "jellyfin" "Jellyfin Media Server (Web GUI on port 8096)" OFF \ + "openjdk-dev-env" "Adoptium Temurin JDK (17, 21, 25 LTS)$(_any_jdk_installed_desc)" "$(_any_jdk_state)" + ) clear [ -z "$choices" ] && return - local cleaned; cleaned=$(echo "$choices" | tr -d '"') + local cleaned + cleaned=$(echo "$choices" | tr -d '"') for pkg in $cleaned; do case $pkg in - docker) - local need=() - ! is_installed "docker.io" && need+=("docker.io") - ! is_installed "docker-compose" && need+=("docker-compose") - if [ ${#need[@]} -gt 0 ]; then - _run_install_batch "${need[@]}" - else - echo "Docker already installed." - fi - ;; - python3-pip) - local need=() - ! is_installed "python3-pip" && need+=("python3-pip") - ! is_installed "python3-venv" && need+=("python3-venv") - ! is_installed "python3-dev" && need+=("python3-dev") - if [ ${#need[@]} -gt 0 ]; then - _run_install_batch "${need[@]}" - else - echo "Python 3 tools already installed." - fi - ;; - jellyfin) - install_jellyfin - ;; - openjdk-dev-env) - _install_dev_java - ;; + docker) + local need=() + ! is_installed "docker.io" && need+=("docker.io") + ! is_installed "docker-compose" && need+=("docker-compose") + if [ ${#need[@]} -gt 0 ]; then + _run_install_batch "${need[@]}" + else + echo "Docker already installed." + fi + ;; + python3-pip) + local need=() + ! is_installed "python3-pip" && need+=("python3-pip") + ! is_installed "python3-venv" && need+=("python3-venv") + ! is_installed "python3-dev" && need+=("python3-dev") + if [ ${#need[@]} -gt 0 ]; then + _run_install_batch "${need[@]}" + else + echo "Python 3 tools already installed." + fi + ;; + jellyfin) + install_jellyfin + ;; + openjdk-dev-env) + _install_dev_java + ;; - *) - if ! is_installed "$pkg"; then - _run_install "$pkg" - else - echo "$pkg already installed." - fi - ;; + *) + if ! is_installed "$pkg"; then + _run_install "$pkg" + else + echo "$pkg already installed." + fi + ;; esac done echo -e "${GREEN}Servers & dev tools installed.${NC}" @@ -394,28 +417,30 @@ _cat_security_bullseye() { local item_count=5 local lista_alto=$((item_count > TUI_ALTO_LISTA ? TUI_ALTO_LISTA : item_count)) local choices - choices=$(_checklist "Security & Networking (Bullseye)" "Check [*] the packages you want installed/updated on your system.\n" $TUI_ALTO $TUI_ANCHO $lista_alto \ - "wireshark" "Network protocol analyzer (GUI)" "$(_state wireshark)" \ - "tcpdump" "Command-line packet analyzer" "$(_state tcpdump)" \ - "fail2ban" "Brute-force protection daemon" "$(_state fail2ban)" \ - "ufw" "Uncomplicated firewall" "$(_state ufw)" \ - "clamav" "Antivirus engine (ClamAV)" "$(_state clamav)" \ - ) + choices=$( + _checklist "Security & Networking (Bullseye)" "Check [*] the packages you want installed/updated on your system.\n" $TUI_ALTO $TUI_ANCHO $lista_alto \ + "wireshark" "Network protocol analyzer (GUI)" "$(_state wireshark)" \ + "tcpdump" "Command-line packet analyzer" "$(_state tcpdump)" \ + "fail2ban" "Brute-force protection daemon" "$(_state fail2ban)" \ + "ufw" "Uncomplicated firewall" "$(_state ufw)" \ + "clamav" "Antivirus engine (ClamAV)" "$(_state clamav)" + ) clear [ -z "$choices" ] && return - local cleaned; cleaned=$(echo "$choices" | tr -d '"') + local cleaned + cleaned=$(echo "$choices" | tr -d '"') for pkg in $cleaned; do case $pkg in - clamav) - _install_clamav - ;; - *) - if ! is_installed "$pkg"; then - _run_install "$pkg" - else - echo "$pkg already installed." - fi - ;; + clamav) + _install_clamav + ;; + *) + if ! is_installed "$pkg"; then + _run_install "$pkg" + else + echo "$pkg already installed." + fi + ;; esac done echo -e "${GREEN}Security & networking tools installed.${NC}" @@ -425,104 +450,106 @@ _cat_general_bullseye() { local item_count=22 local lista_alto=$((item_count > TUI_ALTO_LISTA ? TUI_ALTO_LISTA : item_count)) local choices - choices=$(_checklist "System Tools (Bullseye)" "Check [*] the packages you want installed/updated on your system.\n" $TUI_ALTO $TUI_ANCHO $lista_alto \ - "compress" "Compression tools (zip, unrar, p7zip)" "$(_state zip)" \ - "conky" "System monitor for desktop" "$(_state conky)" \ - "cpu-x" "CPU-X (alternative to CPU-Z)" "$(_state cpu-x)" \ - "curl-wget" "HTTP transfer tools (curl, wget)" "$(_state curl)" \ - "flatpak" "Flatpak sandbox (Bullseye native)" "$(_state flatpak)" \ - "fwupd" "Firmware update daemon" "$(_state fwupd)" \ - "gnome-disk-utility" "Disk management GUI" "$(_state gnome-disk-utility)" \ - "gparted" "Partition editor" "$(_state gparted)" \ - "htop" "Interactive process viewer" "$(_state htop)" \ - "inxi" "System information tool" "$(_state inxi)" \ - "jq" "JSON command-line processor" "$(_state jq)" \ - "kvm" "QEMU/KVM virtualization" "$(_state virt-manager)" \ - "lshw" "List hardware details" "$(_state lshw)" \ - "mc" "Midnight Commander" "$(_state mc)" \ - "nvme-cli" "NVMe SSD health monitoring" "$(_state nvme-cli)" \ - "ncdu" "Disk usage analyzer" "$(_state ncdu)" \ - "psensor" "Temperature monitor" "$(_state psensor)" \ - "timeshift" "System restore snapshots" "$(_state timeshift)" \ - "tmux" "Terminal multiplexer" "$(_state tmux)" \ - "wine" "Windows compatibility layer" "$(_state wine)" \ - "bleachbit" "System cleaner (GUI)" "$(_state bleachbit)" \ - "gdebi" "Install .deb packages with deps (GUI)" "$(_state gdebi)" \ - ) + choices=$( + _checklist "System Tools (Bullseye)" "Check [*] the packages you want installed/updated on your system.\n" $TUI_ALTO $TUI_ANCHO $lista_alto \ + "compress" "Compression tools (zip, unrar, p7zip)" "$(_state zip)" \ + "conky-all" "System monitor for desktop" "$(_state conky-all)" \ + "cpu-x" "CPU-X (alternative to CPU-Z)" "$(_state cpu-x)" \ + "curl-wget" "HTTP transfer tools (curl, wget)" "$(_state curl)" \ + "flatpak" "Flatpak sandbox (Bullseye native)" "$(_state flatpak)" \ + "fwupd" "Firmware update daemon" "$(_state fwupd)" \ + "gnome-disk-utility" "Disk management GUI" "$(_state gnome-disk-utility)" \ + "gparted" "Partition editor" "$(_state gparted)" \ + "htop" "Interactive process viewer" "$(_state htop)" \ + "inxi" "System information tool" "$(_state inxi)" \ + "jq" "JSON command-line processor" "$(_state jq)" \ + "kvm" "QEMU/KVM virtualization" "$(_state virt-manager)" \ + "lshw" "List hardware details" "$(_state lshw)" \ + "mc" "Midnight Commander" "$(_state mc)" \ + "nvme-cli" "NVMe SSD health monitoring" "$(_state nvme-cli)" \ + "ncdu" "Disk usage analyzer" "$(_state ncdu)" \ + "psensor" "Temperature monitor" "$(_state psensor)" \ + "timeshift" "System restore snapshots" "$(_state timeshift)" \ + "tmux" "Terminal multiplexer" "$(_state tmux)" \ + "wine" "Windows compatibility layer" "$(_state wine)" \ + "bleachbit" "System cleaner (GUI)" "$(_state bleachbit)" \ + "gdebi" "Install .deb packages with deps (GUI)" "$(_state gdebi)" + ) clear [ -z "$choices" ] && return - local cleaned; cleaned=$(echo "$choices" | tr -d '"') + local cleaned + cleaned=$(echo "$choices" | tr -d '"') for pkg in $cleaned; do case $pkg in - compress) - local need=() - ! is_installed "zip" && need+=("zip") - ! is_installed "unzip" && need+=("unzip") - ! is_installed "rar" && need+=("rar") - ! is_installed "unrar" && need+=("unrar") - ! is_installed "p7zip-full" && need+=("p7zip-full") - ! is_installed "p7zip-rar" && need+=("p7zip-rar") - [ ${#need[@]} -gt 0 ] && _run_install_batch "${need[@]}" - ;; - curl-wget) - local need=() - ! is_installed "curl" && need+=("curl") - ! is_installed "wget" && need+=("wget") - [ ${#need[@]} -gt 0 ] && _run_install_batch "${need[@]}" || echo "Already installed." - ;; - kvm) - if ! is_installed "virt-manager"; then - _run_cmd "KVM" "sudo apt install -y qemu-system-x86 qemu-utils libvirt-daemon-system libvirt-clients bridge-utils virt-manager" "Installing KVM..." - sudo adduser "$USER" libvirt 2>/dev/null || true - sudo adduser "$USER" kvm 2>/dev/null || true + compress) + local need=() + ! is_installed "zip" && need+=("zip") + ! is_installed "unzip" && need+=("unzip") + ! is_installed "rar" && need+=("rar") + ! is_installed "unrar" && need+=("unrar") + ! is_installed "p7zip-full" && need+=("p7zip-full") + ! is_installed "p7zip-rar" && need+=("p7zip-rar") + [ ${#need[@]} -gt 0 ] && _run_install_batch "${need[@]}" + ;; + curl-wget) + local need=() + ! is_installed "curl" && need+=("curl") + ! is_installed "wget" && need+=("wget") + [ ${#need[@]} -gt 0 ] && _run_install_batch "${need[@]}" || echo "Already installed." + ;; + kvm) + if ! is_installed "virt-manager"; then + _run_cmd "KVM" "sudo apt install -y qemu-system-x86 qemu-utils libvirt-daemon-system libvirt-clients bridge-utils virt-manager" "Installing KVM..." + sudo adduser "$USER" libvirt 2>/dev/null || true + sudo adduser "$USER" kvm 2>/dev/null || true + else + echo "QEMU/KVM already installed." + fi + ;; + flatpak) + if ! is_installed "flatpak"; then + _run_cmd "Flatpak" "sudo apt install -y flatpak" "Installing Flatpak..." + flatpak remote-add --if-not-exists flathub \ + https://dl.flathub.org/repo/flathub.flatpakrepo + echo -e "${GREEN}Flatpak + Flathub installed.${NC}" + else + echo "Flatpak already installed." + fi + ;; + wine) + if ! is_installed "wine64"; then + _run_cmd "Wine" "sudo apt install -y --no-install-recommends wine64 fonts-wine" "Installing Wine (64-bit only)..." + local wine_ver + wine_ver=$(wine --version 2>/dev/null) + if [ -n "$wine_ver" ]; then + echo -e "${GREEN}Wine (64-bit) installed: ${wine_ver}${NC}" else - echo "QEMU/KVM already installed." + echo -e "${YELLOW}Wine installed but version check failed.${NC}" fi - ;; - flatpak) - if ! is_installed "flatpak"; then - _run_cmd "Flatpak" "sudo apt install -y flatpak" "Installing Flatpak..." - flatpak remote-add --if-not-exists flathub \ - https://dl.flathub.org/repo/flathub.flatpakrepo - echo -e "${GREEN}Flatpak + Flathub installed.${NC}" - else - echo "Flatpak already installed." - fi - ;; - wine) - if ! is_installed "wine64"; then - _run_cmd "Wine" "sudo apt install -y --no-install-recommends wine64 fonts-wine" "Installing Wine (64-bit only)..." - local wine_ver - wine_ver=$(wine --version 2>/dev/null) - if [ -n "$wine_ver" ]; then - echo -e "${GREEN}Wine (64-bit) installed: ${wine_ver}${NC}" - else - echo -e "${YELLOW}Wine installed but version check failed.${NC}" - fi - else - echo "Wine64 already installed." - fi - ;; - fwupd) - if ! is_installed "fwupd"; then - _run_cmd "fwupd" "sudo apt install -y fwupd" "Installing fwupd..." - fi - if _confirm "Firmware Scan" "Scan for firmware updates now?"; then - sudo fwupdmgr refresh --force 2>/dev/null || true - sudo fwupdmgr get-updates 2>&1 || true - _pause - fi - ;; - nvme-cli) - _run_install "nvme-cli" - ;; - *) - if ! is_installed "$pkg"; then - _run_install "$pkg" - else - echo "$pkg already installed." - fi - ;; + else + echo "Wine64 already installed." + fi + ;; + fwupd) + if ! is_installed "fwupd"; then + _run_cmd "fwupd" "sudo apt install -y fwupd" "Installing fwupd..." + fi + if _confirm "Firmware Scan" "Scan for firmware updates now?"; then + sudo fwupdmgr refresh --force 2>/dev/null || true + sudo fwupdmgr get-updates 2>&1 || true + _pause + fi + ;; + nvme-cli) + _run_install "nvme-cli" + ;; + *) + if ! is_installed "$pkg"; then + _run_install "$pkg" + else + echo "$pkg already installed." + fi + ;; esac done echo -e "${GREEN}System tools installed.${NC}" @@ -531,18 +558,19 @@ _cat_general_bullseye() { _cat_fetch_bullseye() { local items=( - "neofetch" "System info fetcher" "$(_state neofetch)" + "neofetch" "System info fetcher" "$(_state neofetch)" "screenfetch" "System info (BSD/Linux)" "$(_state screenfetch)" - "linuxlogo" "Linux logo + system info" "$(_state linuxlogo)" + "linuxlogo" "Linux logo + system info" "$(_state linuxlogo)" ) local item_count=${#items[@]} local lista_alto=$((item_count > TUI_ALTO_LISTA ? TUI_ALTO_LISTA : item_count)) local choices choices=$(_checklist "Fetch Tools (Bullseye)" "Select system info tools:" $TUI_ALTO $TUI_ANCHO $lista_alto \ - "${items[@]}" ) + "${items[@]}") clear [ -z "$choices" ] && return - local cleaned; cleaned=$(echo "$choices" | tr -d '"') + local cleaned + cleaned=$(echo "$choices" | tr -d '"') for pkg in $cleaned; do if ! is_installed "$pkg"; then _run_install "$pkg" @@ -562,41 +590,42 @@ install_extras_bullseye() { while true; do local cat_choice - cat_choice=$(_menu "Extra Software — Bullseye" "Select a category:" $TUI_ALTO $TUI_ANCHO $TUI_ALTO_LISTA \ - "0" "Essential Pack" \ - "1" "Customization System" \ - "2" "Download & Network" \ - "3" "Internet (Browsers, Email)" \ - "4" "Communication" \ - "5" "Media Players" \ - "6" "Multimedia & Design" \ - "7" "Code Editors & IDEs" \ - "8" "Servers & Dev Tools" \ - "9" "Security & Networking" \ - "10" "Software Centers" \ - "11" "System Tools" \ - "12" "Fetch / System Info" \ - "13" "Back to main menu" \ - ) + cat_choice=$( + _menu "Extra Software — Bullseye" "Select a category:" $TUI_ALTO $TUI_ANCHO $TUI_ALTO_LISTA \ + "0" "Essential Pack" \ + "1" "Customization System" \ + "2" "Download & Network" \ + "3" "Internet (Browsers, Email)" \ + "4" "Communication" \ + "5" "Media Players" \ + "6" "Multimedia & Design" \ + "7" "Code Editors & IDEs" \ + "8" "Servers & Dev Tools" \ + "9" "Security & Networking" \ + "10" "Software Centers" \ + "11" "System Tools" \ + "12" "Fetch / System Info" \ + "13" "Back to main menu" + ) [ -z "$cat_choice" ] && return clear case "$cat_choice" in - 0) _quick_install_bullseye ;; - 1) _cat_customization_bullseye ;; - 2) _cat_download_bullseye ;; - 3) _cat_internet_bullseye ;; - 4) _cat_communication ;; - 5) _cat_players_bullseye ;; - 6) _cat_design_bullseye ;; - 7) _cat_programming_bullseye ;; - 8) _cat_dev_bullseye ;; - 9) _cat_security_bullseye ;; - 10) _cat_software_centers_bullseye ;; - 11) _cat_general_bullseye ;; - 12) _cat_fetch_bullseye ;; - 13) return ;; + 0) _quick_install_bullseye ;; + 1) _cat_customization_bullseye ;; + 2) _cat_download_bullseye ;; + 3) _cat_internet_bullseye ;; + 4) _cat_communication ;; + 5) _cat_players_bullseye ;; + 6) _cat_design_bullseye ;; + 7) _cat_programming_bullseye ;; + 8) _cat_dev_bullseye ;; + 9) _cat_security_bullseye ;; + 10) _cat_software_centers_bullseye ;; + 11) _cat_general_bullseye ;; + 12) _cat_fetch_bullseye ;; + 13) return ;; esac clear done @@ -604,11 +633,12 @@ install_extras_bullseye() { _cat_software_centers_bullseye() { local sc_choice - sc_choice=$(_menu "Software Centers" "Choose a software store to install:" 12 65 3 \ - "gnome-software" "Software Center for GNOME" \ - "plasma-discover" "Software manager for Plasma" \ - "synaptic" "Classic APT package manager (GTK)" \ - ) + sc_choice=$( + _menu "Software Centers" "Choose a software store to install:" 12 65 3 \ + "gnome-software" "Software Center for GNOME" \ + "plasma-discover" "Software manager for Plasma" \ + "synaptic" "Classic APT package manager (GTK)" + ) [ -z "$sc_choice" ] && return if [ "$sc_choice" = "synaptic" ]; then diff --git a/modules/bullseye/legacy.sh b/modules/bullseye/legacy.sh index 4523511..2c24310 100644 --- a/modules/bullseye/legacy.sh +++ b/modules/bullseye/legacy.sh @@ -14,8 +14,8 @@ check_bullseye_archive_phase() { current_year=$(date +%Y) current_month=$(date +%-m) - if [ "$current_year" -gt 2026 ] || \ - { [ "$current_year" -eq 2026 ] && [ "$current_month" -ge 9 ]; }; then + if [ "$current_year" -gt 2026 ] || + { [ "$current_year" -eq 2026 ] && [ "$current_month" -ge 9 ]; }; then BULLSEYE_USE_ARCHIVE=true fi @@ -33,7 +33,8 @@ No security updates will be available." 12 60 install_nvidia_bullseye() { echo -e "${YELLOW}NVIDIA GPU detected (Bullseye mode).${NC}" - local is_fermi; is_fermi=$(is_nvidia_fermi) + local is_fermi + is_fermi=$(is_nvidia_fermi) local nv_pkg="" local gpu_gen="" @@ -108,13 +109,13 @@ install_gaming_bullseye() { local choices choices=$(_checklist "Gaming Setup — Bullseye" \ "Check [*] the packages you want installed/updated on your system.\n" $TUI_ALTO $TUI_ANCHO $TUI_ALTO_LISTA \ - "i386" "Enable 32-bit (i386) architecture" ON \ - "steam" "Steam (requires 32-bit support)" ON \ + "i386" "Enable 32-bit (i386) architecture" ON \ + "steam" "Steam (requires 32-bit support)" ON \ "mangohud" "Performance overlay (Vulkan/OpenGL)" ON \ "gamemode" "Game performance optimization" OFF \ "goverlay" "MangoHud config GUI" ON \ - "java" "Minecraft Java Runtime" OFF \ - "lutris" "Lutris + Wine (requires 32-bit support)" OFF \ + "java" "Minecraft Java Runtime" OFF \ + "lutris" "Lutris + Wine (requires 32-bit support)" OFF \ "retroarch" "RetroArch Emulator Frontend" OFF) if [ -z "$choices" ]; then @@ -128,7 +129,7 @@ install_gaming_bullseye() { local need_32bit=false for p in $cleaned; do - case $p in steam|lutris) need_32bit=true ;; esac + case $p in steam | lutris) need_32bit=true ;; esac done echo "$cleaned" | grep -qw i386 && need_32bit=true @@ -139,7 +140,7 @@ install_gaming_bullseye() { if $need_32bit && ! dpkg --print-foreign-architectures 2>/dev/null | grep -q i386; then echo -e "${YELLOW}Enabling i386 architecture...${NC}" sudo dpkg --add-architecture i386 - _run_cmd "APT Update" "sudo apt update" "Updating package lists..." + _ensure_apt_updated fi if $need_32bit; then @@ -153,20 +154,20 @@ install_gaming_bullseye() { for pkg in $install_list; do case $pkg in - steam) - if ensure_contrib_repo; then - install_steam - else - echo -e "${YELLOW}Skipping Steam installation (contrib repository not enabled).${NC}" - fi - ;; - java) install_minecraft_java ;; - mangohud) install_mangohud ;; - gamemode) install_gamemode ;; - goverlay) install_goverlay ;; - lutris) install_lutris ;; - retroarch) install_retroarch ;; - *) _run_install "$pkg" ;; + steam) + if ensure_contrib_repo; then + install_steam + else + echo -e "${YELLOW}Skipping Steam installation (contrib repository not enabled).${NC}" + fi + ;; + java) install_minecraft_java ;; + mangohud) install_mangohud ;; + gamemode) install_gamemode ;; + goverlay) install_goverlay ;; + lutris) install_lutris ;; + retroarch) install_retroarch ;; + *) _run_install "$pkg" ;; esac done diff --git a/modules/desktop_display.sh b/modules/desktop_display.sh index 821da5a..a48e05a 100644 --- a/modules/desktop_display.sh +++ b/modules/desktop_display.sh @@ -11,9 +11,9 @@ manage_desktop_display() { [ -z "$choice" ] && break clear case "$choice" in - 1) desktop_environment_menu ;; - 2) display_manager_menu ;; - 3) break ;; + 1) desktop_environment_menu ;; + 2) display_manager_menu ;; + 3) break ;; esac done } @@ -33,9 +33,9 @@ desktop_environment_menu() { [ -z "$choice" ] && break clear case "$choice" in - 1) xfce_menu ;; - 2) lxde_menu ;; - 3) break ;; + 1) xfce_menu ;; + 2) lxde_menu ;; + 3) break ;; esac done } @@ -49,8 +49,8 @@ lxde_menu() { [ -z "$choice" ] && return 0 clear case "$(echo "$choice" | tr -d '"')" in - 1) _install_lxde_full ;; - 2) _install_lxde_core ;; + 1) _install_lxde_full ;; + 2) _install_lxde_core ;; esac } @@ -87,11 +87,11 @@ xfce_menu() { [ -z "$choice" ] && break clear case "$choice" in - 1) _install_xfce_full ;; - 2) _install_xfce_minimal ;; - 3) _install_xfce_wayland ;; - 4) _install_xfce_custom ;; - 5) break ;; + 1) _install_xfce_full ;; + 2) _install_xfce_minimal ;; + 3) _install_xfce_wayland ;; + 4) _install_xfce_custom ;; + 5) break ;; esac done } @@ -188,26 +188,26 @@ display_manager_menu() { [ -z "$choice" ] && break clear case "$choice" in - 1) lightdm_config_menu ;; - 2) configure_gdm3 ;; - 3) configure_sddm ;; - 4) - if [ "$DEBIAN_VERSION" = "12" ] || [ "$DEBIAN_VERSION" = "13" ]; then - configure_greetd - else - break - fi - ;; - 5) break ;; + 1) lightdm_config_menu ;; + 2) configure_gdm3 ;; + 3) configure_sddm ;; + 4) + if [ "$DEBIAN_VERSION" = "12" ] || [ "$DEBIAN_VERSION" = "13" ]; then + configure_greetd + else + break + fi + ;; + 5) break ;; esac done } lightdm_config_menu() { local -a items=() - items+=("install_lightdm" "Install LightDM & GTK Greeter" "$(_state lightdm)") - items+=("enable_userlist" "Enable user list at login screen" "OFF") - items+=("enable_autologin" "Enable autologin for current user" "OFF") + items+=("install_lightdm" "Install LightDM & GTK Greeter" "$(_state lightdm)") + items+=("enable_userlist" "Enable user list at login screen" "OFF") + items+=("enable_autologin" "Enable autologin for current user" "OFF") local choices choices=$(_checklist "LightDM Configuration" \ "Select options to apply:" $TUI_ALTO $TUI_ANCHO $TUI_ALTO_LISTA \ @@ -221,34 +221,34 @@ lightdm_config_menu() { cleaned=$(echo "$choices" | tr -d '"') for item in $cleaned; do case $item in - install_lightdm) - if ! is_installed lightdm || ! is_installed lightdm-gtk-greeter-settings; then - echo "lightdm shared/default-x-display-manager select lightdm" | sudo debconf-set-selections - _run_cmd "LightDM" "sudo apt install -y lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings" "Installing LightDM & GTK Greeter..." - else - echo -e "${GREEN}[LightDM] LightDM and GTK Greeter settings are already installed, skipping...${NC}" - fi - ;; - enable_userlist) - local conf="/etc/lightdm/lightdm.conf.d/50-debianito-userlist.conf" - sudo mkdir -p "$(dirname "$conf")" - if echo "[Seat:*] -greeter-hide-users=false" | sudo tee "$conf" > /dev/null; then - echo -e "${GREEN}User list enabled in LightDM.${NC}" - else - echo -e "${RED}Failed to write configuration.${NC}" - fi - ;; - enable_autologin) - local dm_conf="/etc/lightdm/lightdm.conf" - local lightdm_user="${SUDO_USER:-$USER}" - sudo sed -i 's/^#[[:space:]]*autologin-user[[:space:]=].*/autologin-user='"$lightdm_user"'/' "$dm_conf" - sudo sed -i 's/^#[[:space:]]*autologin-user-timeout[[:space:]=].*/autologin-user-timeout=0/' "$dm_conf" - echo -e "${GREEN}Autologin enabled for user: ${lightdm_user}${NC}" - ;; - esac - done - _pause + install_lightdm) + if ! is_installed lightdm || ! is_installed lightdm-gtk-greeter-settings; then + echo "lightdm shared/default-x-display-manager select lightdm" | sudo debconf-set-selections + _run_cmd "LightDM" "sudo apt install -y lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings" "Installing LightDM & GTK Greeter..." + else + echo -e "${GREEN}[LightDM] LightDM and GTK Greeter settings are already installed, skipping...${NC}" + fi + ;; + enable_userlist) + local conf="/etc/lightdm/lightdm.conf.d/50-debianito-userlist.conf" + sudo mkdir -p "$(dirname "$conf")" + if echo "[Seat:*] +greeter-hide-users=false" | sudo tee "$conf" >/dev/null; then + echo -e "${GREEN}User list enabled in LightDM.${NC}" + else + echo -e "${RED}Failed to write configuration.${NC}" + fi + ;; + enable_autologin) + local dm_conf="/etc/lightdm/lightdm.conf" + local lightdm_user="${SUDO_USER:-$USER}" + sudo sed -i 's/^#[[:space:]]*autologin-user[[:space:]=].*/autologin-user='"$lightdm_user"'/' "$dm_conf" + sudo sed -i 's/^#[[:space:]]*autologin-user-timeout[[:space:]=].*/autologin-user-timeout=0/' "$dm_conf" + echo -e "${GREEN}Autologin enabled for user: ${lightdm_user}${NC}" + ;; + esac + done + _pause } configure_greetd() { @@ -272,47 +272,47 @@ configure_greetd() { [ -z "$choice" ] && return clear case "$choice" in - 1) + 1) + echo "greetd shared/default-x-display-manager select greetd" | sudo debconf-set-selections + _run_cmd "greetd" "sudo apt install -y greetd" "Installing greetd..." + _msg "greetd" "Warning: greetd was installed but NOT configured.\n\nYou must manually create /etc/greetd/config.toml\nto be able to log in.\n\nSee 'man greetd' and 'man 5 greetd-sessions'." + ;; + 2) + if [ "$DEBIAN_VERSION" = "12" ]; then + if [ "$(is_backports_enabled)" != true ]; then + _write_deb822_backports "bookworm" + _ensure_apt_updated + fi + _run_cmd "greetd" "sudo apt install -y -t bookworm-backports tuigreet greetd" "Installing greetd + tuigreet..." + else + _run_cmd "greetd" "sudo apt install -y greetd tuigreet" "Installing greetd + tuigreet..." + fi + _msg "greetd" "Warning: greetd was installed but NOT configured.\n\nYou must manually create /etc/greetd/config.toml\nto be able to log in.\n\nSee 'man greetd' and 'man 5 greetd-sessions'." + ;; + 3) + if [ "$DEBIAN_VERSION" = "13" ]; then echo "greetd shared/default-x-display-manager select greetd" | sudo debconf-set-selections - _run_cmd "greetd" "sudo apt install -y greetd" "Installing greetd..." + _run_cmd "greetd" "sudo apt install -y greetd gtkgreet" "Installing greetd + gtkgreet..." _msg "greetd" "Warning: greetd was installed but NOT configured.\n\nYou must manually create /etc/greetd/config.toml\nto be able to log in.\n\nSee 'man greetd' and 'man 5 greetd-sessions'." - ;; - 2) - if [ "$DEBIAN_VERSION" = "12" ]; then - if [ "$(is_backports_enabled)" != true ]; then - _write_deb822_backports "bookworm" - sudo apt update -qq - fi - _run_cmd "greetd" "sudo apt install -y -t bookworm-backports tuigreet greetd" "Installing greetd + tuigreet..." - else - _run_cmd "greetd" "sudo apt install -y greetd tuigreet" "Installing greetd + tuigreet..." - fi + else + return + fi + ;; + 4) + if [ "$DEBIAN_VERSION" = "13" ]; then + echo "greetd shared/default-x-display-manager select greetd" | sudo debconf-set-selections + _run_cmd "greetd" "sudo apt install -y greetd nwg-hello" "Installing greetd + nwg-hello..." _msg "greetd" "Warning: greetd was installed but NOT configured.\n\nYou must manually create /etc/greetd/config.toml\nto be able to log in.\n\nSee 'man greetd' and 'man 5 greetd-sessions'." - ;; - 3) - if [ "$DEBIAN_VERSION" = "13" ]; then - echo "greetd shared/default-x-display-manager select greetd" | sudo debconf-set-selections - _run_cmd "greetd" "sudo apt install -y greetd gtkgreet" "Installing greetd + gtkgreet..." - _msg "greetd" "Warning: greetd was installed but NOT configured.\n\nYou must manually create /etc/greetd/config.toml\nto be able to log in.\n\nSee 'man greetd' and 'man 5 greetd-sessions'." - else - return - fi - ;; - 4) - if [ "$DEBIAN_VERSION" = "13" ]; then - echo "greetd shared/default-x-display-manager select greetd" | sudo debconf-set-selections - _run_cmd "greetd" "sudo apt install -y greetd nwg-hello" "Installing greetd + nwg-hello..." - _msg "greetd" "Warning: greetd was installed but NOT configured.\n\nYou must manually create /etc/greetd/config.toml\nto be able to log in.\n\nSee 'man greetd' and 'man 5 greetd-sessions'." - fi - ;; - 5) - if [ "$DEBIAN_VERSION" = "13" ]; then - echo "greetd shared/default-x-display-manager select greetd" | sudo debconf-set-selections - _run_cmd "greetd" "sudo apt install -y greetd wlgreet" "Installing greetd + wlgreet..." - _msg "greetd" "Warning: greetd was installed but NOT configured.\n\nYou must manually create /etc/greetd/config.toml\nto be able to log in.\n\nSee 'man greetd' and 'man 5 greetd-sessions'." - fi - ;; - 6) return ;; + fi + ;; + 5) + if [ "$DEBIAN_VERSION" = "13" ]; then + echo "greetd shared/default-x-display-manager select greetd" | sudo debconf-set-selections + _run_cmd "greetd" "sudo apt install -y greetd wlgreet" "Installing greetd + wlgreet..." + _msg "greetd" "Warning: greetd was installed but NOT configured.\n\nYou must manually create /etc/greetd/config.toml\nto be able to log in.\n\nSee 'man greetd' and 'man 5 greetd-sessions'." + fi + ;; + 6) return ;; esac done } @@ -320,12 +320,12 @@ configure_greetd() { configure_gdm3() { while true; do local items_enabled=() - items_enabled+=("install" "Install/Reinstall gdm3 (Set as default)" "$(_state gdm3)") - items_enabled+=("userlist" "Hide user list (disable-user-list)" "OFF") - items_enabled+=("autologin" "Configure Autologin" "OFF") + items_enabled+=("install" "Install/Reinstall gdm3 (Set as default)" "$(_state gdm3)") + items_enabled+=("userlist" "Hide user list (disable-user-list)" "OFF") + items_enabled+=("autologin" "Configure Autologin" "OFF") if [ "$DEBIAN_VERSION" = "12" ] || [ "$DEBIAN_VERSION" = "13" ]; then if [ "$HAS_NVIDIA" = true ]; then - items_enabled+=("wayland" "Force Enable Wayland on NVIDIA (Risk!)" "OFF") + items_enabled+=("wayland" "Force Enable Wayland on NVIDIA (Risk!)" "OFF") fi fi local choice @@ -340,50 +340,50 @@ configure_gdm3() { cleaned=$(echo "$choice" | tr -d '"') for item in $cleaned; do case $item in - install) - echo "gdm3 shared/default-x-display-manager select gdm3" | sudo debconf-set-selections - _run_cmd "GDM3" "sudo apt install -y gdm3" "Installing gdm3..." - ;; - userlist) - local greeter_conf="/etc/gdm3/greeter.dconf-defaults" - if sudo grep -q '^disable-user-list=true' "$greeter_conf" 2>/dev/null; then - sudo sed -i 's/^disable-user-list=true/# disable-user-list=true/' "$greeter_conf" - echo -e "${GREEN}User list is now VISIBLE.${NC}" - else - sudo sed -i 's/^#[[:space:]]*disable-user-list=true/disable-user-list=true/' "$greeter_conf" - echo -e "${GREEN}User list is now HIDDEN.${NC}" + install) + echo "gdm3 shared/default-x-display-manager select gdm3" | sudo debconf-set-selections + _run_cmd "GDM3" "sudo apt install -y gdm3" "Installing gdm3..." + ;; + userlist) + local greeter_conf="/etc/gdm3/greeter.dconf-defaults" + if sudo grep -q '^disable-user-list=true' "$greeter_conf" 2>/dev/null; then + sudo sed -i 's/^disable-user-list=true/# disable-user-list=true/' "$greeter_conf" + echo -e "${GREEN}User list is now VISIBLE.${NC}" + else + sudo sed -i 's/^#[[:space:]]*disable-user-list=true/disable-user-list=true/' "$greeter_conf" + echo -e "${GREEN}User list is now HIDDEN.${NC}" + fi + sudo dpkg-reconfigure gdm3 >/dev/null 2>&1 + ;; + autologin) + local daemon_conf="/etc/gdm3/daemon.conf" + local username + username=$(whiptail --title "GDM3 Autologin" \ + --inputbox "Enter username to autologin (leave empty to DISABLE autologin):" \ + 10 60 "" 3>&1 1>&2 2>&3 || true) + if [ -n "$username" ]; then + sudo sed -i 's/^# *AutomaticLoginEnable[[:space:]=].*/AutomaticLoginEnable=true/' "$daemon_conf" + sudo sed -i 's/^# *AutomaticLogin[[:space:]=].*/AutomaticLogin='"$username"'/' "$daemon_conf" + echo -e "${GREEN}Autologin enabled for user: ${username}${NC}" + else + sudo sed -i 's/^AutomaticLoginEnable[[:space:]=].*/# AutomaticLoginEnable=false/' "$daemon_conf" + sudo sed -i 's/^AutomaticLogin[[:space:]=].*/# AutomaticLogin=/' "$daemon_conf" + echo -e "${GREEN}Autologin disabled.${NC}" + fi + ;; + wayland) + local rules_link="/etc/udev/rules.d/61-gdm.rules" + if [ -L "$rules_link" ] || [ -f "$rules_link" ]; then + sudo rm -f "$rules_link" + echo -e "${GREEN}Reverted. Wayland will be disabled by default on next reboot.${NC}" + elif [ -f "/lib/udev/rules.d/61-gdm.rules" ]; then + if _confirm "Wayland on NVIDIA" \ + "Force-enable Wayland on NVIDIA?\n\nRisk: This may break graphics or cause instability.\nProceed?"; then + sudo ln -s /dev/null "$rules_link" + echo -e "${GREEN}Wayland override created. Reboot required.${NC}" fi - sudo dpkg-reconfigure gdm3 >/dev/null 2>&1 - ;; - autologin) - local daemon_conf="/etc/gdm3/daemon.conf" - local username - username=$(whiptail --title "GDM3 Autologin" \ - --inputbox "Enter username to autologin (leave empty to DISABLE autologin):" \ - 10 60 "" 3>&1 1>&2 2>&3 || true) - if [ -n "$username" ]; then - sudo sed -i 's/^# *AutomaticLoginEnable[[:space:]=].*/AutomaticLoginEnable=true/' "$daemon_conf" - sudo sed -i 's/^# *AutomaticLogin[[:space:]=].*/AutomaticLogin='"$username"'/' "$daemon_conf" - echo -e "${GREEN}Autologin enabled for user: ${username}${NC}" - else - sudo sed -i 's/^AutomaticLoginEnable[[:space:]=].*/# AutomaticLoginEnable=false/' "$daemon_conf" - sudo sed -i 's/^AutomaticLogin[[:space:]=].*/# AutomaticLogin=/' "$daemon_conf" - echo -e "${GREEN}Autologin disabled.${NC}" - fi - ;; - wayland) - local rules_link="/etc/udev/rules.d/61-gdm.rules" - if [ -L "$rules_link" ] || [ -f "$rules_link" ]; then - sudo rm -f "$rules_link" - echo -e "${GREEN}Reverted. Wayland will be disabled by default on next reboot.${NC}" - elif [ -f "/lib/udev/rules.d/61-gdm.rules" ]; then - if _confirm "Wayland on NVIDIA" \ - "Force-enable Wayland on NVIDIA?\n\nRisk: This may break graphics or cause instability.\nProceed?"; then - sudo ln -s /dev/null "$rules_link" - echo -e "${GREEN}Wayland override created. Reboot required.${NC}" - fi - fi - ;; + fi + ;; esac done _pause @@ -402,37 +402,37 @@ configure_sddm() { [ -z "$choice" ] && return clear case "$choice" in - 1) - echo "sddm shared/default-x-display-manager select sddm" | sudo debconf-set-selections - _run_cmd "SDDM" "sudo apt install -y sddm" "Installing SDDM..." - ;; - 2) - local sddm_session="" - local sddm_user="${SUDO_USER:-$USER}" - if [ -f /usr/share/wayland-sessions/plasmawayland.desktop ]; then - sddm_session="plasmawayland" - elif [ -f /usr/share/wayland-sessions/lxqt-wayland.desktop ]; then - sddm_session="lxqt-wayland" - elif [ -f /usr/share/xsessions/plasma.desktop ]; then - sddm_session="plasma" - elif [ -f /usr/share/xsessions/lxqt.desktop ]; then - sddm_session="lxqt" - fi - sudo mkdir -p /etc/sddm.conf.d - cat << EOF | sudo tee /etc/sddm.conf.d/autologin.conf > /dev/null + 1) + echo "sddm shared/default-x-display-manager select sddm" | sudo debconf-set-selections + _run_cmd "SDDM" "sudo apt install -y sddm" "Installing SDDM..." + ;; + 2) + local sddm_session="" + local sddm_user="${SUDO_USER:-$USER}" + if [ -f /usr/share/wayland-sessions/plasmawayland.desktop ]; then + sddm_session="plasmawayland" + elif [ -f /usr/share/wayland-sessions/lxqt-wayland.desktop ]; then + sddm_session="lxqt-wayland" + elif [ -f /usr/share/xsessions/plasma.desktop ]; then + sddm_session="plasma" + elif [ -f /usr/share/xsessions/lxqt.desktop ]; then + sddm_session="lxqt" + fi + sudo mkdir -p /etc/sddm.conf.d + cat </dev/null [Autologin] User=${sddm_user} Session=${sddm_session} Relogin=false EOF - if [ -n "$sddm_session" ]; then - echo -e "${GREEN}Autologin enabled for user ${sddm_user}, session: ${sddm_session}.${NC}" - else - echo -e "${YELLOW}Autologin enabled for user ${sddm_user}. No session set (SDDM will use default).${NC}" - fi - _pause - ;; - 3) return ;; + if [ -n "$sddm_session" ]; then + echo -e "${GREEN}Autologin enabled for user ${sddm_user}, session: ${sddm_session}.${NC}" + else + echo -e "${YELLOW}Autologin enabled for user ${sddm_user}. No session set (SDDM will use default).${NC}" + fi + _pause + ;; + 3) return ;; esac done } diff --git a/modules/extras/communication/communication.sh b/modules/extras/communication/communication.sh index 6b59662..8875dac 100644 --- a/modules/extras/communication/communication.sh +++ b/modules/extras/communication/communication.sh @@ -6,7 +6,7 @@ _install_signal() { if [ ! -f /etc/apt/sources.list.d/extrepo_signal.sources ]; then _run_cmd "Signal" "sudo extrepo enable signal" "Enabling Signal repository..." fi - _run_cmd "APT Update" "sudo apt update" "Updating package lists..." + _ensure_apt_updated if ! is_installed "signal-desktop"; then _run_cmd "Signal" "sudo apt install -y signal-desktop" "Installing Signal..." echo -e "${GREEN}Signal installed.${NC}" @@ -50,13 +50,16 @@ _cat_communication() { fi local -a items=() - local signal_state; signal_state=$(_state "signal-desktop") - local telegram_state; telegram_state=$(_state "telegram-desktop") - local hexchat_state; hexchat_state=$(_state "hexchat") + local signal_state + signal_state=$(_state "signal-desktop") + local telegram_state + telegram_state=$(_state "telegram-desktop") + local hexchat_state + hexchat_state=$(_state "hexchat") items+=( - "signal-desktop" "Signal Private Messenger (extrepo)" "$signal_state" - "telegram-desktop" "Telegram Desktop messaging" "$telegram_state" - "hexchat" "IRC client (HexChat)" "$hexchat_state" + "signal-desktop" "Signal Private Messenger (extrepo)" "$signal_state" + "telegram-desktop" "Telegram Desktop messaging" "$telegram_state" + "hexchat" "IRC client (HexChat)" "$hexchat_state" ) local item_count=${#items[@]} @@ -67,19 +70,20 @@ _cat_communication() { clear [ -z "$choices" ] && return - local cleaned; cleaned=$(echo "$choices" | tr -d '"') + local cleaned + cleaned=$(echo "$choices" | tr -d '"') for pkg in $cleaned; do case $pkg in - signal-desktop) _install_signal ;; - telegram-desktop) _install_telegram ;; - hexchat) - if ! is_installed "hexchat"; then - _run_install "hexchat" - echo -e "${GREEN}hexchat installed.${NC}" - else - echo "hexchat already installed." - fi - ;; + signal-desktop) _install_signal ;; + telegram-desktop) _install_telegram ;; + hexchat) + if ! is_installed "hexchat"; then + _run_install "hexchat" + echo -e "${GREEN}hexchat installed.${NC}" + else + echo "hexchat already installed." + fi + ;; esac done echo -e "${GREEN}Communication tools installed.${NC}" diff --git a/modules/extras/dev/jellyfin.sh b/modules/extras/dev/jellyfin.sh index 5ca9f0f..7270041 100644 --- a/modules/extras/dev/jellyfin.sh +++ b/modules/extras/dev/jellyfin.sh @@ -8,7 +8,7 @@ _enable_jellyfin_repo() { fi _run_cmd "Jellyfin" "sudo extrepo enable jellyfin" "Enabling Jellyfin repository..." fi - _run_cmd "APT Update" "sudo apt update" "Updating package lists..." + _ensure_apt_updated } install_jellyfin() { diff --git a/modules/extras/internet/internet.sh b/modules/extras/internet/internet.sh index de7fb0b..54be522 100644 --- a/modules/extras/internet/internet.sh +++ b/modules/extras/internet/internet.sh @@ -16,13 +16,13 @@ _enable_mozilla_repo() { _run_cmd "Mozilla" "sudo extrepo enable mozilla" "Enabling Mozilla repository..." fi if [ ! -f /etc/apt/preferences.d/mozilla ]; then - sudo tee /etc/apt/preferences.d/mozilla > /dev/null << 'EOF' + sudo tee /etc/apt/preferences.d/mozilla >/dev/null <<'EOF' Package: * Pin: origin packages.mozilla.org Pin-Priority: 1000 EOF fi - _run_cmd "APT Update" "sudo apt update" "Updating package lists..." + _ensure_apt_updated } _enable_floorp_repo() { @@ -30,7 +30,7 @@ _enable_floorp_repo() { _ensure_extrepo _run_cmd "Floorp" "sudo extrepo enable floorp" "Enabling Floorp repository..." fi - _run_cmd "APT Update" "sudo apt update" "Updating package lists..." + _ensure_apt_updated } install_palemoon() { @@ -60,7 +60,7 @@ install_palemoon() { else _ensure_extrepo _run_cmd "Pale Moon" "sudo extrepo enable ${REPO_PALEMOON}" "Enabling ${REPO_PALEMOON}..." - _run_cmd "APT Update" "sudo apt update" "Updating package lists..." + _ensure_apt_updated fi if ! is_installed "palemoon"; then @@ -76,7 +76,7 @@ _enable_librewolf_repo() { _ensure_extrepo _run_cmd "LibreWolf" "sudo extrepo enable librewolf" "Enabling LibreWolf repository..." fi - _run_cmd "APT Update" "sudo apt update" "Updating package lists..." + _ensure_apt_updated } _enable_tailscale_repo() { @@ -84,7 +84,7 @@ _enable_tailscale_repo() { _ensure_extrepo _run_cmd "Tailscale" "sudo extrepo enable tailscale" "Enabling Tailscale repository..." fi - _run_cmd "APT Update" "sudo apt update" "Updating package lists..." + _ensure_apt_updated } _enable_mullvad_repo() { @@ -92,14 +92,14 @@ _enable_mullvad_repo() { _ensure_extrepo _run_cmd "Mullvad" "sudo extrepo enable mullvad" "Enabling Mullvad repository..." fi - _run_cmd "APT Update" "sudo apt update" "Updating package lists..." + _ensure_apt_updated } install_protonvpn() { if [ ! -f /etc/apt/sources.list.d/extrepo_protonvpn.sources ]; then _ensure_extrepo _run_cmd "ProtonVPN" "sudo extrepo enable protonvpn stable" "Enabling ProtonVPN repository (stable suite)..." - _run_cmd "APT Update" "sudo apt update" "Updating package lists..." + _ensure_apt_updated else echo "ProtonVPN repository already enabled." fi @@ -119,69 +119,90 @@ _cat_internet() { _is_headless && headless=true local -a items=() if ! $headless; then - local chromium_state; chromium_state=$(_state "chromium") - local dillo_state; dillo_state=$(_state "dillo") - local epiphany_state; epiphany_state=$(_state "epiphany-browser") - local falkon_state; falkon_state=$(_state "falkon") + local chromium_state + chromium_state=$(_state "chromium") + local dillo_state + dillo_state=$(_state "dillo") + local epiphany_state + epiphany_state=$(_state "epiphany-browser") + local falkon_state + falkon_state=$(_state "falkon") local firefox_state="OFF" if command -v firefox &>/dev/null && ! is_installed "firefox-esr"; then firefox_state="ON" fi local firefox_esr_state firefox_esr_state=$(_state "firefox-esr") - local floorp_state; floorp_state=$(_state "floorp") - local konqueror_state; konqueror_state=$(_state "konqueror") - local librewolf_state; librewolf_state=$(_state "librewolf") - local palemoon_state; palemoon_state=$(_state "palemoon") - local privacybrowser_state; privacybrowser_state=$(_state "privacybrowser") - local qutebrowser_state; qutebrowser_state=$(_state "qutebrowser") - local thunderbird_state; thunderbird_state=$(_state "thunderbird") - local torbrowser_state; torbrowser_state=$(_state "torbrowser-launcher") - local mullvadbrowser_state; mullvadbrowser_state=$(_state "mullvad-browser") - local protonvpn_state; protonvpn_state=$(_state "protonvpn") + local floorp_state + floorp_state=$(_state "floorp") + local konqueror_state + konqueror_state=$(_state "konqueror") + local librewolf_state + librewolf_state=$(_state "librewolf") + local palemoon_state + palemoon_state=$(_state "palemoon") + local privacybrowser_state + privacybrowser_state=$(_state "privacybrowser") + local qutebrowser_state + qutebrowser_state=$(_state "qutebrowser") + local thunderbird_state + thunderbird_state=$(_state "thunderbird") + local torbrowser_state + torbrowser_state=$(_state "torbrowser-launcher") + local mullvadbrowser_state + mullvadbrowser_state=$(_state "mullvad-browser") + local protonvpn_state + protonvpn_state=$(_state "protonvpn") items+=( - "chromium" "Chromium web browser" "$chromium_state" - "dillo" "Lightweight graphical browser" "$dillo_state" - "epiphany-browser" "GNOME web browser" "$epiphany_state" - "falkon" "KDE web browser (QtWebEngine)" "$falkon_state" - "firefox" "Firefox from Mozilla (replaces ESR)" "$firefox_state" - "firefox-esr" "Firefox ESR (official Debian + locale auto)" "$firefox_esr_state" - "floorp" "Firefox-based browser (extrepo)" "$floorp_state" - "konqueror" "KDE file manager / web browser" "$konqueror_state" - "librewolf" "Privacy-focused Firefox fork (extrepo)" "$librewolf_state" - "palemoon" "Classic Firefox-derived browser (extrepo)" "$palemoon_state" - "privacybrowser" "Privacy-focused web browser" "$privacybrowser_state" - "qutebrowser" "Keyboard-driven browser (Qt)" "$qutebrowser_state" - "thunderbird" "Email client" "$thunderbird_state" - "torbrowser-launcher" "Tor Browser launcher" "$torbrowser_state" - "mullvad-browser" "Mullvad privacy browser" "$mullvadbrowser_state" - "protonvpn" "ProtonVPN client" "$protonvpn_state" + "chromium" "Chromium web browser" "$chromium_state" + "dillo" "Lightweight graphical browser" "$dillo_state" + "epiphany-browser" "GNOME web browser" "$epiphany_state" + "falkon" "KDE web browser (QtWebEngine)" "$falkon_state" + "firefox" "Firefox from Mozilla (replaces ESR)" "$firefox_state" + "firefox-esr" "Firefox ESR (official Debian + locale auto)" "$firefox_esr_state" + "floorp" "Firefox-based browser (extrepo)" "$floorp_state" + "konqueror" "KDE file manager / web browser" "$konqueror_state" + "librewolf" "Privacy-focused Firefox fork (extrepo)" "$librewolf_state" + "palemoon" "Classic Firefox-derived browser (extrepo)" "$palemoon_state" + "privacybrowser" "Privacy-focused web browser" "$privacybrowser_state" + "qutebrowser" "Keyboard-driven browser (Qt)" "$qutebrowser_state" + "thunderbird" "Email client" "$thunderbird_state" + "torbrowser-launcher" "Tor Browser launcher" "$torbrowser_state" + "mullvad-browser" "Mullvad privacy browser" "$mullvadbrowser_state" + "protonvpn" "ProtonVPN client" "$protonvpn_state" ) fi - local elinks_state; elinks_state=$(_state "elinks") - local riseupvpn_state; riseupvpn_state=$(_state "riseup-vpn") - local w3m_state; w3m_state=$(_state "w3m") - local tailscale_state; tailscale_state=$(_state "tailscale") - local mullvad_state; mullvad_state=$(_state "mullvad-vpn") + local elinks_state + elinks_state=$(_state "elinks") + local riseupvpn_state + riseupvpn_state=$(_state "riseup-vpn") + local w3m_state + w3m_state=$(_state "w3m") + local tailscale_state + tailscale_state=$(_state "tailscale") + local mullvad_state + mullvad_state=$(_state "mullvad-vpn") items+=( - "elinks" "Text-mode web browser" "$elinks_state" - "riseup-vpn" "Riseup VPN client" "$riseupvpn_state" - "w3m" "Text-mode browser + deps (w3m-img)" "$w3m_state" - "tailscale" "Zero-config VPN & mesh networking" "$tailscale_state" - "mullvad-vpn" "Mullvad VPN client (WireGuard)" "$mullvad_state" + "elinks" "Text-mode web browser" "$elinks_state" + "riseup-vpn" "Riseup VPN client" "$riseupvpn_state" + "w3m" "Text-mode browser + deps (w3m-img)" "$w3m_state" + "tailscale" "Zero-config VPN & mesh networking" "$tailscale_state" + "mullvad-vpn" "Mullvad VPN client (WireGuard)" "$mullvad_state" ) local item_count=${#items[@]} local lista_alto=$((item_count > TUI_ALTO_LISTA ? TUI_ALTO_LISTA : item_count)) local choices - choices=$(_checklist "Internet" "Check [*] the packages you want installed/updated on your system.\n" $TUI_ALTO $TUI_ANCHO $lista_alto \ - "${items[@]}" \ - ) + choices=$( + _checklist "Internet" "Check [*] the packages you want installed/updated on your system.\n" $TUI_ALTO $TUI_ANCHO $lista_alto \ + "${items[@]}" + ) clear [ -z "$choices" ] && return - local cleaned; cleaned=$(echo "$choices" | tr -d '"') + local cleaned + cleaned=$(echo "$choices" | tr -d '"') local has_firefox=false local has_firefox_esr=false @@ -194,76 +215,76 @@ _cat_internet() { if $has_firefox && $has_firefox_esr; then fchoice=$(_menu "Firefox" "You selected both Firefox (Mozilla) and Firefox ESR.\nWhat do you want to do?" 12 60 3 \ "mozilla" "Remove Firefox ESR — keep Firefox" \ - "esr" "Remove Firefox — keep Firefox ESR" \ - "both" "Keep both variants") + "esr" "Remove Firefox — keep Firefox ESR" \ + "both" "Keep both variants") [ -z "$fchoice" ] && return case "$fchoice" in - mozilla) cleaned=$(printf '%s\n' $cleaned | grep -vx "firefox-esr" | tr '\n' ' ') ;; - esr) cleaned=$(printf '%s\n' $cleaned | grep -vx "firefox" | tr '\n' ' ') ;; + mozilla) cleaned=$(printf '%s\n' $cleaned | grep -vx "firefox-esr" | tr '\n' ' ') ;; + esr) cleaned=$(printf '%s\n' $cleaned | grep -vx "firefox" | tr '\n' ' ') ;; esac fi for pkg in $cleaned; do case $pkg in - firefox) - install_firefox_mozilla "$fchoice" - ;; - firefox-esr) - install_firefox_esr "$fchoice" - ;; - floorp) - _enable_floorp_repo - _run_install floorp - echo -e "${GREEN}Floorp installed.${NC}" - ;; - librewolf) - _enable_librewolf_repo - _run_install librewolf - echo -e "${GREEN}LibreWolf installed.${NC}" - ;; - palemoon) - install_palemoon - ;; - tailscale) - _enable_tailscale_repo - _run_install tailscale - echo -e "${GREEN}Tailscale installed.${NC}" - ;; - mullvad-vpn) - _enable_mullvad_repo - _run_install mullvad-vpn - echo -e "${GREEN}Mullvad VPN installed.${NC}" - ;; - mullvad-browser) - _enable_mullvad_repo - _run_install mullvad-browser - echo -e "${GREEN}Mullvad Browser installed.${NC}" - ;; - protonvpn) - install_protonvpn - ;; - riseup-vpn) - install_backports_or_stable riseup-vpn - ;; - w3m) - local need=() - ! is_installed "w3m" && need+=("w3m") - ! is_installed "w3m-img" && need+=("w3m-img") - ! is_installed "ca-certificates" && need+=("ca-certificates") - ! is_installed "xsel" && need+=("xsel") - if [ ${#need[@]} -gt 0 ]; then - _run_install_batch w3m w3m-img ca-certificates xsel - else - echo "w3m already installed." - fi - ;; - *) - if ! is_installed "$pkg"; then - _run_install "$pkg" - else - echo "$pkg already installed." - fi - ;; + firefox) + install_firefox_mozilla "$fchoice" + ;; + firefox-esr) + install_firefox_esr "$fchoice" + ;; + floorp) + _enable_floorp_repo + _run_install floorp + echo -e "${GREEN}Floorp installed.${NC}" + ;; + librewolf) + _enable_librewolf_repo + _run_install librewolf + echo -e "${GREEN}LibreWolf installed.${NC}" + ;; + palemoon) + install_palemoon + ;; + tailscale) + _enable_tailscale_repo + _run_install tailscale + echo -e "${GREEN}Tailscale installed.${NC}" + ;; + mullvad-vpn) + _enable_mullvad_repo + _run_install mullvad-vpn + echo -e "${GREEN}Mullvad VPN installed.${NC}" + ;; + mullvad-browser) + _enable_mullvad_repo + _run_install mullvad-browser + echo -e "${GREEN}Mullvad Browser installed.${NC}" + ;; + protonvpn) + install_protonvpn + ;; + riseup-vpn) + install_backports_or_stable riseup-vpn + ;; + w3m) + local need=() + ! is_installed "w3m" && need+=("w3m") + ! is_installed "w3m-img" && need+=("w3m-img") + ! is_installed "ca-certificates" && need+=("ca-certificates") + ! is_installed "xsel" && need+=("xsel") + if [ ${#need[@]} -gt 0 ]; then + _run_install_batch w3m w3m-img ca-certificates xsel + else + echo "w3m already installed." + fi + ;; + *) + if ! is_installed "$pkg"; then + _run_install "$pkg" + else + echo "$pkg already installed." + fi + ;; esac done @@ -284,22 +305,22 @@ install_firefox_mozilla() { if is_installed "firefox-esr"; then case "$fchoice" in - both) - echo -e "${CYAN}[INFO] Keeping Firefox ESR (both selected).${NC}" - ;; - mozilla) - echo "Removing Firefox ESR (as selected)..." + both) + echo -e "${CYAN}[INFO] Keeping Firefox ESR (both selected).${NC}" + ;; + mozilla) + echo "Removing Firefox ESR (as selected)..." + sudo apt remove -y firefox-esr + ;; + *) + if _confirm "Firefox ESR" "Firefox ESR is installed.\nRemove it before installing Mozilla Firefox?"; then + echo "Removing Firefox ESR..." sudo apt remove -y firefox-esr - ;; - *) - if _confirm "Firefox ESR" "Firefox ESR is installed.\nRemove it before installing Mozilla Firefox?"; then - echo "Removing Firefox ESR..." - sudo apt remove -y firefox-esr - else - echo "Keeping Firefox ESR." - return - fi - ;; + else + echo "Keeping Firefox ESR." + return + fi + ;; esac fi @@ -317,22 +338,22 @@ install_firefox_esr() { if command -v firefox &>/dev/null; then case "$fchoice" in - both) - echo -e "${CYAN}[INFO] Keeping Mozilla Firefox (both selected).${NC}" - ;; - esr) - echo "Removing Mozilla Firefox (as selected)..." + both) + echo -e "${CYAN}[INFO] Keeping Mozilla Firefox (both selected).${NC}" + ;; + esr) + echo "Removing Mozilla Firefox (as selected)..." + sudo apt remove -y firefox + ;; + *) + if _confirm "Firefox" "Mozilla Firefox is installed.\nRemove it before installing Firefox ESR?"; then + echo "Removing Mozilla Firefox..." sudo apt remove -y firefox - ;; - *) - if _confirm "Firefox" "Mozilla Firefox is installed.\nRemove it before installing Firefox ESR?"; then - echo "Removing Mozilla Firefox..." - sudo apt remove -y firefox - else - echo "Keeping Mozilla Firefox." - return - fi - ;; + else + echo "Keeping Mozilla Firefox." + return + fi + ;; esac fi diff --git a/modules/extras/java.sh b/modules/extras/java.sh index e9c215a..039866b 100644 --- a/modules/extras/java.sh +++ b/modules/extras/java.sh @@ -10,18 +10,21 @@ _enable_temurin_repo() { _run_cmd "extrepo" "sudo apt install -y extrepo" "Installing extrepo..." fi _run_cmd "Temurin" "sudo extrepo enable temurin" "Enabling Adoptium Temurin repository..." - _run_cmd "APT Update" "sudo apt update" "Updating package lists..." + _ensure_apt_updated } install_minecraft_java() { local choices choices=$(_checklist "Java Runtimes for Minecraft" \ "Select Java version(s) to install:" 15 65 4 \ - "8" "Java 8 — Classic mods & Minecraft <= 1.16.5" OFF \ + "8" "Java 8 — Classic mods & Minecraft <= 1.16.5" OFF \ "17" "Java 17 — Minecraft 1.17 to 1.20.4" ON \ "21" "Java 21 — Modern Minecraft >= 1.20.5 & 1.21+" OFF \ "25" "Java 25 — Minecraft 26+" OFF) - [ -z "$choices" ] && { echo "No Java version selected."; return; } + [ -z "$choices" ] && { + echo "No Java version selected." + return + } _enable_temurin_repo local cleaned cleaned=$(echo "$choices" | tr -d '"') @@ -38,7 +41,10 @@ _install_dev_java() { "17" "Java 17 LTS Development Kit" \ "21" "Java 21 LTS Development Kit" \ "25" "Java 25 LTS Development Kit") - [ -z "$ver" ] && { echo "No JDK version selected."; return; } + [ -z "$ver" ] && { + echo "No JDK version selected." + return + } _enable_temurin_repo _run_install "temurin-${ver}-jdk" } diff --git a/modules/extras/office/office.sh b/modules/extras/office/office.sh index 8b2df49..d476204 100644 --- a/modules/extras/office/office.sh +++ b/modules/extras/office/office.sh @@ -10,7 +10,7 @@ _enable_onlyoffice_repo() { fi _run_cmd "OnlyOffice" "sudo extrepo enable onlyoffice-desktopeditors" "Enabling OnlyOffice repository..." fi - _run_cmd "APT Update" "sudo apt update" "Updating package lists..." + _ensure_apt_updated } install_onlyoffice() { @@ -36,7 +36,7 @@ install_joplin() { if [ ! -f /etc/apt/sources.list.d/extrepo_joplin.sources ]; then _run_cmd "Joplin" "sudo extrepo enable joplin" "Enabling Joplin repository..." fi - _run_cmd "APT Update" "sudo apt update" "Updating package lists..." + _ensure_apt_updated if ! is_installed "joplin"; then _run_cmd "Joplin" "sudo apt install -y joplin" "Installing Joplin..." echo -e "${GREEN}Joplin installed.${NC}" @@ -84,8 +84,8 @@ _cat_office() { local -a items=() if ! $headless; then items+=( - "onlyoffice" "OnlyOffice Desktop Editors (extrepo)" OFF - "libreoffice" "LibreOffice (backports on Bookworm/Trixie)" OFF + "onlyoffice" "OnlyOffice Desktop Editors (extrepo)" OFF + "libreoffice" "LibreOffice (backports on Bookworm/Trixie)" OFF ) if [ "$DEBIAN_VERSION" = "12" ] || [ "$DEBIAN_VERSION" = "13" ]; then items+=( @@ -97,18 +97,20 @@ _cat_office() { local item_count=${#items[@]} local lista_alto=$((item_count > TUI_ALTO_LISTA ? TUI_ALTO_LISTA : item_count)) local choices - choices=$(_checklist "Office & Productivity" "Check [*] the packages you want installed/updated on your system.\n" $TUI_ALTO $TUI_ANCHO $lista_alto \ - "${items[@]}" \ - ) + choices=$( + _checklist "Office & Productivity" "Check [*] the packages you want installed/updated on your system.\n" $TUI_ALTO $TUI_ANCHO $lista_alto \ + "${items[@]}" + ) [ -z "$choices" ] && return - local cleaned; cleaned=$(echo "$choices" | tr -d '"') + local cleaned + cleaned=$(echo "$choices" | tr -d '"') for pkg in $cleaned; do case $pkg in - onlyoffice) install_onlyoffice ;; - libreoffice) install_libreoffice_bpo ;; - joplin) install_joplin ;; + onlyoffice) install_onlyoffice ;; + libreoffice) install_libreoffice_bpo ;; + joplin) install_joplin ;; esac done } diff --git a/modules/extras/programming/programming.sh b/modules/extras/programming/programming.sh index b9fb854..dcfc176 100644 --- a/modules/extras/programming/programming.sh +++ b/modules/extras/programming/programming.sh @@ -5,64 +5,77 @@ _cat_programming() { local headless=false _is_headless && headless=true local -a items=() - local vim_state; vim_state=$(_state "vim") - local neovim_state; neovim_state=$(_state "neovim") - local hx_state; hx_state=$(_state "hx") - local nano_state; nano_state=$(_state "nano") - local emacs_state; emacs_state=$(_state "emacs") + local vim_state + vim_state=$(_state "vim") + local neovim_state + neovim_state=$(_state "neovim") + local hx_state + hx_state=$(_state "hx") + local nano_state + nano_state=$(_state "nano") + local emacs_state + emacs_state=$(_state "emacs") items+=( - "vim" "Classic terminal editor" "$vim_state" - "neovim" "Modern vim fork" "$neovim_state" - "hx" "Helix modal editor (Rust)" "$hx_state" - "nano" "Simple terminal editor" "$nano_state" - "emacs" "Extensible editor / IDE" "$emacs_state" + "vim" "Classic terminal editor" "$vim_state" + "neovim" "Modern vim fork" "$neovim_state" + "hx" "Helix modal editor (Rust)" "$hx_state" + "nano" "Simple terminal editor" "$nano_state" + "emacs" "Extensible editor / IDE" "$emacs_state" ) if ! $headless; then - local vimgtk_state; vimgtk_state=$(_state "vim-gtk3") - local kate_state; kate_state=$(_state "kate") - local mousepad_state; mousepad_state=$(_state "mousepad") - local gedit_state; gedit_state=$(_state "gedit") - local geany_state; geany_state=$(_state "geany") - local gte_state; gte_state=$(_state "gnome-text-editor") + local vimgtk_state + vimgtk_state=$(_state "vim-gtk3") + local kate_state + kate_state=$(_state "kate") + local mousepad_state + mousepad_state=$(_state "mousepad") + local gedit_state + gedit_state=$(_state "gedit") + local geany_state + geany_state=$(_state "geany") + local gte_state + gte_state=$(_state "gnome-text-editor") local codium_state="OFF" if command -v codium &>/dev/null; then codium_state="ON" fi items+=( - "vim-gtk3" "Vim with GTK3 GUI" "$vimgtk_state" - "kate" "KDE advanced text editor" "$kate_state" - "mousepad" "Xfce text editor" "$mousepad_state" - "gedit" "GNOME text editor" "$gedit_state" - "geany" "Lightweight IDE" "$geany_state" - "gnome-text-editor" "GNOME modern text editor" "$gte_state" - "vscodium" "VS Code open-source (extrepo)" "$codium_state" + "vim-gtk3" "Vim with GTK3 GUI" "$vimgtk_state" + "kate" "KDE advanced text editor" "$kate_state" + "mousepad" "Xfce text editor" "$mousepad_state" + "gedit" "GNOME text editor" "$gedit_state" + "geany" "Lightweight IDE" "$geany_state" + "gnome-text-editor" "GNOME modern text editor" "$gte_state" + "vscodium" "VS Code open-source (extrepo)" "$codium_state" ) fi local item_count=${#items[@]} local lista_alto=$((item_count > TUI_ALTO_LISTA ? TUI_ALTO_LISTA : item_count)) local choices - choices=$(_checklist "Programming Applications" "Check [*] the packages you want installed/updated on your system.\n" $TUI_ALTO $TUI_ANCHO $lista_alto \ - "${items[@]}" \ - ) + choices=$( + _checklist "Programming Applications" "Check [*] the packages you want installed/updated on your system.\n" $TUI_ALTO $TUI_ANCHO $lista_alto \ + "${items[@]}" + ) clear [ -z "$choices" ] && return - local cleaned; cleaned=$(echo "$choices" | tr -d '"') + local cleaned + cleaned=$(echo "$choices" | tr -d '"') for pkg in $cleaned; do case $pkg in - vscodium) - install_vscodium - ;; - *) - if ! is_installed "$pkg"; then - _run_install "$pkg" - else - echo "$pkg already installed." - fi - ;; + vscodium) + install_vscodium + ;; + *) + if ! is_installed "$pkg"; then + _run_install "$pkg" + else + echo "$pkg already installed." + fi + ;; esac done @@ -76,7 +89,7 @@ _enable_vscodium_repo() { fi _run_cmd "VSCodium" "sudo extrepo enable vscodium" "Enabling VSCodium repository..." fi - _run_cmd "APT Update" "sudo apt update" "Updating package lists..." + _ensure_apt_updated } install_vscodium() { diff --git a/modules/extras/system/system.sh b/modules/extras/system/system.sh index f58f0fa..ce02660 100644 --- a/modules/extras/system/system.sh +++ b/modules/extras/system/system.sh @@ -7,10 +7,14 @@ _detect_desktop_type() { desktop="${desktop,,}" case "$desktop" in - *kde*|*lxqt*|*razor*|*plasma*) - echo "qt"; return ;; - *gnome*|*xfce*|*cinnamon*|*mate*|*lxde*|*budgie*|*sway*|*hyprland*|*i3*|*bspwm*|*openbox*|*fluxbox*) - echo "gtk"; return ;; + *kde* | *lxqt* | *razor* | *plasma*) + echo "qt" + return + ;; + *gnome* | *xfce* | *cinnamon* | *mate* | *lxde* | *budgie* | *sway* | *hyprland* | *i3* | *bspwm* | *openbox* | *fluxbox*) + echo "gtk" + return + ;; esac echo "gtk" @@ -20,224 +24,252 @@ _cat_general() { local headless=false _is_headless && headless=true local -a items=() - local btop_state; btop_state=$(_state "btop") + local btop_state + btop_state=$(_state "btop") local compress_state if is_installed "zip" && is_installed "unzip" && is_installed "p7zip-full"; then compress_state="ON" else compress_state="OFF" fi - local cpufetch_state; cpufetch_state=$(_state "cpufetch") - local cpu_x_state; cpu_x_state=$(_state "cpu-x") + local cpufetch_state + cpufetch_state=$(_state "cpufetch") + local cpu_x_state + cpu_x_state=$(_state "cpu-x") local curl_wget_state if is_installed "curl" && is_installed "wget"; then curl_wget_state="ON" else curl_wget_state="OFF" fi - local extrepo_state; extrepo_state=$(_state "extrepo") - local fwupd_state; fwupd_state=$(_state "fwupd") - local htop_state; htop_state=$(_state "htop") - local inxi_state; inxi_state=$(_state "inxi") - local jq_state; jq_state=$(_state "jq") - local kvm_state; kvm_state=$(_state "virt-manager") - local lshw_state; lshw_state=$(_state "lshw") - local mc_state; mc_state=$(_state "mc") - local nala_state; nala_state=$(_state "nala") - local ncdu_state; ncdu_state=$(_state "ncdu") - local tmux_state; tmux_state=$(_state "tmux") - local wine_state; wine_state=$(_state "wine") - local nvme_state; nvme_state=$(_state "nvme-cli") + local extrepo_state + extrepo_state=$(_state "extrepo") + local fwupd_state + fwupd_state=$(_state "fwupd") + local htop_state + htop_state=$(_state "htop") + local inxi_state + inxi_state=$(_state "inxi") + local jq_state + jq_state=$(_state "jq") + local kvm_state + kvm_state=$(_state "virt-manager") + local lshw_state + lshw_state=$(_state "lshw") + local mc_state + mc_state=$(_state "mc") + local nala_state + nala_state=$(_state "nala") + local ncdu_state + ncdu_state=$(_state "ncdu") + local tmux_state + tmux_state=$(_state "tmux") + local wine_state + wine_state=$(_state "wine") + local nvme_state + nvme_state=$(_state "nvme-cli") items+=( - "btop" "Resource monitor (fancy top)" "$btop_state" - "compress" "Compression tools (zip, unrar, 7z)" "$compress_state" - "cpufetch" "CPU info fetcher" "$cpufetch_state" - "cpu-x" "CPU-X (alternative to CPU-Z)" "$cpu_x_state" - "curl-wget" "HTTP transfer tools (curl, wget)" "$curl_wget_state" - "extrepo" "External repository manager" "$extrepo_state" - "fwupd" "Firmware update daemon" "$fwupd_state" - "htop" "Interactive process viewer" "$htop_state" - "inxi" "System information tool" "$inxi_state" - "jq" "JSON command-line processor" "$jq_state" - "kvm" "QEMU/KVM virtualization" "$kvm_state" - "lshw" "List hardware details" "$lshw_state" - "mc" "Midnight Commander (file manager)" "$mc_state" - "nala" "APT frontend (parallel downloads)" "$nala_state" - "ncdu" "Disk usage analyzer (ncurses)" "$ncdu_state" - "nvme-cli" "NVMe SSD health monitoring" "$nvme_state" - "tmux" "Terminal multiplexer" "$tmux_state" - "wine" "Windows compatibility layer" "$wine_state" + "btop" "Resource monitor (fancy top)" "$btop_state" + "compress" "Compression tools (zip, unrar, 7z)" "$compress_state" + "cpufetch" "CPU info fetcher" "$cpufetch_state" + "cpu-x" "CPU-X (alternative to CPU-Z)" "$cpu_x_state" + "curl-wget" "HTTP transfer tools (curl, wget)" "$curl_wget_state" + "extrepo" "External repository manager" "$extrepo_state" + "fwupd" "Firmware update daemon" "$fwupd_state" + "htop" "Interactive process viewer" "$htop_state" + "inxi" "System information tool" "$inxi_state" + "jq" "JSON command-line processor" "$jq_state" + "kvm" "QEMU/KVM virtualization" "$kvm_state" + "lshw" "List hardware details" "$lshw_state" + "mc" "Midnight Commander (file manager)" "$mc_state" + "nala" "APT frontend (parallel downloads)" "$nala_state" + "ncdu" "Disk usage analyzer (ncurses)" "$ncdu_state" + "nvme-cli" "NVMe SSD health monitoring" "$nvme_state" + "tmux" "Terminal multiplexer" "$tmux_state" + "wine" "Windows compatibility layer" "$wine_state" ) if ! $headless; then - local bleachbit_state; bleachbit_state=$(_state "bleachbit") - local conky_state; conky_state=$(_state "conky") - local gdebi_state; gdebi_state=$(_state "gdebi") - local corectrl_state; corectrl_state=$(_state "corectrl") - local dcgtk_state; dcgtk_state=$(_state "doublecmd-gtk") - local dcqt_state; dcqt_state=$(_state "doublecmd-qt") - local disks_state; disks_state=$(_state "gnome-disk-utility") - local gparted_state; gparted_state=$(_state "gparted") - local hardinfo_state; hardinfo_state=$(_state "hardinfo") - local psensor_state; psensor_state=$(_state "psensor") - local timeshift_state; timeshift_state=$(_state "timeshift") + local bleachbit_state + bleachbit_state=$(_state "bleachbit") + local conky_state + conky_state=$(_state "conky-all") + local gdebi_state + gdebi_state=$(_state "gdebi") + local corectrl_state + corectrl_state=$(_state "corectrl") + local dcgtk_state + dcgtk_state=$(_state "doublecmd-gtk") + local dcqt_state + dcqt_state=$(_state "doublecmd-qt") + local disks_state + disks_state=$(_state "gnome-disk-utility") + local gparted_state + gparted_state=$(_state "gparted") + local hardinfo_state + hardinfo_state=$(_state "hardinfo") + local psensor_state + psensor_state=$(_state "psensor") + local timeshift_state + timeshift_state=$(_state "timeshift") items+=( - "bleachbit" "System cleaner (GUI)" "$bleachbit_state" - "conky" "System monitor for desktop" "$conky_state" - "gdebi" "Install .deb packages with deps" "$gdebi_state" - "corectrl" "AMD GPU control (CoreCtrl)" "$corectrl_state" - "doublecmd-gtk" "Dual-panel file manager (GTK)" "$dcgtk_state" - "doublecmd-qt" "Dual-panel file manager (Qt)" "$dcqt_state" - "gnome-disk-utility" "Disk management GUI" "$disks_state" - "gparted" "GNOME partition editor" "$gparted_state" - "hardinfo" "Graphical system profiler" "$hardinfo_state" - "psensor" "Hardware temperature monitor" "$psensor_state" - "timeshift" "System restore snapshots" "$timeshift_state" + "bleachbit" "System cleaner (GUI)" "$bleachbit_state" + "conky-all" "System monitor for desktop" "$conky_state" + "gdebi" "Install .deb packages with deps" "$gdebi_state" + "corectrl" "AMD GPU control (CoreCtrl)" "$corectrl_state" + "doublecmd-gtk" "Dual-panel file manager (GTK)" "$dcgtk_state" + "doublecmd-qt" "Dual-panel file manager (Qt)" "$dcqt_state" + "gnome-disk-utility" "Disk management GUI" "$disks_state" + "gparted" "GNOME partition editor" "$gparted_state" + "hardinfo" "Graphical system profiler" "$hardinfo_state" + "psensor" "Hardware temperature monitor" "$psensor_state" + "timeshift" "System restore snapshots" "$timeshift_state" ) fi local item_count=${#items[@]} local lista_alto=$((item_count > TUI_ALTO_LISTA ? TUI_ALTO_LISTA : item_count)) local choices - choices=$(_checklist "System Tools" "Check [*] the packages you want installed/updated on your system.\n" $TUI_ALTO $TUI_ANCHO $lista_alto \ - "${items[@]}" \ - ) + choices=$( + _checklist "System Tools" "Check [*] the packages you want installed/updated on your system.\n" $TUI_ALTO $TUI_ANCHO $lista_alto \ + "${items[@]}" + ) clear [ -z "$choices" ] && return - local cleaned; cleaned=$(echo "$choices" | tr -d '"') + local cleaned + cleaned=$(echo "$choices" | tr -d '"') for pkg in $cleaned; do case $pkg in - compress) - local need=() - ! is_installed "zip" && need+=("zip") - ! is_installed "unzip" && need+=("unzip") - ! is_installed "rar" && need+=("rar") - ! is_installed "unrar" && need+=("unrar") - ! is_installed "p7zip-full" && need+=("p7zip-full") - ! is_installed "p7zip-rar" && need+=("p7zip-rar") - if [ ${#need[@]} -gt 0 ]; then - _run_install_batch "${need[@]}" - echo -e "${GREEN}Compression utilities installed.${NC}" - fi - ;; - curl-wget) - local need=() - ! is_installed "curl" && need+=("curl") - ! is_installed "wget" && need+=("wget") - if [ ${#need[@]} -gt 0 ]; then - _run_install_batch "${need[@]}" - else - echo "curl and wget already installed." - fi - ;; - extrepo) - install_backports_or_stable extrepo - ;; - fwupd) - if ! is_installed "fwupd"; then - _run_cmd "fwupd" "sudo apt install -y fwupd" "Installing fwupd..." - else - echo "fwupd already installed." - fi - if _confirm "Firmware Scan" "Scan for firmware updates now?\n\nThis will run:\n fwupdmgr refresh\n fwupdmgr get-updates\n fwupdmgr update (if available)"; then - _run_cmd "fwupd" "sudo fwupdmgr refresh --force" "Refreshing firmware metadata..." - echo "" - echo "Checking for firmware updates..." - sudo fwupdmgr get-updates 2>&1 || true - if sudo fwupdmgr get-updates 2>&1 | grep -q "available"; then - if _confirm "Firmware Update" "Firmware updates are available.\nInstall them now?"; then - _run_cmd "fwupd" "sudo fwupdmgr update -y" "Installing firmware updates..." - else - echo "Skipping firmware update." - _pause - fi + compress) + local need=() + ! is_installed "zip" && need+=("zip") + ! is_installed "unzip" && need+=("unzip") + ! is_installed "rar" && need+=("rar") + ! is_installed "unrar" && need+=("unrar") + ! is_installed "p7zip-full" && need+=("p7zip-full") + ! is_installed "p7zip-rar" && need+=("p7zip-rar") + if [ ${#need[@]} -gt 0 ]; then + _run_install_batch "${need[@]}" + echo -e "${GREEN}Compression utilities installed.${NC}" + fi + ;; + curl-wget) + local need=() + ! is_installed "curl" && need+=("curl") + ! is_installed "wget" && need+=("wget") + if [ ${#need[@]} -gt 0 ]; then + _run_install_batch "${need[@]}" + else + echo "curl and wget already installed." + fi + ;; + extrepo) + install_backports_or_stable extrepo + ;; + fwupd) + if ! is_installed "fwupd"; then + _run_cmd "fwupd" "sudo apt install -y fwupd" "Installing fwupd..." + else + echo "fwupd already installed." + fi + if _confirm "Firmware Scan" "Scan for firmware updates now?\n\nThis will run:\n fwupdmgr refresh\n fwupdmgr get-updates\n fwupdmgr update (if available)"; then + _run_cmd "fwupd" "sudo fwupdmgr refresh --force" "Refreshing firmware metadata..." + echo "" + echo "Checking for firmware updates..." + sudo fwupdmgr get-updates 2>&1 || true + if sudo fwupdmgr get-updates 2>&1 | grep -q "available"; then + if _confirm "Firmware Update" "Firmware updates are available.\nInstall them now?"; then + _run_cmd "fwupd" "sudo fwupdmgr update -y" "Installing firmware updates..." else - echo "No firmware updates available." + echo "Skipping firmware update." + _pause + fi + else + echo "No firmware updates available." _pause - fi fi - echo -e "${GREEN}fwupd setup complete.${NC}" - _pause - ;; - kvm) - if ! is_installed "virt-manager"; then - _run_cmd "KVM" "sudo apt install -y qemu-system-x86 qemu-utils libvirt-daemon-system libvirt-clients bridge-utils virt-manager" "Installing KVM..." - sudo adduser "$USER" libvirt 2>/dev/null || true - sudo adduser "$USER" kvm 2>/dev/null || true - echo -e "${GREEN}QEMU/KVM installed. A reboot is recommended.${NC}" + fi + echo -e "${GREEN}fwupd setup complete.${NC}" + _pause + ;; + kvm) + if ! is_installed "virt-manager"; then + _run_cmd "KVM" "sudo apt install -y qemu-system-x86 qemu-utils libvirt-daemon-system libvirt-clients bridge-utils virt-manager" "Installing KVM..." + sudo adduser "$USER" libvirt 2>/dev/null || true + sudo adduser "$USER" kvm 2>/dev/null || true + echo -e "${GREEN}QEMU/KVM installed. A reboot is recommended.${NC}" + else + echo "QEMU/KVM already installed." + fi + ;; + wine) + if ! is_installed "wine64"; then + _run_cmd "Wine" "sudo apt install -y --no-install-recommends wine64 fonts-wine" "Installing Wine (64-bit only)..." + local wine_ver + wine_ver=$(wine --version 2>/dev/null) + if [ -n "$wine_ver" ]; then + echo -e "${GREEN}Wine (64-bit) installed: ${wine_ver}${NC}" else - echo "QEMU/KVM already installed." + echo -e "${YELLOW}Wine installed but version check failed.${NC}" fi - ;; - wine) - if ! is_installed "wine64"; then - _run_cmd "Wine" "sudo apt install -y --no-install-recommends wine64 fonts-wine" "Installing Wine (64-bit only)..." - local wine_ver - wine_ver=$(wine --version 2>/dev/null) - if [ -n "$wine_ver" ]; then - echo -e "${GREEN}Wine (64-bit) installed: ${wine_ver}${NC}" - else - echo -e "${YELLOW}Wine installed but version check failed.${NC}" - fi - else - echo "Wine64 already installed." - fi - ;; - nvme-cli) - if ! timeout 2 lsblk -d -o TRAN 2>/dev/null | grep -q "^nvme$"; then - echo "No NVMe controller detected. Skipping." - continue - fi - if ! is_installed "nvme-cli"; then - _run_cmd "nvme-cli" "sudo apt install -y nvme-cli" "Installing nvme-cli..." - fi - local nvme_devs=() - while read -r dev; do - nvme_devs+=("$dev") - done < <(timeout 2 lsblk -d -o NAME,TRAN 2>/dev/null | awk '$2 == "nvme" {print $1}') - if [ ${#nvme_devs[@]} -eq 0 ]; then - echo "No NVMe block devices found for health check." - continue - fi - local dev_list="" - local dev + else + echo "Wine64 already installed." + fi + ;; + nvme-cli) + if ! timeout 2 lsblk -d -o TRAN 2>/dev/null | grep -q "^nvme$"; then + echo "No NVMe controller detected. Skipping." + continue + fi + if ! is_installed "nvme-cli"; then + _run_cmd "nvme-cli" "sudo apt install -y nvme-cli" "Installing nvme-cli..." + fi + local nvme_devs=() + while read -r dev; do + nvme_devs+=("$dev") + done < <(timeout 2 lsblk -d -o NAME,TRAN 2>/dev/null | awk '$2 == "nvme" {print $1}') + if [ ${#nvme_devs[@]} -eq 0 ]; then + echo "No NVMe block devices found for health check." + continue + fi + local dev_list="" + local dev + for dev in "${nvme_devs[@]}"; do + [ -n "$dev_list" ] && dev_list+=", " + dev_list+="/dev/${dev}" + done + if _confirm "NVMe Health" "Run smart-log on ${#nvme_devs[@]} NVMe device(s): ${dev_list}?"; then + echo "" for dev in "${nvme_devs[@]}"; do - [ -n "$dev_list" ] && dev_list+=", " - dev_list+="/dev/${dev}" - done - if _confirm "NVMe Health" "Run smart-log on ${#nvme_devs[@]} NVMe device(s): ${dev_list}?"; then + local cw="" temp="" pu="" + while IFS= read -r line; do + case "$line" in + *critical_warning*) cw="${line##*: }" ;; + *temperature*) temp="${line##*: }" ;; + *percentage_used*) pu="${line##*: }" ;; + esac + done < <(sudo nvme smart-log "/dev/${dev}" 2>/dev/null || true) + echo -e "${YELLOW}━━━ /dev/${dev} ━━━${NC}" + echo -e " ${GREEN}Critical Warning:${NC} ${cw:-N/A}" + echo -e " ${GREEN}Temperature:${NC} ${temp:-N/A}" + echo -e " ${GREEN}Percentage Used:${NC} ${pu:-N/A}" echo "" - for dev in "${nvme_devs[@]}"; do - local cw="" temp="" pu="" - while IFS= read -r line; do - case "$line" in - *critical_warning*) cw="${line##*: }" ;; - *temperature*) temp="${line##*: }" ;; - *percentage_used*) pu="${line##*: }" ;; - esac - done < <(sudo nvme smart-log "/dev/${dev}" 2>/dev/null || true) - echo -e "${YELLOW}━━━ /dev/${dev} ━━━${NC}" - echo -e " ${GREEN}Critical Warning:${NC} ${cw:-N/A}" - echo -e " ${GREEN}Temperature:${NC} ${temp:-N/A}" - echo -e " ${GREEN}Percentage Used:${NC} ${pu:-N/A}" - echo "" - done - _pause - fi - ;; - *) - if ! is_installed "$pkg"; then - _run_install "$pkg" - else - echo "$pkg already installed." - fi - ;; + done + _pause + fi + ;; + *) + if ! is_installed "$pkg"; then + _run_install "$pkg" + else + echo "$pkg already installed." + fi + ;; esac done echo -e "${GREEN}System tools installed.${NC}" _pause } - diff --git a/modules/firmware.sh b/modules/firmware.sh index 328fad2..f8c8008 100644 --- a/modules/firmware.sh +++ b/modules/firmware.sh @@ -17,7 +17,7 @@ _detect_all_network_devices() { PCI_NET_DEVS=() while IFS= read -r line; do PCI_NET_DEVS+=("$line") - done < <(timeout 2 lspci -nn 2>/dev/null | grep -iE 'network controller|ethernet controller' || true) + done < <(echo "$LSPCI_OUTPUT" | grep -iE 'network controller|ethernet controller' || true) USB_WIFI_DEVS=() while IFS= read -r line; do @@ -29,7 +29,7 @@ _detect_all_network_devices() { PCI_BT_DEVS=() while IFS= read -r line; do PCI_BT_DEVS+=("$line") - done < <(timeout 2 lspci -nn 2>/dev/null | grep -i 'Bluetooth controller' || true) + done < <(echo "$LSPCI_OUTPUT" | grep -i 'Bluetooth controller' || true) USB_BT_DEVS=() while IFS= read -r line; do @@ -86,16 +86,16 @@ _detect_firmware_needs() { [[ "$vendor_lc" != *intel* && "$vendor_lc" != *realtek* && "$vendor_lc" != *atheros* && "$vendor_lc" != *qualcomm* && "$vendor_lc" != *mediatek* ]] && continue case "$vendor_lc" in - *intel*) - if echo "$dev" | grep -qiE 'wireless|wi-fi|wlan|802\.11'; then - pkg="firmware-iwlwifi" - else - pkg="firmware-intel-misc" - fi - ;; - *realtek*) pkg="firmware-realtek" ;; - *atheros*|*qualcomm*) pkg="firmware-atheros" ;; - *mediatek*) pkg="firmware-mediatek" ;; + *intel*) + if echo "$dev" | grep -qiE 'wireless|wi-fi|wlan|802\.11'; then + pkg="firmware-iwlwifi" + else + pkg="firmware-intel-misc" + fi + ;; + *realtek*) pkg="firmware-realtek" ;; + *atheros* | *qualcomm*) pkg="firmware-atheros" ;; + *mediatek*) pkg="firmware-mediatek" ;; esac local short_dev @@ -153,7 +153,8 @@ _build_firmware_plan() { if ! $has_bt; then for dev in "${USB_WIFI_DEVS[@]}"; do if echo "$dev" | grep -qi 'bluetooth'; then - has_bt=true; break + has_bt=true + break fi done fi @@ -166,13 +167,14 @@ _build_firmware_plan() { plan+=" [+] bluez + bluez-tools + bluez-obexd (base stack)\n" fi case "${DESKTOP_ENV:-other}" in - kde) plan+=" [+] bluedevil (KDE applet)\n" - if [ "${AUDIO_SERVER:-}" = "pipewire" ]; then - plan+=" → pipewire-pulse + wireplumber (if missing)\n" - fi - ;; - gnome) plan+=" (already in gnome-control-center)\n" ;; - *) plan+=" [+] blueman (GTK Bluetooth manager)\n" ;; + kde) + plan+=" [+] bluedevil (KDE applet)\n" + if [ "${AUDIO_SERVER:-}" = "pipewire" ]; then + plan+=" → pipewire-pulse + wireplumber (if missing)\n" + fi + ;; + gnome) plan+=" (already in gnome-control-center)\n" ;; + *) plan+=" [+] blueman (GTK Bluetooth manager)\n" ;; esac plan+=" → Bluetooth service will be enabled\n" else @@ -224,25 +226,35 @@ _handle_wireless() { [ -z "$bcm_id" ] && continue dev_id=$(echo "$bcm_id" | cut -d: -f2 | tr '[:upper:]' '[:lower:]') - # --- Verificación de headers --- - if ! apt-cache policy linux-headers-amd64 2>/dev/null | grep -q "Candidate: [^ (none)]"; then - _msg "Broadcom Error" "linux-headers-amd64 is not available. Cannot compile Broadcom driver.\n\nEnsure non-free repositories are enabled and run:\n sudo apt install linux-headers-amd64" - _pause + # --- Dependencies verification --- + if ! is_installed "linux-headers-amd64" || ! is_installed "dkms"; then + if ! apt-cache show linux-headers-amd64 dkms >/dev/null 2>&1; then + _msg "Broadcom Error" "linux-headers-amd64 or dkms are not available in your repositories. Cannot compile Broadcom driver.\n\nEnsure repositories are enabled and run:\n sudo apt install linux-headers-amd64 dkms" + _pause + continue + fi + fi + + # --- Confirmation --- + if ! _confirm "Broadcom WiFi" "Detected Broadcom wireless device.\n\nInstall broadcom-sta-dkms, dkms, and wireless-tools?"; then continue fi - # --- Confirmación --- - local bcm_ver header_ver - bcm_ver=$(apt-cache policy broadcom-sta-dkms 2>/dev/null | awk 'NR==3 {print $2}') - header_ver=$(apt-cache policy linux-headers-amd64 2>/dev/null | awk 'NR==3 {print $2}') - if ! _confirm "Broadcom WiFi" "Detected Broadcom wireless device.\n\nInstall broadcom-sta-dkms ${bcm_ver} + linux-headers-amd64 ${header_ver}?"; then - continue - fi + # --- Step-by-step installation --- + _run_cmd "Broadcom Deps" "sudo DEBIAN_FRONTEND=noninteractive apt install -y dkms wireless-tools linux-headers-amd64" || true + _run_cmd "Broadcom Driver" "sudo DEBIAN_FRONTEND=noninteractive apt install -y broadcom-sta-dkms" || true - # --- Instalación --- - _run_cmd "Broadcom" "sudo DEBIAN_FRONTEND=noninteractive apt install -y linux-headers-amd64 broadcom-sta-dkms" || true + # --- Persist blacklist of conflicting modules --- + local blacklist_conf="/etc/modprobe.d/blacklist-broadcom.conf" + local blacklist_content="blacklist b43\nblacklist b43legacy\nblacklist brcmsmac\nblacklist bcma\nblacklist ssb" + echo -e "$blacklist_content" | sudo tee "$blacklist_conf" >/dev/null - # --- Combo BT (sin cambios respecto al código actual) --- + # --- Update initramfs and load module --- + _run_cmd "Initramfs" "sudo update-initramfs -u" || true + _run_cmd "Modprobe" "sudo modprobe -r b43 b43legacy b44 bcma brcmsmac brcmfmac ssb wl 2>/dev/null || true" "Removing conflicting modules" || true + _run_cmd "Modprobe" "sudo modprobe wl" || true + + # --- Combo BT (unchanged) --- local has_broadcom_bt=false local btdev for btdev in "${PCI_BT_DEVS[@]}"; do @@ -258,13 +270,12 @@ _handle_wireless() { echo -e "${YELLOW} A reboot may be required for Bluetooth support.${NC}" fi - # --- Post-DKMS verification (Fix 5, sin cambios) --- + # --- Post-DKMS verification (Fix 5, unchanged) --- if ! ls /lib/modules/$(uname -r)/updates/dkms/wl.ko* 2>/dev/null | grep -q .; then _msg "Broadcom DKMS Build Failed" "The wl module was not built by DKMS.\n\nPossible causes:\n- Missing build tools (build-essential, dkms)\n- Kernel update without headers\n- Incompatible kernel version\n\nTry: sudo dpkg-reconfigure broadcom-sta-dkms" if _confirm "Broadcom" "Rebuild the Broadcom driver now?"; then _run_cmd "Broadcom" "sudo dpkg-reconfigure broadcom-sta-dkms" || true if ls /lib/modules/$(uname -r)/updates/dkms/wl.ko* 2>/dev/null | grep -q .; then - # wl.ko existe tras reconfigure → continuar a limpieza/carga : else local dmesg_out @@ -280,7 +291,6 @@ _handle_wireless() { fi fi - # --- Limpieza de módulos conflictivos + carga wl (patrón Mint) --- sudo modprobe -r b43 b43legacy b44 bcma brcmsmac brcmfmac ssb wl 2>/dev/null || true sudo modprobe wl 2>/dev/null @@ -297,7 +307,7 @@ _handle_wireless() { fi done - # --- USB Broadcom (sin cambios) --- + # --- USB Broadcom (unchanged) --- local usb_dev for usb_dev in "${USB_WIFI_DEVS[@]}"; do if echo "$usb_dev" | grep -qi '0a5c'; then @@ -306,7 +316,7 @@ _handle_wireless() { fi done - # --- Mensaje final (sin cambios) --- + # --- Mensaje final (unchanged) --- if ! $installed_any && ! $wl_build_failed; then echo "No special WiFi firmware needed -- base firmware-linux-nonfree covers this system." _pause @@ -387,7 +397,7 @@ _ensure_nonfree_repo() { return 1 fi - sudo apt update + _ensure_apt_updated echo -e "${GREEN}non-free repository enabled.${NC}" return 0 } @@ -419,7 +429,7 @@ install_firmware() { # 4. Install base firmware meta-package (unchanged logic) local fw_pkg="firmware-linux-nonfree" local fw_bpo - fw_bpo=$(apt-cache madison "$fw_pkg" 2>/dev/null | \ + fw_bpo=$(apt-cache madison "$fw_pkg" 2>/dev/null | grep "${DEBIAN_CODENAME}-backports" | awk '{print $3}' | head -1) local fw_stable diff --git a/modules/gaming.sh b/modules/gaming.sh index 8bef5cf..bbc295d 100644 --- a/modules/gaming.sh +++ b/modules/gaming.sh @@ -60,7 +60,7 @@ ensure_contrib_repo() { return 1 fi - sudo apt update + _ensure_apt_updated echo -e "${GREEN}contrib repository enabled.${NC}" return 0 } @@ -72,15 +72,15 @@ install_gaming() { local choices choices=$(_checklist "Gaming Setup" \ "Check [*] the packages you want installed/updated on your system.\n" $TUI_ALTO $TUI_ANCHO $TUI_ALTO_LISTA \ - "i386" "Enable 32-bit (i386) architecture" ON \ - "steam" "Steam (requires 32-bit support)" ON \ + "i386" "Enable 32-bit (i386) architecture" ON \ + "steam" "Steam (requires 32-bit support)" ON \ "mangohud" "Performance overlay (Vulkan/OpenGL)" ON \ "gamemode" "Game performance optimization" OFF \ "goverlay" "MangoHud config GUI" ON \ - "heroic" "Heroic Launcher (Epic/GOG)" OFF \ - "java" "Minecraft Java Runtime" OFF \ - "openrgb" "OpenRGB (RGB lighting control)" OFF \ - "lutris" "Lutris + Wine (requires 32-bit support)" OFF \ + "heroic" "Heroic Launcher (Epic/GOG)" OFF \ + "java" "Minecraft Java Runtime" OFF \ + "openrgb" "OpenRGB (RGB lighting control)" OFF \ + "lutris" "Lutris + Wine (requires 32-bit support)" OFF \ "retroarch" "RetroArch Emulator Frontend" OFF) if [ -z "$choices" ]; then @@ -95,7 +95,7 @@ install_gaming() { # 2. Determine if 32-bit is needed (steam, lutris, or explicit i386 toggle) local need_32bit=false for p in $cleaned; do - case $p in steam|lutris) need_32bit=true ;; esac + case $p in steam | lutris) need_32bit=true ;; esac done echo "$cleaned" | grep -qw i386 && need_32bit=true @@ -108,7 +108,7 @@ install_gaming() { if $need_32bit && ! dpkg --print-foreign-architectures 2>/dev/null | grep -q i386; then echo -e "${YELLOW}Enabling i386 architecture (required by selection)...${NC}" sudo dpkg --add-architecture i386 - _run_cmd "APT Update" "sudo apt update" "Updating package lists..." + _ensure_apt_updated fi # 4. Install 32-bit graphics drivers only if 32-bit is needed @@ -124,28 +124,28 @@ install_gaming() { # 5. Install selected packages for pkg in $install_list; do case $pkg in - steam) - if ensure_contrib_repo; then - install_steam - else - echo -e "${YELLOW}Skipping Steam installation (contrib repository not enabled).${NC}" - fi - ;; - heroic) install_heroic ;; - java) install_minecraft_java ;; - mangohud) install_mangohud ;; - gamemode) install_gamemode ;; - goverlay) install_goverlay ;; - openrgb) - if [ "$DEBIAN_VERSION" = "11" ]; then - echo "OpenRGB requires Debian 12+." - continue - fi - install_openrgb - ;; - lutris) install_lutris ;; - retroarch) install_retroarch ;; - *) _run_install "$pkg" ;; + steam) + if ensure_contrib_repo; then + install_steam + else + echo -e "${YELLOW}Skipping Steam installation (contrib repository not enabled).${NC}" + fi + ;; + heroic) install_heroic ;; + java) install_minecraft_java ;; + mangohud) install_mangohud ;; + gamemode) install_gamemode ;; + goverlay) install_goverlay ;; + openrgb) + if [ "$DEBIAN_VERSION" = "11" ]; then + echo "OpenRGB requires Debian 12+." + continue + fi + install_openrgb + ;; + lutris) install_lutris ;; + retroarch) install_retroarch ;; + *) _run_install "$pkg" ;; esac done diff --git a/modules/gpu.sh b/modules/gpu.sh index 5876917..a8ec6d5 100644 --- a/modules/gpu.sh +++ b/modules/gpu.sh @@ -19,8 +19,8 @@ _warn_nvidia_gnome_wayland() { command -v gdm3 &>/dev/null || return 0 gnome-shell --version 2>/dev/null | grep -qi "shell 4[0-9]" || return 0 case "$NVIDIA_DRIVER_MODE" in - stable|backports|cuda-repo|extrepo) ;; - *) return 0 ;; + stable | backports | cuda-repo | extrepo) ;; + *) return 0 ;; esac echo -e "${YELLOW}WARNING: Debian bug #1109409 may affect GDM3 + NVIDIA + Wayland.${NC}" echo -e "${YELLOW}If you see a black screen after reboot, select 'GNOME on Xorg' at login.${NC}" @@ -33,7 +33,7 @@ _install_amd_intel_stack() { local ref_ver ref_ver=$(apt-cache policy mesa-vulkan-drivers 2>/dev/null | awk 'NR==3 {print $2; exit}') local ref_bpo_ver - ref_bpo_ver=$(apt-cache madison mesa-vulkan-drivers 2>/dev/null | \ + ref_bpo_ver=$(apt-cache madison mesa-vulkan-drivers 2>/dev/null | grep "${DEBIAN_CODENAME}-backports" | awk '{print $3}' | head -1) local comp_line="Components: Vulkan, OpenGL, GLX, EGL, VA-API (64-bit)" @@ -79,11 +79,13 @@ _install_amd_intel_stack() { local desc desc=$(echo "$gpu_line" | sed -E 's/.*: //; s/ *\(rev.*//') plan+=" GPU ${gpu_count}: ${desc}\n" - done < <(timeout 2 lspci -nn | grep -E "VGA|3D" || true) + done < <(echo "$LSPCI_OUTPUT" | grep -E "VGA|3D" || true) plan+="\nPlanned components:\n" if $HAS_INTEL; then - local _gen; _gen=$(get_intel_generation) - local _va; [ "$_gen" = "gen7-" ] && _va="i965-va-driver-shaders" || _va="intel-media-va-driver-non-free" + local _gen + _gen=$(get_intel_generation) + local _va + [ "$_gen" = "gen7-" ] && _va="i965-va-driver-shaders" || _va="intel-media-va-driver-non-free" plan+=" [+] Intel firmware + ${_va}\n" fi if $HAS_AMD; then @@ -154,7 +156,9 @@ _apply_amd_gcn_grub_fix() { sudo cp "$file" "$backup" - sudo sed -i "/^GRUB_CMDLINE_LINUX_DEFAULT=/ s/\"$*/${params}&/" "$file" + if ! sudo grep -q "amdgpu.si_support=1" "$file"; then + sudo sed -i -E "/^GRUB_CMDLINE_LINUX_DEFAULT=/ s/\"([^\"]*)\"/\"${params} \1\"/" "$file" + fi if _confirm "AMD GCN — GRUB" "Parameters added:\n\n ${params}\n\nRun update-grub now?" 12 65; then if sudo update-grub >/dev/null 2>&1; then @@ -183,7 +187,7 @@ _install_nvidia_stack() { local desc desc=$(echo "$gpu_line" | sed -E 's/.*: //; s/ *\(rev.*//') plan+=" GPU ${gpu_count}: ${desc}\n" - done < <(timeout 2 lspci -nn | grep -E "VGA|3D" || true) + done < <(echo "$LSPCI_OUTPUT" | grep -E "VGA|3D" || true) plan+="\nPlanned:\n [+] NVIDIA proprietary driver" _msg "NVIDIA Stack — Plan" "$plan" 14 65 @@ -213,94 +217,94 @@ _install_nvidia_stack() { local nv_arch="" case "$NVIDIA_SELECTED_VERSION" in - 470) - # Legacy 470 (Kepler/Tesla) — forced, regardless of auto-detection + 470) + # Legacy 470 (Kepler/Tesla) — forced, regardless of auto-detection + _install_nvidia_bookworm_kepler + ;; + 535) + if [ "$(is_nvidia_kepler)" = "true" ]; then _install_nvidia_bookworm_kepler + elif [ "$(is_nvidia_fermi)" = "true" ]; then + _msg "NVIDIA Fermi — Bookworm" \ + "Fermi GPUs (GF1xx) are not supported\nin Debian 12 (Bookworm).\nThe nvidia-legacy-390xx driver is\nnot available in this version.\n\nNo NVIDIA driver will be installed." + NVIDIA_DRIVER_MODE="" + else + _install_nvidia_standard + fi + ;; + 550) + nv_arch=$(detect_nvidia_arch "$NVIDIA_GPU_DEVICE_ID") + case "$nv_arch" in + legacy) + _msg "NVIDIA — Trixie" \ + "Kepler and Fermi GPUs are not supported\nin Debian 13 (Trixie).\n\nThe nvidia-legacy drivers are not available\nin this version of Debian.\n\nNo NVIDIA driver will be installed." + NVIDIA_DRIVER_MODE="" ;; - 535) - if [ "$(is_nvidia_kepler)" = "true" ]; then - _install_nvidia_bookworm_kepler - elif [ "$(is_nvidia_fermi)" = "true" ]; then - _msg "NVIDIA Fermi — Bookworm" \ - "Fermi GPUs (GF1xx) are not supported\nin Debian 12 (Bookworm).\nThe nvidia-legacy-390xx driver is\nnot available in this version.\n\nNo NVIDIA driver will be installed." - NVIDIA_DRIVER_MODE="" - else - _install_nvidia_standard - fi + blackwell) + _msg "NVIDIA — Blackwell (v550)" \ + "Your Blackwell GPU is NOT supported by the official\nDebian v550 driver.\n\nPlease select v590 or v595 (NVIDIA CUDA Repo)\nin the driver menu." 14 65 + NVIDIA_DRIVER_MODE="" ;; - 550) - nv_arch=$(detect_nvidia_arch "$NVIDIA_GPU_DEVICE_ID") - case "$nv_arch" in - legacy) - _msg "NVIDIA — Trixie" \ - "Kepler and Fermi GPUs are not supported\nin Debian 13 (Trixie).\n\nThe nvidia-legacy drivers are not available\nin this version of Debian.\n\nNo NVIDIA driver will be installed." - NVIDIA_DRIVER_MODE="" - ;; - blackwell) - _msg "NVIDIA — Blackwell (v550)" \ - "Your Blackwell GPU is NOT supported by the official\nDebian v550 driver.\n\nPlease select v590 or v595 (NVIDIA CUDA Repo)\nin the driver menu." 14 65 - NVIDIA_DRIVER_MODE="" - ;; - maxwell|pascal|volta) - if [ "$(is_backports_kernel)" = "true" ]; then - local gpu_gen="Maxwell" - [ "$nv_arch" = "pascal" ] && gpu_gen="Pascal" - [ "$nv_arch" = "volta" ] && gpu_gen="Volta" - _msg "NVIDIA — Trixie + Backports" \ - "INCOMPATIBILITY DETECTED: Your NVIDIA ${gpu_gen} GPU\n\ + maxwell | pascal | volta) + if [ "$(is_backports_kernel)" = "true" ]; then + local gpu_gen="Maxwell" + [ "$nv_arch" = "pascal" ] && gpu_gen="Pascal" + [ "$nv_arch" = "volta" ] && gpu_gen="Volta" + _msg "NVIDIA — Trixie + Backports" \ + "INCOMPATIBILITY DETECTED: Your NVIDIA ${gpu_gen} GPU\n\ is NOT supported by the modern v590 driver.\n\n\ To run NVIDIA safely on Debian 13 (Trixie), you MUST use\n\ the official Debian v550 driver, which requires the\n\ standard STABLE Kernel.\n\n\ Forcing the stable driver path." 14 70 - if ! _install_nvidia_standard; then - NVIDIA_DRIVER_MODE="" - return 1 - fi - NVIDIA_DRIVER_MODE="stable" - else - _install_nvidia_standard - fi - ;; - turing|ampere|ada) - _install_nvidia_standard - ;; - *) - if [ "$(is_backports_kernel)" = "true" ]; then - _install_nvidia_cuda_repo - else - _install_nvidia_standard - fi - ;; - esac - ;; - 590|595) - nv_arch=$(detect_nvidia_arch "$NVIDIA_GPU_DEVICE_ID") - if [ "$nv_arch" = "maxwell" ] || [ "$nv_arch" = "pascal" ] || [ "$nv_arch" = "legacy" ]; then - local gpu_gen="Kepler/Fermi" - [ "$nv_arch" = "maxwell" ] && gpu_gen="Maxwell" - [ "$nv_arch" = "pascal" ] && gpu_gen="Pascal" - _msg "NVIDIA — v${NVIDIA_SELECTED_VERSION}" \ - "Your NVIDIA ${gpu_gen} GPU is NOT supported by\nNVIDIA driver v${NVIDIA_SELECTED_VERSION}.\n\n\ -Only Turing, Ampere, Ada and Blackwell GPUs are supported.\n\n\ -No NVIDIA driver will be installed." 14 65 - NVIDIA_DRIVER_MODE="" - else - if ! _enable_cuda_repo; then + if ! _install_nvidia_standard; then NVIDIA_DRIVER_MODE="" - _msg "CUDA Repo — Error" "Failed to enable the official NVIDIA CUDA repository.\n\nNo NVIDIA driver was installed." 10 60 return 1 fi - if _install_nvidia_cuda_repo "$NVIDIA_SELECTED_VERSION"; then - NVIDIA_DRIVER_MODE="cuda-repo" - else - NVIDIA_DRIVER_MODE="" - fi + NVIDIA_DRIVER_MODE="stable" + else + _install_nvidia_standard fi ;; - *) + turing | ampere | ada) _install_nvidia_standard ;; + *) + if [ "$(is_backports_kernel)" = "true" ]; then + _install_nvidia_cuda_repo + else + _install_nvidia_standard + fi + ;; + esac + ;; + 590 | 595) + nv_arch=$(detect_nvidia_arch "$NVIDIA_GPU_DEVICE_ID") + if [ "$nv_arch" = "maxwell" ] || [ "$nv_arch" = "pascal" ] || [ "$nv_arch" = "legacy" ]; then + local gpu_gen="Kepler/Fermi" + [ "$nv_arch" = "maxwell" ] && gpu_gen="Maxwell" + [ "$nv_arch" = "pascal" ] && gpu_gen="Pascal" + _msg "NVIDIA — v${NVIDIA_SELECTED_VERSION}" \ + "Your NVIDIA ${gpu_gen} GPU is NOT supported by\nNVIDIA driver v${NVIDIA_SELECTED_VERSION}.\n\n\ +Only Turing, Ampere, Ada and Blackwell GPUs are supported.\n\n\ +No NVIDIA driver will be installed." 14 65 + NVIDIA_DRIVER_MODE="" + else + if ! _enable_cuda_repo; then + NVIDIA_DRIVER_MODE="" + _msg "CUDA Repo — Error" "Failed to enable the official NVIDIA CUDA repository.\n\nNo NVIDIA driver was installed." 10 60 + return 1 + fi + if _install_nvidia_cuda_repo "$NVIDIA_SELECTED_VERSION"; then + NVIDIA_DRIVER_MODE="cuda-repo" + else + NVIDIA_DRIVER_MODE="" + fi + fi + ;; + *) + _install_nvidia_standard + ;; esac fi diff --git a/modules/gpu/_helpers.sh b/modules/gpu/_helpers.sh index 57374f6..4c7252f 100644 --- a/modules/gpu/_helpers.sh +++ b/modules/gpu/_helpers.sh @@ -3,7 +3,7 @@ declare -A NVIDIA_FAMILY_MAP=( # Fermi / Kepler (Legacy: el shim se encarga de separarlos) - ["06"]="legacy" ["0D"]="legacy" ["0E"]="legacy" + ["06"]="legacy" ["0D"]="legacy" ["0E"]="legacy" ["0F"]="legacy" ["10"]="legacy" ["11"]="legacy" ["12"]="legacy" # Maxwell ["13"]="maxwell" ["14"]="maxwell" ["16"]="maxwell" ["17"]="maxwell" @@ -18,12 +18,15 @@ declare -A NVIDIA_FAMILY_MAP=( # Ada Lovelace ["26"]="ada" ["27"]="ada" ["28"]="ada" # Blackwell - ["29"]="blackwell" ["2B"]="blackwell" ["2C"]="blackwell" + ["29"]="blackwell" ["2B"]="blackwell" ["2C"]="blackwell" ["2D"]="blackwell" ["2E"]="blackwell" ["31"]="blackwell" ) detect_nvidia_arch() { - [ -z "$1" ] && { echo "unknown"; return; } + [ -z "$1" ] && { + echo "unknown" + return + } local pci_id="${1^^}" local prefix="${pci_id:0:2}" echo "${NVIDIA_FAMILY_MAP[$prefix]:-unknown}" @@ -56,21 +59,24 @@ _get_nvidia_arch_family() { fi } -is_nvidia_kepler() { [ -n "$NVIDIA_GPU_DEVICE_ID" ] && [[ "$(detect_nvidia_arch "$NVIDIA_GPU_DEVICE_ID")" == "legacy" ]] && _is_nvidia_kepler_id "$NVIDIA_GPU_DEVICE_ID" && echo true || echo false; } -is_nvidia_fermi() { [ -n "$NVIDIA_GPU_DEVICE_ID" ] && [[ "$(detect_nvidia_arch "$NVIDIA_GPU_DEVICE_ID")" == "legacy" ]] && ! _is_nvidia_kepler_id "$NVIDIA_GPU_DEVICE_ID" && echo true || echo false; } -is_nvidia_legacy() { [ -n "$NVIDIA_GPU_DEVICE_ID" ] && [[ "$(detect_nvidia_arch "$NVIDIA_GPU_DEVICE_ID")" == "legacy" ]] && echo true || echo false; } -is_nvidia_maxwell() { [ -n "$NVIDIA_GPU_DEVICE_ID" ] && [[ "$(detect_nvidia_arch "$NVIDIA_GPU_DEVICE_ID")" == "maxwell" ]] && echo true || echo false; } -is_nvidia_pascal() { [ -n "$NVIDIA_GPU_DEVICE_ID" ] && [[ "$(detect_nvidia_arch "$NVIDIA_GPU_DEVICE_ID")" == "pascal" ]] && echo true || echo false; } -is_nvidia_volta() { [ -n "$NVIDIA_GPU_DEVICE_ID" ] && [[ "$(detect_nvidia_arch "$NVIDIA_GPU_DEVICE_ID")" == "volta" ]] && echo true || echo false; } -is_nvidia_turing() { [ -n "$NVIDIA_GPU_DEVICE_ID" ] && [[ "$(detect_nvidia_arch "$NVIDIA_GPU_DEVICE_ID")" == "turing" ]] && echo true || echo false; } -is_nvidia_ampere() { [ -n "$NVIDIA_GPU_DEVICE_ID" ] && [[ "$(detect_nvidia_arch "$NVIDIA_GPU_DEVICE_ID")" == "ampere" ]] && echo true || echo false; } -is_nvidia_ada() { [ -n "$NVIDIA_GPU_DEVICE_ID" ] && [[ "$(detect_nvidia_arch "$NVIDIA_GPU_DEVICE_ID")" == "ada" ]] && echo true || echo false; } -is_nvidia_blackwell(){ [ -n "$NVIDIA_GPU_DEVICE_ID" ] && [[ "$(detect_nvidia_arch "$NVIDIA_GPU_DEVICE_ID")" == "blackwell" ]] && echo true || echo false; } +is_nvidia_kepler() { [ -n "$NVIDIA_GPU_DEVICE_ID" ] && [[ "$(detect_nvidia_arch "$NVIDIA_GPU_DEVICE_ID")" == "legacy" ]] && _is_nvidia_kepler_id "$NVIDIA_GPU_DEVICE_ID" && echo true || echo false; } +is_nvidia_fermi() { [ -n "$NVIDIA_GPU_DEVICE_ID" ] && [[ "$(detect_nvidia_arch "$NVIDIA_GPU_DEVICE_ID")" == "legacy" ]] && ! _is_nvidia_kepler_id "$NVIDIA_GPU_DEVICE_ID" && echo true || echo false; } +is_nvidia_legacy() { [ -n "$NVIDIA_GPU_DEVICE_ID" ] && [[ "$(detect_nvidia_arch "$NVIDIA_GPU_DEVICE_ID")" == "legacy" ]] && echo true || echo false; } +is_nvidia_maxwell() { [ -n "$NVIDIA_GPU_DEVICE_ID" ] && [[ "$(detect_nvidia_arch "$NVIDIA_GPU_DEVICE_ID")" == "maxwell" ]] && echo true || echo false; } +is_nvidia_pascal() { [ -n "$NVIDIA_GPU_DEVICE_ID" ] && [[ "$(detect_nvidia_arch "$NVIDIA_GPU_DEVICE_ID")" == "pascal" ]] && echo true || echo false; } +is_nvidia_volta() { [ -n "$NVIDIA_GPU_DEVICE_ID" ] && [[ "$(detect_nvidia_arch "$NVIDIA_GPU_DEVICE_ID")" == "volta" ]] && echo true || echo false; } +is_nvidia_turing() { [ -n "$NVIDIA_GPU_DEVICE_ID" ] && [[ "$(detect_nvidia_arch "$NVIDIA_GPU_DEVICE_ID")" == "turing" ]] && echo true || echo false; } +is_nvidia_ampere() { [ -n "$NVIDIA_GPU_DEVICE_ID" ] && [[ "$(detect_nvidia_arch "$NVIDIA_GPU_DEVICE_ID")" == "ampere" ]] && echo true || echo false; } +is_nvidia_ada() { [ -n "$NVIDIA_GPU_DEVICE_ID" ] && [[ "$(detect_nvidia_arch "$NVIDIA_GPU_DEVICE_ID")" == "ada" ]] && echo true || echo false; } +is_nvidia_blackwell() { [ -n "$NVIDIA_GPU_DEVICE_ID" ] && [[ "$(detect_nvidia_arch "$NVIDIA_GPU_DEVICE_ID")" == "blackwell" ]] && echo true || echo false; } is_amd_legacy_gcn() { local dev_id - dev_id=$(timeout 2 lspci -nn | grep -iE "VGA|3D" | grep -i amd | grep -oP '1002:\K[0-9a-fA-F]{4}' | head -n1) - [ -z "$dev_id" ] && { echo false; return; } + dev_id=$(echo "$LSPCI_OUTPUT" | grep -iE "VGA|3D" | grep -i amd | grep -oP '1002:\K[0-9a-fA-F]{4}' | head -n1) + [ -z "$dev_id" ] && { + echo false + return + } local legacy_ids legacy_ids="6660|6664|6665|6667|6780|6784|6788|678a|6798|679a|679e|679f|3000|3001|6808|6809|6810|6811|6816|6817|6818|6819|6828|6829|682b|682c|6835|6837|683d|683f|6608|6609|6610|6611|6613|6617|1dcf|983d|6646|6649|664d|6650|6651|6658|665c|665d|67a0|67a1|67a2|67a8|67a9|67aa|67b0|67b1|67b8|67be|9830|9831|9832|9833|9834|9835|9836|9837|9838|9839|1304|1305|1306|1307|1309|130a|130b|130c|130d|130e|130f|1310|1311|1312|1313|1315|1316|1317|1318|131b|131c|131d|9850|9851|9852|9853|9854|9855|9856|9857|9858|9859|985a|985b|985c|985d|985e|985f" @@ -94,7 +100,7 @@ _install_mesa_backports() { for mpkg in "${mesa_pkgs[@]}"; do local bpo_ver - bpo_ver=$(apt-cache madison "$mpkg" 2>/dev/null | \ + bpo_ver=$(apt-cache madison "$mpkg" 2>/dev/null | grep "${DEBIAN_CODENAME}-backports" | awk '{print $3}' | head -1) if [ -n "$bpo_ver" ]; then bpo_pkgs+=("$mpkg") @@ -114,7 +120,7 @@ _install_mesa_backports() { local ref_ver ref_ver=$(apt-cache policy mesa-vulkan-drivers 2>/dev/null | awk 'NR==3 {print $2; exit}') local ref_bpo_ver - ref_bpo_ver=$(apt-cache madison mesa-vulkan-drivers 2>/dev/null | \ + ref_bpo_ver=$(apt-cache madison mesa-vulkan-drivers 2>/dev/null | grep "${DEBIAN_CODENAME}-backports" | awk '{print $3}' | head -1) local comp_line="Components: Vulkan, OpenGL, GLX, EGL, VA-API (64-bit)" @@ -176,17 +182,17 @@ offer_generic_tools() { _is_hybrid_laptop() { local gpu_count nvidia_count chassis - gpu_count=$(lspci -nn 2>/dev/null | grep -ciE "VGA compatible|3D controller") || true + gpu_count=$(echo "$LSPCI_OUTPUT" | grep -ciE "VGA compatible|3D controller") || true [ "$gpu_count" -lt 2 ] && return 1 # Defensa en profundidad: si TODAS las GPUs son NVIDIA (SLI o # dual-GPU desktop), no hay iGPU Intel/AMD → no es híbrida. - nvidia_count=$(lspci -nn 2>/dev/null | grep -iE "VGA compatible|3D controller" | grep -c "10de:") || true + nvidia_count=$(echo "$LSPCI_OUTPUT" | grep -iE "VGA compatible|3D controller" | grep -c "10de:") || true [ "$nvidia_count" -ge "$gpu_count" ] && return 1 chassis=$(cat /sys/class/dmi/id/chassis_type 2>/dev/null || echo "0") case "$chassis" in - 8|9|10|11|14|30|31|32) return 0 ;; + 8 | 9 | 10 | 11 | 14 | 30 | 31 | 32) return 0 ;; esac ls /sys/class/power_supply/ 2>/dev/null | grep -q "^BAT" && return 0 diff --git a/modules/repos.sh b/modules/repos.sh index 472ff60..7d3988b 100644 --- a/modules/repos.sh +++ b/modules/repos.sh @@ -8,7 +8,7 @@ REPO_BACKUP_DIR="" backup_current_repos() { REPO_BACKUP_DIR=$(mktemp -d) for f in /etc/apt/sources.list /etc/apt/sources.list.d/debian.sources \ - /etc/apt/sources.list.d/debian-backports.list /etc/apt/sources.list.d/debian-backports.sources; do + /etc/apt/sources.list.d/debian-backports.list /etc/apt/sources.list.d/debian-backports.sources; do if [ -f "$f" ]; then mkdir -p "$REPO_BACKUP_DIR/$(dirname "${f#/etc/apt/}")" cp "$f" "$REPO_BACKUP_DIR/$(dirname "${f#/etc/apt/}")/$(basename "$f")" @@ -23,7 +23,7 @@ restore_previous_repos() { echo -e "${RED}Restoring previous repository configuration...${NC}" local found=false for f in /etc/apt/sources.list /etc/apt/sources.list.d/debian.sources \ - /etc/apt/sources.list.d/debian-backports.list /etc/apt/sources.list.d/debian-backports.sources; do + /etc/apt/sources.list.d/debian-backports.list /etc/apt/sources.list.d/debian-backports.sources; do local rel="${f#/etc/apt/}" local backup_file="$REPO_BACKUP_DIR/$rel" if [ -f "$backup_file" ]; then @@ -103,7 +103,7 @@ _write_deb822() { if content_differs "$main_file" "$main_content"; then if _confirm "Deb822 Sources" "Write main deb822 configuration to ${main_file}?"; then sudo mkdir -p /etc/apt/sources.list.d - echo -e "$main_content" | sudo tee "$main_file" > /dev/null + echo -e "$main_content" | sudo tee "$main_file" >/dev/null echo "Wrote ${main_file}" else echo "Main repository configuration skipped." @@ -146,7 +146,7 @@ _write_deb822_backports() { if content_differs "$bp_file" "$bp_content"; then if _confirm "Deb822 Backports" "Write backports to ${bp_file}?"; then sudo mkdir -p /etc/apt/sources.list.d - echo -e "$bp_content" | sudo tee "$bp_file" > /dev/null + echo -e "$bp_content" | sudo tee "$bp_file" >/dev/null echo "Wrote ${bp_file}" else return 1 @@ -154,7 +154,7 @@ _write_deb822_backports() { fi # If backports were formerly embedded in debian.sources, clean them - grep -qE "^Suites:.*${codename}-backports\b" /etc/apt/sources.list.d/debian.sources 2>/dev/null && \ + grep -qE "^Suites:.*${codename}-backports\b" /etc/apt/sources.list.d/debian.sources 2>/dev/null && _clean_embedded_backports_deb822 "$codename" || true } @@ -172,7 +172,7 @@ _remove_deb822_backports() { fi # Also clean any embedded backports in main debian.sources - grep -qE "^Suites:.*${codename}-backports\b" /etc/apt/sources.list.d/debian.sources 2>/dev/null && \ + grep -qE "^Suites:.*${codename}-backports\b" /etc/apt/sources.list.d/debian.sources 2>/dev/null && _clean_embedded_backports_deb822 "$codename" # Clean embedded backports from classic file too (safety net) @@ -199,7 +199,7 @@ _write_classic() { if content_differs "$main_file" "$main_content"; then if _confirm "Classic Sources" "Write main classic configuration to ${main_file}?"; then - echo -e "$main_content" | sudo tee "$main_file" > /dev/null + echo -e "$main_content" | sudo tee "$main_file" >/dev/null echo "Wrote ${main_file}" else echo "Main repository configuration skipped." @@ -240,7 +240,7 @@ _write_classic_backports() { if content_differs "$bp_file" "$bp_content"; then if _confirm "Classic Backports" "Write backports to ${bp_file}?"; then sudo mkdir -p /etc/apt/sources.list.d - echo -e "$bp_content" | sudo tee "$bp_file" > /dev/null + echo -e "$bp_content" | sudo tee "$bp_file" >/dev/null echo "Wrote ${bp_file}" else return 1 @@ -248,7 +248,7 @@ _write_classic_backports() { fi # If backports were formerly embedded in sources.list, clean them - grep -qE "^[^#]*${codename}-backports\b" /etc/apt/sources.list 2>/dev/null && \ + grep -qE "^[^#]*${codename}-backports\b" /etc/apt/sources.list 2>/dev/null && _clean_embedded_backports_classic "$codename" || true } @@ -266,7 +266,7 @@ _remove_classic_backports() { fi # Also clean any embedded backports in main sources.list - grep -qE "^[^#]*${codename}-backports\b" /etc/apt/sources.list 2>/dev/null && \ + grep -qE "^[^#]*${codename}-backports\b" /etc/apt/sources.list 2>/dev/null && _clean_embedded_backports_classic "$codename" # Clean embedded backports from deb822 file too (safety net) @@ -309,17 +309,17 @@ configure_repos() { clear case "$repo_choice" in - 1) _repos_enable_components ;; - 2) _repos_migrate_format ;; - 3) - if [ "$DEBIAN_CODENAME" = "sid" ]; then - break - else - _repos_setup_backports - fi - ;; - 4) _branch_migration || true ;; - 5) break ;; + 1) _repos_enable_components ;; + 2) _repos_migrate_format ;; + 3) + if [ "$DEBIAN_CODENAME" = "sid" ]; then + break + else + _repos_setup_backports + fi + ;; + 4) _branch_migration || true ;; + 5) break ;; esac done } @@ -410,9 +410,15 @@ Adding deb.debian.org may duplicate your current mirror configuration. Continue? fi if $use_deb822; then - _write_deb822 "$DEBIAN_CODENAME" "write" "$bp_enabled" "$bp_location" "$components" || { cleanup_repo_backup; return 1; } + _write_deb822 "$DEBIAN_CODENAME" "write" "$bp_enabled" "$bp_location" "$components" || { + cleanup_repo_backup + return 1 + } else - _write_classic "$DEBIAN_CODENAME" "write" "$bp_enabled" "$bp_location" "$components" || { cleanup_repo_backup; return 1; } + _write_classic "$DEBIAN_CODENAME" "write" "$bp_enabled" "$bp_location" "$components" || { + cleanup_repo_backup + return 1 + } fi # Tidy: with deb822 chosen, an empty classic file is no longer needed @@ -425,7 +431,6 @@ Adding deb.debian.org may duplicate your current mirror configuration. Continue? echo "Updating package lists..." if sudo apt update; then - REPOS_CONFIGURED=true cleanup_repo_backup echo -e "${GREEN}Repository components configured.${NC}" return 0 @@ -514,7 +519,6 @@ Writing debian.sources may duplicate your configuration. Continue?" 10 65; then echo "Updating package lists..." if sudo apt update; then - REPOS_CONFIGURED=true cleanup_repo_backup echo -e "${GREEN}Repository components configured.${NC}" _repos_offer_upgrade @@ -558,7 +562,6 @@ _repos_migrate_format() { echo "Updating package lists..." if sudo apt update; then - REPOS_CONFIGURED=true cleanup_repo_backup echo -e "${GREEN}Repository format migrated to DEB822.${NC}" else @@ -589,8 +592,8 @@ Answer NO to disable or remove backports if they are currently enabled." 16 70; fi # Nothing to do — already in desired state - if { $enable_backports && [ "$bp_status" = "enabled" ]; } || \ - { ! $enable_backports && [ "$bp_status" = "disabled" ]; }; then + if { $enable_backports && [ "$bp_status" = "enabled" ]; } || + { ! $enable_backports && [ "$bp_status" = "disabled" ]; }; then echo "Backports are already configured as requested." _pause return diff --git a/modules/sudo_config.sh b/modules/sudo_config.sh index 2b04832..201d60e 100644 --- a/modules/sudo_config.sh +++ b/modules/sudo_config.sh @@ -19,11 +19,11 @@ config_sudo() { clear case "$choice" in - 1) _check_sudo_group ;; - 2) _configure_nopasswd ;; - 3) _repair_home_ownership ;; - 4) _toggle_pwfeedback ;; - 5) return ;; + 1) _check_sudo_group ;; + 2) _configure_nopasswd ;; + 3) _repair_home_ownership ;; + 4) _toggle_pwfeedback ;; + 5) return ;; esac done } @@ -68,30 +68,35 @@ Useful for automation but reduces security." 14 70; then local choices choices=$(_checklist "NOPASSWD Commands" \ "Select commands to allow without password:" 12 60 3 \ - "apt" "APT package management" ON \ + "apt" "APT package management" ON \ "systemctl" "Systemd service management" ON \ - "power" "Shutdown, reboot, halt" ON) + "power" "Shutdown, reboot, halt" ON) clear - [ -z "$choices" ] && { echo "No commands selected."; return; } - local cleaned; cleaned=$(echo "$choices" | tr -d '"') + [ -z "$choices" ] && { + echo "No commands selected." + return + } + local cleaned + cleaned=$(echo "$choices" | tr -d '"') local content="" for cmd in $cleaned; do case $cmd in - apt) - content+="${USER} ALL=(root) NOPASSWD: /usr/bin/apt, /usr/bin/apt-get, /bin/apt, /bin/apt-get\n" - ;; - systemctl) - content+="${USER} ALL=(root) NOPASSWD: /usr/bin/systemctl, /bin/systemctl\n" - ;; - power) - content+="${USER} ALL=(root) NOPASSWD: /usr/sbin/shutdown, /sbin/shutdown, /usr/sbin/reboot, /sbin/reboot, /usr/sbin/halt, /sbin/halt\n" - ;; + apt) + content+="${USER} ALL=(root) NOPASSWD: /usr/bin/apt, /usr/bin/apt-get, /bin/apt, /bin/apt-get\n" + ;; + systemctl) + content+="${USER} ALL=(root) NOPASSWD: /usr/bin/systemctl, /bin/systemctl\n" + ;; + power) + content+="${USER} ALL=(root) NOPASSWD: /usr/sbin/shutdown, /sbin/shutdown, /usr/sbin/reboot, /sbin/reboot, /usr/sbin/halt, /sbin/halt\n" + ;; esac done - local content_str; content_str=$(echo -e "$content") + local content_str + content_str=$(echo -e "$content") if _validate_sudoers "$content_str" "$nopasswd_file"; then echo -e "${GREEN}Passwordless sudo configured for selected commands.${NC}" else @@ -103,7 +108,7 @@ Useful for automation but reduces security." 14 70; then # ── Option 3: Repair Home Directory Ownership ── _repair_home_ownership() { local home - home=$(eval echo "~$USER") + home=$(getent passwd "${SUDO_USER:-$USER}" | cut -d: -f6) if [ ! -d "$home" ]; then _msg "Home Directory" "Home directory '$home' does not exist." 8 60 diff --git a/modules/sysinfo.sh b/modules/sysinfo.sh index 6cb6f55..3871261 100644 --- a/modules/sysinfo.sh +++ b/modules/sysinfo.sh @@ -37,7 +37,7 @@ _show_sysinfo() { msg+="GPU ${gpu_count}: ${desc}\n" msg+=" Driver: ${mesa_ver:+Mesa }${mesa_ver:-unknown}\n" fi - done < <(timeout 2 lspci -nn | grep -E "VGA|3D" || true) + done < <(echo "$LSPCI_OUTPUT" | grep -E "VGA|3D" || true) fi if ! $found_gpu; then @@ -52,13 +52,13 @@ _show_sysinfo() { declare -a pci_eth_lines=() while IFS= read -r line; do pci_eth_lines+=("$line") - done < <(timeout 2 lspci -d ::0200 2>/dev/null || true) + done < <(echo "$LSPCI_OUTPUT" | grep -i 'ethernet controller' || true) # ── 2. Detect ALL WiFi chipsets (class 0x0280 + vendor fallbacks) ── declare -a pci_wifi_lines=() while IFS= read -r line; do pci_wifi_lines+=("$line") - done < <(timeout 2 lspci -d ::0280 2>/dev/null || true) + done < <(echo "$LSPCI_OUTPUT" | grep -i 'network controller' || true) # Broadcom vendor-ID fallback (14e4) — include only if not already captured while IFS= read -r line; do @@ -69,7 +69,7 @@ _show_sysinfo() { done ! $already && pci_wifi_lines+=("$line") fi - done < <(timeout 2 lspci -nn 2>/dev/null || true) + done < <(echo "$LSPCI_OUTPUT" || true) # USB WiFi fallback local usb_wifi_lines=() @@ -111,7 +111,7 @@ _show_sysinfo() { state=$(echo "$line" | awk '{print $9}') case "$iface" in - lo|docker*|veth*|br-*|virbr*|tun*|tap*|bond*) continue ;; + lo | docker* | veth* | br-* | virbr* | tun* | tap* | bond*) continue ;; esac ip4=$(timeout 2 ip -4 -o addr show "$iface" 2>/dev/null | awk '{print $4}') @@ -121,13 +121,24 @@ _show_sysinfo() { pci_class=$(cat "/sys/class/net/${iface}/device/class" 2>/dev/null || true) case "$pci_class" in - 0x0200*) - has_eth=true - desc="${eth_descs[$eth_idx]:-Unknown Ethernet chipset}" - shown_eth_descs+=("${eth_descs[$eth_idx]:-$desc}") - eth_idx=$((eth_idx + 1)) - ;; - 0x0280*) + 0x0200*) + has_eth=true + desc="${eth_descs[$eth_idx]:-Unknown Ethernet chipset}" + shown_eth_descs+=("${eth_descs[$eth_idx]:-$desc}") + eth_idx=$((eth_idx + 1)) + ;; + 0x0280*) + has_wifi=true + desc="${wifi_descs[$wifi_idx]:-Unknown WiFi chipset}" + shown_wifi_descs+=("${wifi_descs[$wifi_idx]:-$desc}") + wifi_idx=$((wifi_idx + 1)) + ssid="" + [ "$state" = "UP" ] && ssid=$(timeout 2 iwgetid -r "$iface" 2>/dev/null || true) + ;; + *) + # Fallback: classify by interface name pattern + case "$iface" in + wl* | wlp* | wlo* | wlan*) has_wifi=true desc="${wifi_descs[$wifi_idx]:-Unknown WiFi chipset}" shown_wifi_descs+=("${wifi_descs[$wifi_idx]:-$desc}") @@ -135,29 +146,18 @@ _show_sysinfo() { ssid="" [ "$state" = "UP" ] && ssid=$(timeout 2 iwgetid -r "$iface" 2>/dev/null || true) ;; - *) - # Fallback: classify by interface name pattern - case "$iface" in - wl*|wlp*|wlo*|wlan*) - has_wifi=true - desc="${wifi_descs[$wifi_idx]:-Unknown WiFi chipset}" - shown_wifi_descs+=("${wifi_descs[$wifi_idx]:-$desc}") - wifi_idx=$((wifi_idx + 1)) - ssid="" - [ "$state" = "UP" ] && ssid=$(timeout 2 iwgetid -r "$iface" 2>/dev/null || true) - ;; - eth*|enp*|ens*|enx*|eno*) - has_eth=true - desc="${eth_descs[$eth_idx]:-Unknown Ethernet chipset}" - shown_eth_descs+=("${eth_descs[$eth_idx]:-$desc}") - eth_idx=$((eth_idx + 1)) - ;; - *) - has_other=true - desc="(network interface)" - ;; - esac + eth* | enp* | ens* | enx* | eno*) + has_eth=true + desc="${eth_descs[$eth_idx]:-Unknown Ethernet chipset}" + shown_eth_descs+=("${eth_descs[$eth_idx]:-$desc}") + eth_idx=$((eth_idx + 1)) ;; + *) + has_other=true + desc="(network interface)" + ;; + esac + ;; esac if [ "$state" = "UP" ]; then @@ -214,7 +214,7 @@ _show_sysinfo() { term_cols=$(tput cols 2>/dev/null || echo 80) [ "$term_cols" -lt 50 ] && term_cols=50 - local max_pct=$(( term_cols * 95 / 100 )) + local max_pct=$((term_cols * 95 / 100)) [ "$max_pct" -lt 50 ] && max_pct=50 local longest=0 @@ -223,7 +223,7 @@ _show_sysinfo() { [ "$len" -gt "$longest" ] && longest=$len done < <(echo -e "$msg") - local width=$(( longest + 6 )) + local width=$((longest + 6)) [ "$width" -lt 80 ] && width=80 [ "$width" -gt "$max_pct" ] && width=$max_pct @@ -238,8 +238,8 @@ _show_sysinfo() { local lines lines=$(echo -e "$truncated" | wc -l) - local height=$(( lines + 6 )) - local max_height=$(( ${LINES:-24} - 4 > 10 ? ${LINES:-24} - 4 : 10 )) + local height=$((lines + 6)) + local max_height=$((${LINES:-24} - 4 > 10 ? ${LINES:-24} - 4 : 10)) [ "$height" -gt "$max_height" ] && height=$max_height [ "$height" -lt 10 ] && height=10 diff --git a/modules/utils.sh b/modules/utils.sh index da37af0..85490d7 100644 --- a/modules/utils.sh +++ b/modules/utils.sh @@ -22,6 +22,12 @@ WIFI_CHIPSET="" DESKTOP_ENV="" AUDIO_SERVER="" +# APT update deduplication flag (set to 1 after the first successful apt-get update) +APT_UPDATED=0 + +# Cached output of `lspci -nn` for the whole session (populated once via _init_lspci_cache) +LSPCI_OUTPUT="" + # -------------------------- # Pre-flight checks # -------------------------- @@ -109,7 +115,7 @@ _ensure_time_synced() { if [ -n "${DISPLAY:-}" ] || [ -n "${SSH_TTY:-}" ]; then _msg "Timezone" \ "Your system timezone is not set or is set to UTC.\n\nThe script will now open the timezone\nconfiguration tool to set your local timezone." 12 60 -sudo env LC_ALL=C LANGUAGE=C dpkg-reconfigure tzdata || true + sudo env LC_ALL=C LANGUAGE=C dpkg-reconfigure tzdata || true echo -e "${GREEN}Timezone configured: $(timedatectl show -p Timezone --value 2>/dev/null)${NC}" else echo -e "${YELLOW}Timezone not set. Run 'sudo dpkg-reconfigure tzdata' later.${NC}" @@ -136,7 +142,7 @@ sudo env LC_ALL=C LANGUAGE=C dpkg-reconfigure tzdata || true # Debian version detection # -------------------------------- detect_debian_version() { - if ! command -v lsb_release &> /dev/null; then + if ! command -v lsb_release &>/dev/null; then if [ -f /etc/os-release ]; then DEBIAN_CODENAME=$(grep -oP 'VERSION_CODENAME=\K\w+' /etc/os-release 2>/dev/null || echo "") fi @@ -149,13 +155,13 @@ detect_debian_version() { DEBIAN_CODENAME=$(lsb_release -cs 2>/dev/null || echo "") fi case "$DEBIAN_CODENAME" in - bullseye) DEBIAN_VERSION="11" ;; - bookworm) DEBIAN_VERSION="12" ;; - trixie) DEBIAN_VERSION="13" ;; - *) - echo -e "${RED}Unsupported Debian version: '$DEBIAN_CODENAME'. Only 11 (bullseye), 12 (bookworm) and 13 (trixie) are supported.${NC}" - exit 1 - ;; + bullseye) DEBIAN_VERSION="11" ;; + bookworm) DEBIAN_VERSION="12" ;; + trixie) DEBIAN_VERSION="13" ;; + *) + echo -e "${RED}Unsupported Debian version: '$DEBIAN_CODENAME'. Only 11 (bullseye), 12 (bookworm) and 13 (trixie) are supported.${NC}" + exit 1 + ;; esac } @@ -225,12 +231,23 @@ detect_kernel() { KERNEL_VERSION=$(uname -r) } +# ---------------------------------- +# lspci output cache +# ---------------------------------- +# Populates LSPCI_OUTPUT once per session. `lspci -nn` includes the textual PCI +# class (VGA/3D/Ethernet/Network/Bluetooth controller) and the device IDs +# (e.g. 14e4:), so a single capture covers every grep used across modules. +_init_lspci_cache() { + [ -n "${LSPCI_OUTPUT:-}" ] && return + LSPCI_OUTPUT=$(timeout 2 lspci -nn 2>/dev/null || true) +} + # ---------------------------------- # GPU detection # ---------------------------------- detect_gpu() { local gpu_lines - gpu_lines=$(timeout 2 lspci -nn | grep -E "VGA|3D") || true + gpu_lines=$(echo "$LSPCI_OUTPUT" | grep -E "VGA|3D") || true if [ -z "$gpu_lines" ]; then GPU_TYPE="unknown" GPU_DESC="No GPU detected" @@ -257,7 +274,7 @@ detect_gpu() { has_intel=true [ -z "$intel_dev_id" ] && intel_dev_id=$(echo "$line" | grep -oP '8086:\K[0-9a-fA-F]+' | head -n1) fi - done <<< "$gpu_lines" + done <<<"$gpu_lines" GPU_DESC="$desc_lines" HAS_NVIDIA=$has_nvidia @@ -322,21 +339,21 @@ declare -a WIFI_SSIDS=() detect_network() { local eth_line - eth_line=$(timeout 2 lspci -nn | grep -i 'Ethernet controller' | head -n1) || true + eth_line=$(echo "$LSPCI_OUTPUT" | grep -i 'Ethernet controller' | head -n1) || true if [ -n "$eth_line" ]; then ETH_DESC=$(echo "$eth_line" | sed -E 's/^.*\]: //; s/ \[[0-9a-fA-F]{4}:[0-9a-fA-F]{4}\]//; s/ \(rev [0-9a-fA-F]+\)//') fi local wifi_line # Layer 1: grep by PCI class description text - wifi_line=$(timeout 2 lspci -nn 2>/dev/null | grep -iE 'network controller|wireless|wi-fi|wlan|802\.11' | head -n1) || true + wifi_line=$(echo "$LSPCI_OUTPUT" | grep -iE 'network controller|wireless|wi-fi|wlan|802\.11' | head -n1) || true # Layer 2: grep by exact PCI class code 0x0280 (Network controller) if [ -z "$wifi_line" ]; then - wifi_line=$(timeout 2 lspci -d ::0280 2>/dev/null | head -n1) || true + wifi_line=$(echo "$LSPCI_OUTPUT" | grep -i 'network controller' | head -n1) || true fi # Layer 3: Broadcom vendor ID fallback (14e4) if [ -z "$wifi_line" ]; then - wifi_line=$(timeout 2 lspci -nn 2>/dev/null | grep -i '14e4:' | head -n1) || true + wifi_line=$(echo "$LSPCI_OUTPUT" | grep -i '14e4:' | head -n1) || true fi if [ -n "$wifi_line" ]; then WIFI_CHIPSET="$wifi_line" @@ -363,23 +380,23 @@ detect_network() { iface=$(echo "$line" | awk -F': ' '{print $2}' | sed 's/@.*//') state=$(echo "$line" | awk '{print $9}') case "$iface" in - eth*|enp*|ens*|enx*|eno*) - ip4=$(timeout 2 ip -4 -o addr show "$iface" 2>/dev/null | awk '{print $4}') - ETH_NAMES+=("$iface") - ETH_STATES+=("$state") - ETH_IPS+=("${ip4:-}") - ETH_DESCS+=("${ETH_DESC:-}") - ;; - wl*|wlp*|wlo*|wlan*) - ip4=$(timeout 2 ip -4 -o addr show "$iface" 2>/dev/null | awk '{print $4}') - ssid="" - [ "$state" = "UP" ] && ssid=$(timeout 2 iwgetid -r "$iface" 2>/dev/null || true) - WIFI_NAMES+=("$iface") - WIFI_STATES+=("$state") - WIFI_IPS+=("${ip4:-}") - WIFI_SSIDS+=("${ssid:-}") - WIFI_DESCS+=("${WIFI_DESC:-}") - ;; + eth* | enp* | ens* | enx* | eno*) + ip4=$(timeout 2 ip -4 -o addr show "$iface" 2>/dev/null | awk '{print $4}') + ETH_NAMES+=("$iface") + ETH_STATES+=("$state") + ETH_IPS+=("${ip4:-}") + ETH_DESCS+=("${ETH_DESC:-}") + ;; + wl* | wlp* | wlo* | wlan*) + ip4=$(timeout 2 ip -4 -o addr show "$iface" 2>/dev/null | awk '{print $4}') + ssid="" + [ "$state" = "UP" ] && ssid=$(timeout 2 iwgetid -r "$iface" 2>/dev/null || true) + WIFI_NAMES+=("$iface") + WIFI_STATES+=("$state") + WIFI_IPS+=("${ip4:-}") + WIFI_SSIDS+=("${ssid:-}") + WIFI_DESCS+=("${WIFI_DESC:-}") + ;; esac done < <(timeout 2 ip -o link show 2>/dev/null) } @@ -390,18 +407,18 @@ detect_network() { detect_displayserver() { local st="${XDG_SESSION_TYPE:-}" case "$st" in - wayland) DISPLAY_SERVER="Wayland" ;; - x11) DISPLAY_SERVER="X11" ;; - tty) DISPLAY_SERVER="none (tty)" ;; - *) - if [ -n "${WAYLAND_DISPLAY:-}" ]; then - DISPLAY_SERVER="Wayland" - elif [ -n "${DISPLAY:-}" ]; then - DISPLAY_SERVER="X11" - else - DISPLAY_SERVER="unknown" - fi - ;; + wayland) DISPLAY_SERVER="Wayland" ;; + x11) DISPLAY_SERVER="X11" ;; + tty) DISPLAY_SERVER="none (tty)" ;; + *) + if [ -n "${WAYLAND_DISPLAY:-}" ]; then + DISPLAY_SERVER="Wayland" + elif [ -n "${DISPLAY:-}" ]; then + DISPLAY_SERVER="X11" + else + DISPLAY_SERVER="unknown" + fi + ;; esac } @@ -451,10 +468,10 @@ detect_storage() { # --------------------------------------- detect_desktop_environment() { case "${XDG_CURRENT_DESKTOP:-}" in - *GNOME*) DESKTOP_ENV="gnome" ;; - *KDE*) DESKTOP_ENV="kde" ;; - *XFCE*) DESKTOP_ENV="xfce" ;; - *) DESKTOP_ENV="other" ;; + *GNOME*) DESKTOP_ENV="gnome" ;; + *KDE*) DESKTOP_ENV="kde" ;; + *XFCE*) DESKTOP_ENV="xfce" ;; + *) DESKTOP_ENV="other" ;; esac } @@ -483,7 +500,7 @@ get_intel_generation() { fi local dev_int dev_int=$(printf "%d" "$INTEL_GPU_DEVICE_ID") - if [ "$dev_int" -lt 5632 ]; then # 0x1600 = 5632 + if [ "$dev_int" -lt 5632 ]; then # 0x1600 = 5632 echo "gen7-" else echo "gen8+" @@ -498,37 +515,42 @@ get_intel_generation() { # ---------------------------------------------------------------------- is_backports_enabled() { local codename="${DEBIAN_CODENAME:-}" - [ -z "$codename" ] && { echo false; return; } + [ -z "$codename" ] && { + echo false + return + } local c_pattern="^[^#]*${codename}-backports[[:space:]]+" local d_pattern="Suites:.*${codename}-backports" # Classic embedded (sources.list) if [ -f /etc/apt/sources.list ] && grep -Eq "$c_pattern" /etc/apt/sources.list 2>/dev/null; then - echo true; return + echo true + return fi # Classic standalone (any .list file in sources.list.d) if [ -d /etc/apt/sources.list.d ] && grep -qrE "$c_pattern" /etc/apt/sources.list.d/*.list 2>/dev/null; then - echo true; return + echo true + return fi # Deb822 any .sources file if [ -d /etc/apt/sources.list.d ] && grep -qr "$d_pattern" /etc/apt/sources.list.d/*.sources 2>/dev/null; then - echo true; return + echo true + return fi echo false } - install_backports_or_stable() { local pkg="$1" local pkg_desc="${2:-$pkg}" local bpo_ver="" if [ "$(is_backports_enabled)" == true ]; then - bpo_ver=$(apt-cache madison "$pkg" 2>/dev/null | \ + bpo_ver=$(apt-cache madison "$pkg" 2>/dev/null | grep "${DEBIAN_CODENAME}-backports" | awk '{print $3}' | head -1) fi @@ -594,17 +616,20 @@ _msg_red() { } _menu() { - local title="$1" text="$2" h="$3" w="$4" lh="$5"; shift 5 + local title="$1" text="$2" h="$3" w="$4" lh="$5" + shift 5 whiptail --title "$title" --menu "$text" "$h" "$w" "$lh" "$@" 3>&1 1>&2 2>&3 || true } _checklist() { - local title="$1" text="$2" h="$3" w="$4" lh="$5"; shift 5 + local title="$1" text="$2" h="$3" w="$4" lh="$5" + shift 5 whiptail --title "$title" --ok-button "Apply" --checklist "$text" "$h" "$w" "$lh" "$@" 3>&1 1>&2 2>&3 || true } _radiolist() { - local title="$1" text="$2" h="$3" w="$4" lh="$5"; shift 5 + local title="$1" text="$2" h="$3" w="$4" lh="$5" + shift 5 whiptail --title "$title" --ok-button "Install" --radiolist "$text" "$h" "$w" "$lh" "$@" 3>&1 1>&2 2>&3 || true } @@ -616,7 +641,7 @@ _validate_sudoers() { local content="$1" dest="$2" local tmpfile tmpfile=$(mktemp) || return 1 - echo "$content" > "$tmpfile" + echo "$content" >"$tmpfile" if ! /usr/sbin/visudo -cf "$tmpfile" &>/dev/null; then local err err=$(/usr/sbin/visudo -cf "$tmpfile" 2>&1 || true) @@ -701,8 +726,8 @@ _run_install_pkg() { get_backports_kernel_version() { local ver - ver=$(apt-cache policy linux-image-amd64 2>/dev/null | \ - grep -E '^[[:space:]]+[0-9]+\.[0-9]+\.[0-9]+.*~bpo' | head -n1 | awk '{print $1}') + ver=$(apt-cache policy linux-image-amd64 2>/dev/null | + grep -E '^[[:space:]]+[0-9]+\.[0-9]+\.[0-9]+.*~bpo' | head -n1 | awk '{print $1}') if [ -n "$ver" ]; then echo "$ver" else @@ -759,10 +784,29 @@ _check_network() { return 1 } +# ---------------------------------- +# APT update deduplication +# ---------------------------------- +# Runs `apt-get update` at most once per session. Subsequent calls bypass the +# network refresh. Returns 0 on success, 1 if apt-get update fails. +_ensure_apt_updated() { + if [ "$APT_UPDATED" -eq 1 ]; then + echo -e "${GREEN}[+]${NC} APT package lists already refreshed this session." + return 0 + fi + echo -e "${GREEN}[+]${NC} Refreshing APT package lists..." + if sudo apt-get update; then + APT_UPDATED=1 + return 0 + fi + echo -e "${RED}[-]${NC} apt-get update failed." + return 1 +} + # ---------------------------------- # LightDM configuration # ---------------------------------- - _configure_lightdm() { +_configure_lightdm() { command -v lightdm &>/dev/null || return 0 if _confirm "LightDM" "Configure LightDM to show the user list on the login screen?\n\nThis disables greeter-hide-users."; then @@ -782,7 +826,7 @@ _check_network() { fi sudo mkdir -p "$conf_dir" - printf '[Seat:*]\ngreeter-hide-users=false\n' | sudo tee "$conf_file" > /dev/null + printf '[Seat:*]\ngreeter-hide-users=false\n' | sudo tee "$conf_file" >/dev/null echo -e "${GREEN}LightDM configured to show user list.${NC}" fi } @@ -792,4 +836,6 @@ refresh_system_state() { detect_debian_version detect_gpu detect_cpu_ram + detect_network + detect_desktop_environment }