mirror of
https://github.com/stornic56/debianito-post-install.git
synced 2026-09-14 06:02:35 +00:00
dual-gpu & audio fixes + flatpak migration
- Fixed `set -euo pipefail` crashes across hardware detection: Added `|| true` guards to all `nvidia-smi`, `dpkg -l`, `apt-cache policy`, and `nvidia-detect` pipelines in `sysinfo.sh` (3 lines) and `gpu/nvidia.sh` (7+ lines). - Created new Audio & Sound module (`modules/extras/audio/audio.sh`) with Debian version-specific logic: Bullseye basic mode vs Bookworm/Trixie standard PipeWire stack, plus ALSA utilities, pavucontrol, pulsemixer, playerctl. Added menu entry "14 Audio & Sound". - Migrated Flatpak from System Tools to Software Center category. Renamed menu to "Software Center & Flatpak", converted single-select to multi-select checklist in `software_centers.sh`, removed logic from `system.sh`. - Implemented robust time synchronization: New `_ensure_time_synced()` function in `utils.sh` forces NTP active, validates timezone with interactive `dpkg-reconfigure tzdata` if needed, restarts `systemd-timesyncd`, and verifies sync status. Replaced `check_system_time` call in main script. - Fixed System Info network detection: Removed hardcoded 2-line height limit (now dynamic via terminal size), fixed hard-coded array indices to use progressive counters for multiple interfaces including USB WiFi adapters.
This commit is contained in:
@@ -93,6 +93,45 @@ sync_system_time() {
|
||||
fi
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
# Robust time sync: NTP + timezone validation + service restart
|
||||
# -------------------------------------------------------------------
|
||||
_ensure_time_synced() {
|
||||
command -v timedatectl &>/dev/null || return
|
||||
|
||||
# ── Paso 1: Forzar NTP activo ──
|
||||
sudo timedatectl set-ntp true --no-ask-password 2>/dev/null || true
|
||||
|
||||
# ── Paso 2: Validar zona horaria ──
|
||||
local tz
|
||||
tz=$(timedatectl show -p Timezone --value 2>/dev/null || echo "")
|
||||
if [ -z "$tz" ] || [ "$tz" = "n/a" ] || [ "$tz" = "Etc/UTC" ]; then
|
||||
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 dpkg-reconfigure tzdata
|
||||
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}"
|
||||
fi
|
||||
fi
|
||||
|
||||
# ── Paso 3: Instalar/asegurar systemd-timesyncd ──
|
||||
if ! is_installed systemd-timesyncd; then
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt install -y systemd-timesyncd || true
|
||||
fi
|
||||
sudo systemctl enable systemd-timesyncd 2>/dev/null || true
|
||||
sudo systemctl restart systemd-timesyncd 2>/dev/null || true
|
||||
|
||||
# ── Paso 4: Verificar resultado ──
|
||||
sleep 2
|
||||
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 yet (may need a moment).${NC}"
|
||||
fi
|
||||
}
|
||||
|
||||
# --------------------------------
|
||||
# Debian version detection
|
||||
# --------------------------------
|
||||
|
||||
Reference in New Issue
Block a user