System-Wide Refactor & Critical Fixes

- Resolved NVIDIA driver management issues by expanding package detection patterns (including nvidia-open and nvidia-kernel-open-dkms), enhancing purge process to ensure clean uninstallation of v590/595 drivers, and adding conditional skip for manage menu when no driver is installed.  
- Enhanced Firefox variant selection in internet.sh using exact token matching (grep -qx) instead of substring search to prevent incorrect removal or unintended ESR/Firefox conflicts. 
- New XFCE install option with 4 options
- Restructured Desktop Environment into two-level menu system with dispatcher and Xfce sub-menu for scalability, enabling future additions like GNOME/KDE without disrupting existing flows.  
- Added Polkit rules in desktop_display.sh to grant suspend permissions without password prompts on laptops, including idempotent group (backlight) creation and user membership management with || true fallbacks.  
- Enforced LC_ALL=C LANGUAGE=C environment variables for all dpkg-reconfigure commands across System Preferences and utils.sh to ensure native dialogues run consistently in English.  
- Fixed kernel backports menu option availability to only appear on Debian 13, preventing errors on Debian 12 where backports repositories are EOL.  
- Improved ZRAM module initialization sequence by ensuring swapoff and zram module removal occur before writing new configuration files to prevent race conditions during system setup.
This commit is contained in:
stornic56
2026-08-17 23:50:39 -05:00
committed by GitHub
parent dbd2dfca37
commit 0e24e8f9ae
10 changed files with 413 additions and 40 deletions
+118 -1
View File
@@ -11,13 +11,130 @@ manage_desktop_display() {
[ -z "$choice" ] && break
clear
case "$choice" in
1) _msg "Coming Soon" "Desktop Environment management will be available in a future update." 10 60 ;;
1) desktop_environment_menu ;;
2) display_manager_menu ;;
3) break ;;
esac
done
}
desktop_environment_menu() {
while true; do
local -a env_items=()
env_items+=("1" "XFCE")
env_items+=("2" "Back")
# Future desktop environments: add "2" "GNOME", "3" "KDE", ... here
# and a matching case below calling its own menu (e.g. gnome_menu).
local choice
choice=$(_menu "Desktop Environment" \
"Select a desktop environment:" $TUI_ALTO $TUI_ANCHO $TUI_ALTO_LISTA \
"${env_items[@]}")
[ -z "$choice" ] && break
clear
case "$choice" in
1) xfce_menu ;;
2) break ;;
esac
done
}
xfce_menu() {
while true; do
local -a xf_items=()
xf_items+=("1" "XFCE (Full Meta Package)")
xf_items+=("2" "XFCE (Minimal Core)")
[ "$DEBIAN_VERSION" = "13" ] && xf_items+=("3" "XFCE Wayland (Experimental — labwc)")
xf_items+=("4" "XFCE Custom (Choose packages)")
xf_items+=("5" "Back")
local choice
choice=$(_menu "XFCE" \
"Select an option:" $TUI_ALTO $TUI_ANCHO $TUI_ALTO_LISTA \
"${xf_items[@]}")
[ -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 ;;
esac
done
}
_install_xfce_full() {
_run_cmd "XFCE Full" "sudo apt install -y xfce4 xfce4-goodies xfce4-power-manager" \
"Installing XFCE (Full Meta Package)..."
_xfce_polkit_rules
}
_install_xfce_minimal() {
_run_cmd "XFCE Minimal" "sudo apt install -y xfce4" \
"Installing XFCE (Minimal Core)..."
_xfce_polkit_rules
}
_install_xfce_wayland() {
_run_cmd "XFCE Wayland" "sudo apt install -y xfce4 labwc" \
"Installing XFCE + labwc (Wayland, experimental)..."
_msg "XFCE Wayland" "labwc is EXPERIMENTAL on XFCE 4.20.\n\nAfter reboot, select the Wayland session\nfrom the login screen." 12 65
_xfce_polkit_rules
}
_install_xfce_custom() {
local -a items=()
for pkg in thunar xfdesktop4 xfwm4 xfce4-panel xfce4-terminal \
xfce4-screenshooter ristretto mousepad xfce4-session \
xfce4-settings xfce4-power-manager; do
items+=("$pkg" "$pkg" "$(_state "$pkg")")
done
local choices
choices=$(_checklist "XFCE Custom" \
"Select the XFCE packages to install:" $TUI_ALTO $TUI_ANCHO $TUI_ALTO_LISTA \
"${items[@]}")
[ -z "$choices" ] && return
local cleaned
cleaned=$(echo "$choices" | tr -d '"')
[ -z "$cleaned" ] && return
_run_cmd "XFCE Custom" "sudo apt install -y $cleaned" \
"Installing selected XFCE packages..."
_xfce_polkit_rules
}
_xfce_polkit_rules() {
is_installed xfce4-power-manager || return 0
local rules_dir="/etc/polkit-1/rules.d"
sudo mkdir -p "$rules_dir"
cat <<'EOF' | sudo tee "$rules_dir/85-suspend.rules" >/dev/null
polkit.addRule(function(action, subject) {
if (action.id == "org.freedesktop.login1.suspend" &&
subject.isInGroup("users")) {
return polkit.Result.YES;
}
});
EOF
cat <<'EOF' | sudo tee "$rules_dir/89-backlight.rules" >/dev/null
polkit.addRule(function(action, subject) {
if (action.id == "org.freedesktop.upower.backlight" &&
subject.isInGroup("backlight")) {
return polkit.Result.YES;
}
});
EOF
if ! getent group backlight >/dev/null 2>&1; then
sudo groupadd --system backlight || true
fi
local de_user="${SUDO_USER:-$USER}"
if [ -n "$de_user" ] && ! id -nG "$de_user" 2>/dev/null | grep -qw backlight; then
sudo usermod -aG backlight "$de_user" || true
fi
sudo systemctl restart polkit.service 2>/dev/null || true
echo -e "${GREEN}Polkit rules installed (suspend + backlight). User '${de_user}' added to 'backlight' group.${NC}"
}
display_manager_menu() {
while true; do
local -a dm_items=()