mirror of
https://github.com/stornic56/debianito-post-install.git
synced 2026-07-16 13:59:50 +00:00
Displays managers & zram menu
- LightDM Overhaul: Rewrote `install_lightdm()` logic to verify both lightdm and lightdm-gtk-gtk-greeter-settings. Now installs the trio in a single command if missing, skipping only when fully present. Added "Enable autologin" option modifying `/etc/lightdm/lightdm.conf` with robust `sed` patterns for `SUDO_USER`. Fixed missing `debconf-set-selections` to ensure LightDM is set as default during installation. - GDM3 Implementation: Created a new sub-menu in `modules/desktop_display.sh` allowing independent installation of GDM3, User List toggle (hide/show), Autologin configuration via `/etc/gdm3/daemon.conf`, and conditional "Force Enable Wayland on NVIDIA" for Debian 12/13 using udev symlinks. - SDDM Integration: Added SDDM as option 3 in the Display Manager menu. Implemented automatic session detection (Wayland > X11) to populate `/etc/sddm.conf.d/autologin.conf` without user input, defaulting to plasmawayland, lxqt-wayland, or generic fallbacks. - greetd support: Added conditional support for Debian 12 and 13 only. Implemented sub-menu with base install, recommended `tuigreet` (with backports handling for Bookworm), and other manual setup options (`gtkgreet`, `nwg-hello`, `wlgreet`) exclusive to Trixie. - ZRAM UX Improvements: Updated descriptions in `modules/zram.sh` to explicitly mention I/O reduction and responsiveness benefits for low-RAM systems (e.g., 4GB). Cleaned up compression algorithm labels (`lz4`, `zstd`) to remove redundancy in menu values. - General Code Quality: Standardized all user-facing messages to English across modules. Ensured independent package installation checks prevent script abortion if one DM fails, while maintaining strict error handling for system configurations. - update docs and readme
This commit is contained in:
+218
-16
@@ -20,16 +20,28 @@ manage_desktop_display() {
|
||||
|
||||
display_manager_menu() {
|
||||
while true; do
|
||||
local -a dm_items=()
|
||||
dm_items+=("1" "LightDM")
|
||||
dm_items+=("2" "GDM3")
|
||||
dm_items+=("3" "SDDM")
|
||||
if [ "$DEBIAN_VERSION" = "12" ] || [ "$DEBIAN_VERSION" = "13" ]; then
|
||||
dm_items+=("4" "greetd")
|
||||
dm_items+=("5" "Back")
|
||||
else
|
||||
dm_items+=("4" "Back")
|
||||
fi
|
||||
local choice
|
||||
choice=$(_menu "Display Manager" \
|
||||
"Select an option:" $TUI_ALTO $TUI_ANCHO 6 \
|
||||
"1" "LightDM" \
|
||||
"2" "Back")
|
||||
"${dm_items[@]}")
|
||||
[ -z "$choice" ] && break
|
||||
clear
|
||||
case "$choice" in
|
||||
1) lightdm_config_menu ;;
|
||||
2) break ;;
|
||||
2) configure_gdm3 ;;
|
||||
3) configure_sddm ;;
|
||||
4) configure_greetd ;;
|
||||
5) break ;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
@@ -37,7 +49,8 @@ display_manager_menu() {
|
||||
lightdm_config_menu() {
|
||||
local -a items=()
|
||||
items+=("install_lightdm" "Install LightDM & GTK Greeter" "$(_state lightdm)")
|
||||
items+=("enable_userlist" "Enable user list" "OFF")
|
||||
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 \
|
||||
@@ -52,17 +65,13 @@ lightdm_config_menu() {
|
||||
for item in $cleaned; do
|
||||
case $item in
|
||||
install_lightdm)
|
||||
if ! is_installed lightdm; then
|
||||
_run_cmd "LightDM" "sudo apt install -y lightdm" "Installing LightDM..."
|
||||
else
|
||||
echo -e "${GREEN}[LightDM] already installed, skipping...${NC}"
|
||||
fi
|
||||
if ! is_installed lightdm-gtk-greeter-settings; then
|
||||
_run_cmd "LightDM Settings" "sudo apt install -y lightdm-gtk-greeter-settings" "Installing LightDM Settings..."
|
||||
else
|
||||
echo -e "${GREEN}[LightDM Settings] already installed, skipping...${NC}"
|
||||
fi
|
||||
;;
|
||||
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")"
|
||||
@@ -73,7 +82,200 @@ greeter-hide-users=false" | sudo tee "$conf" > /dev/null; then
|
||||
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() {
|
||||
while true; do
|
||||
local -a gd_items=()
|
||||
gd_items+=("1" "Install base greetd")
|
||||
gd_items+=("2" "Install greetd + tuigreet (Recommended TUI greeter)")
|
||||
if [ "$DEBIAN_VERSION" = "13" ]; then
|
||||
gd_items+=("3" "Install gtkgreet (Requires manual setup)")
|
||||
gd_items+=("4" "Install nwg-hello (Requires manual setup)")
|
||||
gd_items+=("5" "Install wlgreet (Requires manual setup)")
|
||||
gd_items+=("6" "Back")
|
||||
else
|
||||
gd_items+=("3" "Back")
|
||||
fi
|
||||
local choice
|
||||
choice=$(_menu "greetd Configuration" \
|
||||
"Select an option${SCROLL_HINT}:" \
|
||||
$TUI_ALTO $TUI_ANCHO $TUI_ALTO_LISTA \
|
||||
"${gd_items[@]}")
|
||||
[ -z "$choice" ] && return
|
||||
clear
|
||||
case "$choice" in
|
||||
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"
|
||||
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
|
||||
_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 ;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
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")
|
||||
if [ "$DEBIAN_VERSION" = "12" ] || [ "$DEBIAN_VERSION" = "13" ]; then
|
||||
if [ "$HAS_NVIDIA" = true ]; then
|
||||
items_enabled+=("wayland" "Force Enable Wayland on NVIDIA (Risk!)" "OFF")
|
||||
fi
|
||||
fi
|
||||
local choice
|
||||
choice=$(_checklist "GDM3 Configuration" \
|
||||
"Select options to apply${SCROLL_HINT}:" \
|
||||
$TUI_ALTO $TUI_ANCHO $TUI_ALTO_LISTA \
|
||||
"${items_enabled[@]}")
|
||||
[ -z "$choice" ] && return
|
||||
clear
|
||||
|
||||
local cleaned
|
||||
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}"
|
||||
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
|
||||
;;
|
||||
esac
|
||||
done
|
||||
_pause
|
||||
done
|
||||
}
|
||||
|
||||
configure_sddm() {
|
||||
while true; do
|
||||
local choice
|
||||
choice=$(_menu "SDDM Configuration" \
|
||||
"Select an option${SCROLL_HINT}:" \
|
||||
$TUI_ALTO $TUI_ANCHO $TUI_ALTO_LISTA \
|
||||
"1" "Install SDDM (Set as default)" \
|
||||
"2" "Enable Autologin" \
|
||||
"3" "Back")
|
||||
[ -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
|
||||
[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 ;;
|
||||
esac
|
||||
done
|
||||
_pause
|
||||
}
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ install_extras() {
|
||||
|
||||
while true; do
|
||||
local cat_choice
|
||||
cat_choice=$(_menu "Extra Software" \
|
||||
cat_choice=$(_menu "Install Programs and Software" \
|
||||
"Select a category${SCROLL_HINT}:" $TUI_ALTO $TUI_ANCHO $TUI_ALTO_LISTA \
|
||||
"0" "Essential Pack" \
|
||||
"1" "Customization System" \
|
||||
|
||||
+1
-1
@@ -373,7 +373,7 @@ install_firmware() {
|
||||
# 2. Plan
|
||||
local plan
|
||||
plan=$(_build_firmware_plan)
|
||||
_msg "Firmware & Wireless Setup" "$plan" 22 72
|
||||
_msg "Firmware, Wireless & Bluetooth Setup" "$plan" 22 72
|
||||
|
||||
# 3. Confirm
|
||||
if ! _confirm "Firmware" "Apply the network & firmware plan?"; then
|
||||
|
||||
+2
-2
@@ -282,13 +282,13 @@ configure_repos() {
|
||||
local repo_choice
|
||||
|
||||
if [ "$DEBIAN_CODENAME" = "sid" ]; then
|
||||
repo_choice=$(_menu "Repositories" \
|
||||
repo_choice=$(_menu "Configure Repositories" \
|
||||
"Select an option:" $TUI_ALTO $TUI_ANCHO 6 \
|
||||
"1" "Enable Contrib & Non-Free Components" \
|
||||
"2" "Migrate traditional sources.list to DEB822 format" \
|
||||
"3" "Back to main menu")
|
||||
else
|
||||
repo_choice=$(_menu "Repositories" \
|
||||
repo_choice=$(_menu "Configure Repositories" \
|
||||
"Select an option:" $TUI_ALTO $TUI_ANCHO 6 \
|
||||
"1" "Enable Contrib & Non-Free Components" \
|
||||
"2" "Migrate traditional sources.list to DEB822 format" \
|
||||
|
||||
+1
-1
@@ -161,7 +161,7 @@ manage_swap() {
|
||||
|
||||
while true; do
|
||||
local choice
|
||||
choice=$(_menu "Swap Management (disk)" \
|
||||
choice=$(_menu "Swap Management" \
|
||||
"Select an option:" $TUI_ALTO $TUI_ANCHO 6 \
|
||||
"1" "Show current swap & swappiness" \
|
||||
"2" "Create / resize swapfile" \
|
||||
|
||||
+4
-10
@@ -12,17 +12,11 @@ install_zram() {
|
||||
local half_ram_mb=$(( ((RAM_KB / 1024 / 1024 + 1) / 2) * 1024 ))
|
||||
|
||||
local algo
|
||||
algo=$(_menu "ZRAM Compression" \
|
||||
"ZRAM compresses a portion of RAM into compressed swap,\
|
||||
effectively increasing available memory.
|
||||
|
||||
Useful for systems with limited RAM or when you need
|
||||
more swap space without disk writes.
|
||||
|
||||
Choose compression algorithm:" \
|
||||
algo=$(_menu "ZRAM Configuration" \
|
||||
"ZRAM creates a compressed block device in RAM to use as swap. This reduces disk I/O and can significantly improve responsiveness on systems with limited memory (e.g., 4GB RAM or less), at the cost of a small amount of CPU usage." \
|
||||
$TUI_ALTO $TUI_ANCHO $TUI_ALTO_LISTA \
|
||||
"lz4" "Fastest, low CPU (recommended)" \
|
||||
"zstd" "Better ratio, more CPU")
|
||||
"lz4" "Fastest compression/decompression. Lowest CPU overhead. (Default)" \
|
||||
"zstd" "Higher compression ratio. Saves slightly more memory but uses more CPU.")
|
||||
|
||||
if [ -z "$algo" ]; then
|
||||
echo "ZRAM configuration cancelled."
|
||||
|
||||
Reference in New Issue
Block a user