fix(kiosk): Skip X11 config on bare metal in kiosk launcher too

Same fix as build-live-usb.sh X11 setup - the kiosk launcher was also
creating X11 config files that corrupted on bare metal.

- Skip config creation entirely for bare metal (vm_type=none)
- Intel/AMD/NVIDIA auto-detection works perfectly without configs
- Sanitize gpu_info for VMs (remove special chars)
- Only create explicit driver configs for VMs that need them

Fixes: "M2G_" parse error in /etc/X11/xorg.conf.d/10-kiosk.conf

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
CyberMind-FR 2026-04-15 10:09:09 +02:00
parent 529fcce5a1
commit d5fd350e88

View File

@ -261,15 +261,30 @@ XWRAP
log "No GPU detected → vesa driver (safe mode)"
fi
# Clean existing configs
# Clean existing configs that might cause issues
rm -f /etc/X11/xorg.conf /etc/X11/xorg.conf.d/*.conf
mkdir -p /etc/X11/xorg.conf.d
# Write X11 config with VM-appropriate settings
# BARE METAL: Skip X11 config entirely - auto-detection works best
# Intel/AMD/NVIDIA drivers work perfectly without explicit config
if [[ "$vm_type" == "none" ]]; then
log "Bare metal detected - skipping X11 config (auto-detection is best)"
# Just ensure Xwrapper is configured
cat > /etc/X11/Xwrapper.config <<'XWRAP'
allowed_users=anybody
needs_root_rights=yes
XWRAP
return 0
fi
# VMs only: Write X11 config with explicit driver
# Sanitize gpu_info to avoid special chars breaking the config
local gpu_info_safe
gpu_info_safe=$(echo "$gpu_info" | tr -d '<>()[]{}' | head -c 100)
cat > /etc/X11/xorg.conf.d/10-kiosk.conf <<XCONF
# Generated by secubox-kiosk-launcher
# Generated by secubox-kiosk-launcher (VM mode)
# VM Type: $vm_type
# GPU: $gpu_info
# GPU: $gpu_info_safe
# Driver: $driver
Section "Device"