From 4ef48eac3bff42c9ba51ea10041c5e72bd45153b Mon Sep 17 00:00:00 2001 From: stornic56 <71296607+stornic56@users.noreply.github.com> Date: Wed, 1 Jul 2026 00:31:54 -0500 Subject: [PATCH] NTP Sync, LightDM, Wine & Rescue Updates - System Time (NTP)*: Overhauled `modules/utils.sh`. `check_system_time()` now warns if year < 2025 and enables NTP silently if off but valid. `sync_system_time()` conditionally installs/starts `systemd-timesyncd` and verifies synchronization via `timedatectl NTPSynchronized`. - LightDM Configuration: Added `_configure_lightdm()` to ensure the user list is visible in the greeter. Installs `lightdm-gtk-greeter-settings` and creates an override config (`99-show-users.conf`) during startup without interrupting the flow. - Wine Installation: Simplified Wine setup in `system.sh` and Bullseye `extras.sh`. Removed i386 multiarch logic; now installs only `wine64 fonts-wine`. Added post-install version verification to confirm successful deployment. - Lutris Dependencies: Updated `install_lutris()` in `tools.sh` and `legacy.sh`. Now conditionally adds `wine32` only if the system supports i386 architectures, preventing dependency failures on 64-bit-only setups. - Boot Rescue Module: Created new standalone `modules/rescue.sh`. Provides UEFI boot repair tools: Secure Boot refirm (shim + GRUB) and Initramfs regeneration for all kernels. Integrated into the main menu as a dedicated rescue section. - update docs --- debianito.sh | 9 +- docs/gpu.md | 8 +- modules/bullseye/extras.sh | 16 +-- modules/bullseye/legacy.sh | 8 +- modules/extras/java.sh | 4 +- modules/extras/system/system.sh | 18 ++-- modules/gaming/tools.sh | 6 +- modules/rescue.sh | 76 ++++++++++++++ modules/sysinfo.sh | 175 +++++++++++++++++++++++++------- modules/utils.sh | 79 +++++++++----- 10 files changed, 313 insertions(+), 86 deletions(-) create mode 100644 modules/rescue.sh diff --git a/debianito.sh b/debianito.sh index 3e85381..7339c2f 100644 --- a/debianito.sh +++ b/debianito.sh @@ -28,6 +28,7 @@ source "${MODULES_DIR}/repos.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" # ── Bullseye-specific modules (loaded only on Debian 11) ── if [ -d "${MODULES_DIR}/bullseye" ]; then @@ -61,7 +62,8 @@ main_menu() { "7" "Gaming Setup" \ "8" "ZRAM (Swap)" \ "9" "Install Programs and Software" \ - "10" "Exit" \ + "10" "Boot Rescue & Repair" \ + "11" "Exit" \ 3>&1 1>&2 2>&3) clear @@ -109,7 +111,8 @@ kernels. Use the stable kernel provided by Bullseye." 10 60 install_extras || true fi ;; - 10) echo "Exiting."; exit 0 ;; + 10) rescue_boot || true ;; + 11) echo "Exiting."; exit 0 ;; esac done } @@ -125,7 +128,6 @@ if ! _check_network; then echo -e "${YELLOW}──────────────────────────────────────────${NC}" fi check_system_time -sync_system_time detect_debian_version detect_cpu_ram @@ -135,6 +137,7 @@ detect_network detect_displayserver detect_storage detect_desktop_environment +_configure_lightdm detect_audio_server # ── Bullseye-specific init (archive phase) ── diff --git a/docs/gpu.md b/docs/gpu.md index 85f0ec3..9fbdb75 100644 --- a/docs/gpu.md +++ b/docs/gpu.md @@ -48,8 +48,8 @@ This "detect-then-deploy" model prevents users from installing unnecessary drive | **Gen4** (Broadwater) | 65nm | GMA X4500, GMA X4500HD | `i915` | `i915` | Not supported | Predecessor to HD Graphics. Very limited support. The i915 DRI driver is the original, now obsolete. | | **Gen5** (Ironlake) | 32nm | HD Graphics (Westmere/Arrandale) | `i915` | `crocus` | Not supported | First generation "HD Graphics". OpenGL up to 3.3 only. Legacy driver `i965` was **removed** in Mesa 24.1, so `crocus` is now the only option. | | **Gen6** (Sandy Bridge) | 32nm | HD Graphics 2000/3000 | `i915` | `crocus` | Not supported | Significant performance improvement. Maximum OpenGL 3.3. | -| **Gen7** (Ivy Bridge) | 22nm | HD Graphics 2500/4000 | `i915` | `crocus` | `ANV/HASVK ([incomplete/broken](https://www.reddit.com/r/vulkan/s/Hnf5zU8WZY))` | First Gen at 22nm. `crocus` is the recommended OpenGL driver. Vulkan is exposed but completely non-conformant (0.0.0.0 ), lacks basic features (e.g., texture swizzle), and is [unusable for real-world tasks.](www.phoronix.com/news/Intel-HasVK-Drop-Dead-Code)| -| **Gen7** (Bay Trail) | 22nm | HD Graphics (Bay Trail) | `i915` | `crocus` | `ANV ([incomplete](https://lists.debian.org/debian-user/2023/07/msg00550.html))` | `conformanceVersion = 0.0.0.0` Support is experimental up to Vulkan 1.2, lacks basic extensions, and may cause instability. The separate HASVK driver exists but is not used on this system. | +| **Gen7** (Ivy Bridge) | 22nm | HD Graphics 2500/4000 | `i915` | `crocus` | `ANV/HASVK` [(incomplete/broken)](https://www.reddit.com/r/vulkan/s/Hnf5zU8WZY) | First Gen at 22nm. `crocus` is the recommended OpenGL driver. Vulkan is exposed but completely non-conformant (0.0.0.0 ), lacks basic features (e.g., texture swizzle), and is [unusable for real-world tasks](https://www.phoronix.com/news/Intel-HasVK-Drop-Dead-Code).| +| **Gen7** (Bay Trail) | 22nm | HD Graphics (Bay Trail) | `i915` | `crocus` | `ANV`[(incomplete)](https://lists.debian.org/debian-user/2023/07/msg00550.html) | `conformanceVersion = 0.0.0.0` Support is experimental up to Vulkan 1.2, lacks basic extensions, and may cause instability. The separate HASVK driver exists but is not used on this system. | | **Gen7.5** (Haswell) | 22nm | HD Graphics 4600, Iris Pro 5200 | `i915` | `crocus` | `hasvk` | Vulkan support via community driver `hasvk` (Vulkan 1.3). | | **Gen8** (Broadwell) | 14nm | HD Graphics 5300, Iris Pro 6200, Iris 6100 | `i915` | `iris/crocus` | `hasvk` | First generation at 14nm, `iris` becomes the main OpenGL driver. | | **Gen9** (Skylake) | 14nm | HD Graphics 530, Iris 540/550 | `i915` | `iris` | `anv` | Mature architecture with strong Linux support. Major performance boost for iGPU. | @@ -155,8 +155,8 @@ When the script detects Intel or AMD hardware, it triggers a specific installati | Vendor | Kernel Driver (KMD) | Mesa User-Space Driver | VAAPI Backend Strategy | | :--- | :--- | :--- | :--- | -| **Intel Gen < 8** | `i915` | `crocus` / `iris` | Installs `i965-va-driver-shaders`. Legacy path for older CPUs. | -| **Intel Gen 8+** | `i915` | `iris` / `anv` | Installs `intel-media-va-driver-non-free`. Modern, preferred backend for Broadwell+. | +| **Intel Gen < 8** | `i915` | `crocus` / `iris` | Installs [`i965-va-driver-shaders`](https://github.com/intel/intel-vaapi-driver/). Legacy path for older CPUs. | +| **Intel Gen 8+** | `i915` | `iris` / `anv` | Installs [`intel-media-va-driver-non-free](https://github.com/intel/media-driver). Modern, preferred backend for Broadwell+. | | **AMD GCN/RDNA** | `amdgpu` | `radeonsi` (GL) + `RADV` (VK) | Uses standard `va-driver-all`. Requires kernel param tuning for older GCN. | **Critical Consistency Check:** diff --git a/modules/bullseye/extras.sh b/modules/bullseye/extras.sh index f1fec5e..7825238 100644 --- a/modules/bullseye/extras.sh +++ b/modules/bullseye/extras.sh @@ -472,15 +472,17 @@ _cat_general_bullseye() { fi ;; wine) - if ! is_installed "wine"; then - if ! dpkg --print-foreign-architectures 2>/dev/null | grep -q i386; then - sudo dpkg --add-architecture i386 - _run_cmd "APT Update" "sudo apt update" "Updating package lists..." + 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 - _run_cmd "Wine" "sudo apt install -y wine wine32 wine64 libwine libwine:i386 fonts-wine" "Installing Wine..." - echo -e "${GREEN}Wine installed.${NC}" else - echo "Wine already installed." + echo "Wine64 already installed." fi ;; fwupd) diff --git a/modules/bullseye/legacy.sh b/modules/bullseye/legacy.sh index 78b7c47..b3f70e1 100644 --- a/modules/bullseye/legacy.sh +++ b/modules/bullseye/legacy.sh @@ -198,7 +198,13 @@ Installs matching 32-bit graphics drivers."; then ;; gamemode) _run_cmd "GameMode" "sudo apt install -y gamemode" "Installing GameMode..." ;; goverlay) _run_cmd "GOverlay" "sudo apt install -y goverlay" "Installing GOverlay..." ;; - lutris) _run_cmd "Lutris" "sudo apt install -y lutris" "Installing Lutris..." ;; + lutris) + local pkgs="lutris wine64" + if dpkg --print-foreign-architectures 2>/dev/null | grep -q i386; then + pkgs+=" wine32" + fi + _run_cmd "Lutris" "sudo apt install -y $pkgs" "Installing Lutris + Wine..." + ;; java) _install_gaming_java ;; *) _run_install "$pkg" ;; esac diff --git a/modules/extras/java.sh b/modules/extras/java.sh index 77b032b..0c2f2f4 100644 --- a/modules/extras/java.sh +++ b/modules/extras/java.sh @@ -17,9 +17,9 @@ install_minecraft_java() { local choices choices=$(whiptail --title "Java Runtimes for Minecraft" --checklist \ "Select Java version(s) to install:" 14 65 3 \ - "8" "Java 8 — Classic mods & Minecraft <= 1.16.5" ON \ + "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+" ON \ + "21" "Java 21 — Modern Minecraft >= 1.20.5 & 1.21+" OFF \ 3>&1 1>&2 2>&3) [ -z "$choices" ] && { echo "No Java version selected."; return; } _enable_temurin_repo diff --git a/modules/extras/system/system.sh b/modules/extras/system/system.sh index 8fa533a..c278957 100644 --- a/modules/extras/system/system.sh +++ b/modules/extras/system/system.sh @@ -201,17 +201,17 @@ _cat_general() { fi ;; wine) - if ! is_installed "wine"; then - echo "Checking for i386 architecture..." - if ! dpkg --print-foreign-architectures 2>/dev/null | grep -q i386; then - echo "Enabling i386 architecture for Wine..." - sudo dpkg --add-architecture i386 - _run_cmd "APT Update" "sudo apt update" "Updating package lists..." + 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 - _run_cmd "Wine" "sudo apt install -y wine wine32 wine64 libwine libwine:i386 fonts-wine" "Installing Wine..." - echo -e "${GREEN}Wine installed. Run 'winecfg' to configure.${NC}" else - echo "Wine already installed." + echo "Wine64 already installed." fi ;; nvme-cli) diff --git a/modules/gaming/tools.sh b/modules/gaming/tools.sh index bb07452..c66c28d 100644 --- a/modules/gaming/tools.sh +++ b/modules/gaming/tools.sh @@ -18,7 +18,11 @@ install_goverlay() { } install_lutris() { - _run_install lutris + local pkgs="lutris wine64" + if dpkg --print-foreign-architectures 2>/dev/null | grep -q i386; then + pkgs+=" wine32" + fi + _run_cmd "Lutris" "sudo apt install -y $pkgs" "Installing Lutris + Wine..." } install_openrgb() { diff --git a/modules/rescue.sh b/modules/rescue.sh new file mode 100644 index 0000000..a107bec --- /dev/null +++ b/modules/rescue.sh @@ -0,0 +1,76 @@ +#!/usr/bin/env bash +# rescue.sh — UEFI boot repair and system rescue utilities + +_rescue_boot_sb() { + echo -e "${YELLOW}UEFI Secure Boot repair...${NC}" + + if [ ! -d /sys/firmware/efi ]; then + echo -e "${RED}Not a UEFI system. Skipping.${NC}" + _pause + return + fi + + local sb_state + sb_state=$(mokutil --sb-state 2>/dev/null) + if ! echo "$sb_state" | grep -qi "enabled"; then + echo -e "${YELLOW}Secure Boot is not enabled. No refirm needed.${NC}" + _pause + return + fi + + if ! _confirm "Secure Boot Repair" \ + "Secure Boot is enabled.\n\nReinstall and refirm shim-signed + GRUB?\n\nThis fixes boot issues where Debian is skipped\nin UEFI after kernel/driver changes."; then + echo "Skipped." + _pause + return + fi + + local efi_dir="/boot/efi" + [ ! -d "$efi_dir" ] && efi_dir="/boot" + + _run_cmd "Refirm" \ + "sudo apt install --reinstall -y shim-signed grub-efi-amd64-signed linux-image-amd64" \ + "Reinstalling signed boot packages..." + _run_cmd "GRUB Install" \ + "sudo grub-install --target=x86_64-efi --efi-directory=$efi_dir --bootloader-id=debian --recheck" \ + "Reinstalling GRUB to EFI partition..." + _run_cmd "GRUB Config" \ + "sudo update-grub" \ + "Regenerating GRUB configuration..." + + echo -e "${GREEN}Boot repair complete. Reboot to verify.${NC}" + _pause +} + +_rescue_initramfs() { + if ! _confirm "Initramfs" "Regenerate initramfs for all kernels?\n\nFixes boot issues caused by missing drivers\nor corrupted initrd images."; then + echo "Skipped." + _pause + return + fi + _run_cmd "Initramfs" "sudo update-initramfs -u -k all" "Regenerating initramfs for all kernels..." + echo -e "${GREEN}Initramfs regenerated.${NC}" + _pause +} + +rescue_boot() { + while true; do + local choice + choice=$(whiptail --title "Boot Rescue & Repair" --menu \ + "Select a rescue operation${SCROLL_HINT}:" \ + $TUI_ALTO $TUI_ANCHO $TUI_ALTO_LISTA \ + "1" "Refirm Secure Boot (shim + GRUB)" \ + "2" "Regenerate initramfs (all kernels)" \ + "3" "Return to main menu" \ + 3>&1 1>&2 2>&3) + + [ -z "$choice" ] && return + clear + + case "$choice" in + 1) _rescue_boot_sb ;; + 2) _rescue_initramfs ;; + 3) return ;; + esac + done +} diff --git a/modules/sysinfo.sh b/modules/sysinfo.sh index 9e13fb6..5141597 100644 --- a/modules/sysinfo.sh +++ b/modules/sysinfo.sh @@ -45,53 +45,158 @@ _show_sysinfo() { fi msg+="\n" - # ── Network Block ── + # ── Network Block (PCI class + live interfaces) ── msg+="─── Network ───\n" - local has_network=false - local i + + # ── 1. Detect ALL Ethernet chipsets (class 0x0200) ── + declare -a pci_eth_lines=() + while IFS= read -r line; do + pci_eth_lines+=("$line") + done < <(lspci -d ::0200 2>/dev/null || 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 < <(lspci -d ::0280 2>/dev/null || true) + + # Broadcom vendor-ID fallback (14e4) — include only if not already captured + while IFS= read -r line; do + if echo "$line" | grep -qi '14e4:'; then + local already=false + for existing in "${pci_wifi_lines[@]}"; do + [ "$existing" = "$line" ] && already=true && break + done + ! $already && pci_wifi_lines+=("$line") + fi + done < <(lspci -nn 2>/dev/null || true) + + # USB WiFi fallback + local usb_wifi_lines=() + while IFS= read -r line; do + usb_wifi_lines+=("$line") + done < <(lsusb 2>/dev/null | grep -iE 'wireless|wifi|wlan|802\.11' || true) + + # ── 3. Build chipset description arrays ── + local -a eth_descs=() + local -a wifi_descs=() + local line desc + + for line in "${pci_eth_lines[@]}"; do + desc=$(echo "$line" | sed -E 's/^.*\]: //; s/ \[[0-9a-fA-F]{4}:[0-9a-fA-F]{4}\]//; s/ \(rev [0-9a-fA-F]+\)//') + eth_descs+=("$desc") + done + for line in "${pci_wifi_lines[@]}"; do + desc=$(echo "$line" | sed -E 's/^.*\]: //; s/ \[[0-9a-fA-F]{4}:[0-9a-fA-F]{4}\]//; s/ \(rev [0-9a-fA-F]+\)//') + wifi_descs+=("$desc") + done + for line in "${usb_wifi_lines[@]}"; do + desc=$(echo "$line" | sed 's/^.*ID //') + wifi_descs+=("$desc") + done + + # ── 4. Enumerate live interfaces ── + local -a shown_eth_descs=() + local -a shown_wifi_descs=() + local has_eth=false has_wifi=false has_other=false if ! command -v ip &>/dev/null; then msg+="(install iproute2 for interface details)\n" else - for i in "${!ETH_NAMES[@]}"; do - has_network=true - local e_iface="${ETH_NAMES[$i]}" - local e_desc="${ETH_DESCS[$i]:-$ETH_DESC}" - local e_state="${ETH_STATES[$i]}" - local e_ip4="${ETH_IPS[$i]}" - if [ "$e_state" = "UP" ]; then - msg+="${e_iface}: ${e_desc}\n ↑ ${e_ip4:-no IP}\n" - else - msg+="${e_iface}: ${e_desc}\n ↓\n" - fi - done + while IFS= read -r line; do + local iface state ip4 ssid + iface=$(echo "$line" | awk -F': ' '{print $2}' | sed 's/@.*//') + state=$(echo "$line" | awk '{print $9}') - local found_active_wifi=false - for i in "${!WIFI_NAMES[@]}"; do - found_active_wifi=true - has_network=true - local w_iface="${WIFI_NAMES[$i]}" - local w_desc="${WIFI_DESCS[$i]:-$WIFI_DESC}" - local w_state="${WIFI_STATES[$i]}" - local w_ip4="${WIFI_IPS[$i]}" - local w_ssid="${WIFI_SSIDS[$i]}" - if [ "$w_state" = "UP" ]; then - msg+="${w_iface}: ${w_desc}\n ↑ ${w_ip4:-no IP}" - [ -n "$w_ssid" ] && msg+=" \"${w_ssid}\"" + case "$iface" in + lo|docker*|veth*|br-*|virbr*|tun*|tap*|bond*) continue ;; + esac + + ip4=$(ip -4 -o addr show "$iface" 2>/dev/null | awk '{print $4}') + + # Determine type by PCI class (most reliable) + local pci_class="" + pci_class=$(cat "/sys/class/net/${iface}/device/class" 2>/dev/null || true) + + case "$pci_class" in + 0x0200*) + has_eth=true + desc="${eth_descs[0]:-Unknown Ethernet chipset}" + shown_eth_descs+=("${eth_descs[0]}") + ;; + 0x0280*) + has_wifi=true + desc="${wifi_descs[0]:-Unknown WiFi chipset}" + shown_wifi_descs+=("${wifi_descs[0]}") + ssid="" + [ "$state" = "UP" ] && ssid=$(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[0]:-Unknown WiFi chipset}" + shown_wifi_descs+=("${wifi_descs[0]}") + ssid="" + [ "$state" = "UP" ] && ssid=$(iwgetid -r "$iface" 2>/dev/null || true) + ;; + eth*|enp*|ens*|enx*|eno*) + has_eth=true + desc="${eth_descs[0]:-Unknown Ethernet chipset}" + shown_eth_descs+=("${eth_descs[0]}") + ;; + *) + has_other=true + desc="(network interface)" + ;; + esac + ;; + esac + + if [ "$state" = "UP" ]; then + msg+="${iface}: ${desc}\n ↑ ${ip4:-no IP}" + if [ "$pci_class" = "0x0280" ] || [[ "$iface" == wl* ]]; then + [ -n "${ssid:-}" ] && msg+=" \"${ssid}\"" + fi msg+="\n" else - msg+="${w_iface}: ${w_desc}\n ↓\n" + msg+="${iface}: ${desc}\n ↓\n" fi + done < <(ip -o link show 2>/dev/null) + fi + + # ── 5. Show chipsets without an active interface ── + local chip + + for chip in "${eth_descs[@]}"; do + local found=false + for shown in "${shown_eth_descs[@]}"; do + [ "$chip" = "$shown" ] && found=true && break done - - if ! $found_active_wifi && [ -n "$WIFI_DESC" ]; then - has_network=true - msg+="WiFi: ${WIFI_DESC}\n" - msg+=" (no driver — use Firmware option in main menu)\n" + if ! $found; then + msg+="Ethernet: ${chip}\n (no active interface)\n" + shown_eth_descs+=("$chip") fi + done - if ! $has_network; then - msg+="No active interfaces detected\n" + for chip in "${wifi_descs[@]}"; do + local found=false + for shown in "${shown_wifi_descs[@]}"; do + [ "$chip" = "$shown" ] && found=true && break + done + if ! $found; then + msg+="WiFi: ${chip}\n (no active interface)\n" + shown_wifi_descs+=("$chip") + fi + done + + # ── 6. Nothing at all ── + if ! $has_eth && ! $has_wifi && ! $has_other && [ ${#eth_descs[@]} -eq 0 ] && [ ${#wifi_descs[@]} -eq 0 ]; then + if command -v ip &>/dev/null; then + msg+="No network interfaces detected\n" + else + msg+="(install iproute2 for interface details)\n" fi fi diff --git a/modules/utils.sh b/modules/utils.sh index cca5874..eb594a2 100644 --- a/modules/utils.sh +++ b/modules/utils.sh @@ -43,11 +43,11 @@ check_sudo() { # Time sync detection + NTP # -------------------------------- check_system_time() { - if ! command -v timedatectl &> /dev/null; then - return - fi + command -v timedatectl &>/dev/null || return + local year year=$(date +%Y) + if [ "$year" -lt 2025 ]; then local msg="System date/time appears to be incorrect\n" msg+="($(date '+%Y-%m-%d %H:%M')). This will prevent Debian\n" @@ -56,31 +56,40 @@ check_system_time() { msg+="(requires network access and timedatectl)" if _confirm "System Date" "$msg"; then sync_system_time - local new_year - new_year=$(date +%Y) - if [ "$new_year" -ge 2025 ]; then - echo -e "${GREEN}Time synced: $(date '+%Y-%m-%d %H:%M')${NC}" - else - echo -e "${RED}Could not sync time automatically.${NC}" - echo "You may need to set it manually: sudo date --set \"YYYY-MM-DD HH:MM:SS\"" - fi else echo -e "${YELLOW}Warning: System time is incorrect. Package installations may fail.${NC}" fi + return + fi + + local ntp_active + ntp_active=$(timedatectl show --property=NTP --value 2>/dev/null || echo "no") + if [ "$ntp_active" != "yes" ]; then + sync_system_time fi } sync_system_time() { - if command -v timedatectl &> /dev/null; then - local ntp_active - ntp_active=$(timedatectl show --property=NTP --value 2>/dev/null || echo "no") - if [ "$ntp_active" != "yes" ]; then - echo -e "${YELLOW}NTP not active. Attempting to enable time sync...${NC}" - sudo timedatectl set-ntp true 2>/dev/null || true - sleep 4 - fi - elif command -v hwclock &> /dev/null && command -v ntpd &> /dev/null; then - sudo hwclock --hctosys 2>/dev/null || true + command -v timedatectl &>/dev/null || return + + if ! is_installed systemd-timesyncd; then + sudo DEBIAN_FRONTEND=noninteractive apt install -y systemd-timesyncd || true + fi + + if ! systemctl is-enabled systemd-timesyncd &>/dev/null; then + sudo systemctl enable systemd-timesyncd || true + fi + if ! systemctl is-active systemd-timesyncd &>/dev/null; then + sudo systemctl start systemd-timesyncd || true + fi + + sudo timedatectl set-ntp true || true + sleep 4 + + if timedatectl show --property=NTPSynchronized --value 2>/dev/null | grep -q yes; then + echo -e "${GREEN}Time synchronized: $(date '+%Y-%m-%d %H:%M')${NC}" + else + echo -e "${YELLOW}NTP sync did not complete.${NC}" fi } @@ -93,9 +102,8 @@ detect_debian_version() { DEBIAN_CODENAME=$(grep -oP 'VERSION_CODENAME=\K\w+' /etc/os-release 2>/dev/null || echo "") fi if [ -z "$DEBIAN_CODENAME" ]; then - echo -e "${YELLOW}Installing lsb-release...${NC}" - sync_system_time - sudo apt update -qq 2>/dev/null && sudo apt install -y -qq lsb-release + sync_system_time || true + sudo apt update -qq 2>/dev/null && sudo apt install -y -qq lsb-release || true fi fi if [ -z "$DEBIAN_CODENAME" ]; then @@ -661,3 +669,26 @@ _check_network() { return 1 } + +# ---------------------------------- +# LightDM configuration +# ---------------------------------- +_configure_lightdm() { + command -v lightdm &>/dev/null || return 0 + + if ! is_installed lightdm-gtk-greeter-settings; then + echo -e "${YELLOW}Installing lightdm-gtk-greeter-settings...${NC}" + sudo DEBIAN_FRONTEND=noninteractive apt install -y lightdm-gtk-greeter-settings + fi + + local conf_dir="/etc/lightdm/lightdm.conf.d" + local conf_file="${conf_dir}/99-show-users.conf" + + if [ -f "$conf_file" ] && grep -q '^greeter-hide-users=false' "$conf_file"; then + return + fi + + sudo mkdir -p "$conf_dir" + printf '[Seat:*]\ngreeter-hide-users=false\n' | sudo tee "$conf_file" > /dev/null + echo -e "${GREEN}LightDM configured to show user list.${NC}" +}