Files
debianito-post-install/modules/zram.sh
T
stornic56 d8878b67e1 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
2026-07-16 01:02:51 -05:00

62 lines
2.0 KiB
Bash

#!/usr/bin/env bash
# zram.sh - Configure compressed swap in RAM
install_zram() {
echo -e "${YELLOW}ZRAM Configuration${NC}"
if [ -z "$RAM_KB" ] || [ "$RAM_KB" -eq 0 ]; then
echo -e "${RED}Could not determine RAM size. Aborting.${NC}"
return 1
fi
local half_ram_mb=$(( ((RAM_KB / 1024 / 1024 + 1) / 2) * 1024 ))
local algo
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 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."
return 0
fi
local zram_size
if _confirm "ZRAM Size" "Use recommended size for ZRAM? (${half_ram_mb} MB out of ${RAM_SUMMARY})"; then
zram_size=$half_ram_mb
else
zram_size=$(_inputbox "ZRAM Size" "Enter ZRAM size in MB:" 8 60 "$half_ram_mb")
if [ -z "$zram_size" ] || ! [[ "$zram_size" =~ ^[0-9]+$ ]] || [ "$zram_size" -eq 0 ]; then
echo "ZRAM configuration cancelled."
return 0
fi
fi
if ! _confirm "ZRAM Summary" "Algorithm: ${algo}\nSize: ${zram_size} MB\nPriority: 100\n\nApply?"; then
echo "ZRAM configuration cancelled."
return 0
fi
_run_cmd "ZRAM" "sudo apt install -y zram-tools" "Installing zram-tools..."
echo "Writing configuration..."
sudo tee /etc/default/zramswap > /dev/null <<EOF
ALGO=$algo
SIZE=$zram_size
PRIORITY=100
EOF
echo "Restarting zramswap service..."
sudo systemctl restart zramswap
echo ""
echo -e "${GREEN}ZRAM configured successfully.${NC}"
echo ""
sudo zramctl
echo ""
echo -e "${GREEN}You can verify with: sudo zramctl${NC}"
_pause
}