BREAKING CHANGE: Removes --target and --gpu-driver flags, unified ISO for all use cases ## Phase 0: GPU Fix + Unified ISO ### Core Changes **GPU Package Installation (FIXES CRITICAL GAP):** - Add clawdie_shell_nvidia_install() function to shell-nvidia.sh - NVIDIA drivers now installed after detection (previously only configured) - Works offline (USB packages) or online (pkg install) - Resolves issue where rc.conf was set but driver not installed **Unified ISO Architecture:** - Remove --target flag from build.sh (no more vps/baremetal branching) - Remove --gpu-driver flag from build.sh (runtime detection instead) - All packages included on every ISO (desktop + all GPU drivers) - Single image works on VPS, baremetal, and cloud **Runtime Detection:** - Add shell-desktop.sh for display detection at firstboot - VPS/cloud: no display → lightdm disabled (headless) - Baremetal: display detected → lightdm enabled (Lumina desktop) - GPU detection always runs, installs correct driver version **Sudo Unification:** - Replace all doas references with sudo across entire codebase - Update AGENTS.md with system configuration guidelines - Update all documentation (BUILD.md, README.md, REQUIREMENTS.md, etc.) - Admin panel now uses sudo for privileged operations ### Files Modified **Core System:** - build.sh: Remove target/gpu-driver logic, unified package selection - firstboot/firstboot.sh: Add desktop detection module - firstboot/shell-nvidia.sh: Add package installation function (+33 lines) **New Files:** - firstboot/shell-desktop.sh: Display detection and desktop enablement - packages/pkg-list-nvidia-all.txt: All three NVIDIA driver versions (390/470/590) - .opencode/plans/phase0-gpu-fix-unified-iso.md: Implementation plan **Documentation:** - PLAN-UNIFY.md: Update Step 3 for unified approach - REQUIREMENTS.md: Simplify (no target choice), update for sudo - BUILD.md: Update for unified ISO, sudo commands - README.md: Update installation instructions - AGENTS.md: Add system configuration section (sudo standardization) - ADMIN-PANEL.md: Update privileged operations to use sudo - CLAWDIE-SHELL.md: Update example commands to sudo - CLAWDIE-ISO-REFACTORED.md: Update access paths to sudo - REFACTOR-SUMMARY.md: Update permissions section to sudo ### Benefits **Simplicity:** - One build command: ./build.sh (no flags needed) - One ISO to test and maintain - No wrong choices for users - No documentation explaining target differences **Flexibility:** - VPS can use GUI via VNC (wayvnc always available) - Baremetal can run headless (disable lightdm) - Repurpose hardware without reinstall - All GPU drivers available for any hardware **Technical:** - Fixes critical GPU driver installation gap - Runtime detection replaces build-time decisions - Disk overhead: ~650MB (1-2% of 50GB - acceptable) - No runtime overhead on VPS (services disabled by detection) ### Testing Required - [ ] Build unified ISO: ./build.sh - [ ] Test on VPS (no display): lightdm disabled, packages installed - [ ] Test on baremetal (display): lightdm enabled, Lumina boots - [ ] Test on NVIDIA hardware: driver installed and loaded - [ ] Test sudo commands work without password prompts - [ ] Verify all doas references removed
101 lines
3.2 KiB
Bash
101 lines
3.2 KiB
Bash
#!/bin/sh
|
|
# Clawdie Shell — Desktop Enablement Module
|
|
# Purpose: Detect display and enable/disable desktop accordingly
|
|
# POSIX-compliant (no bash-isms)
|
|
|
|
set -eu
|
|
|
|
# Configuration (can be overridden for testing)
|
|
RC_CONF="${RC_CONF:-/etc/rc.conf}"
|
|
LOG_FILE="${LOG_FILE:-/var/log/clawdie-firstboot.log}"
|
|
PROGRESS_FILE="${PROGRESS_FILE:-/var/log/clawdie-firstboot.progress}"
|
|
|
|
# ============================================================================
|
|
# MAIN ENTRY POINT
|
|
# ============================================================================
|
|
|
|
clawdie_shell_desktop_detect() {
|
|
# Detect display hardware and configure desktop accordingly
|
|
# VPS/cloud: no display → headless (lightdm disabled)
|
|
# Baremetal: display detected → Lumina desktop (lightdm enabled)
|
|
|
|
log_msg "[desktop] Detecting display configuration"
|
|
|
|
# Check for display controller in PCI devices
|
|
local display_device
|
|
display_device=$(pciconf -lv 2>/dev/null | grep -i "class=0x030000" | head -1 || true)
|
|
|
|
if [ -n "$display_device" ]; then
|
|
log_msg "[desktop] Display controller found - enabling Lumina desktop"
|
|
|
|
# Enable lightdm for graphical login
|
|
if command -v sysrc >/dev/null 2>&1; then
|
|
sysrc lightdm_enable=YES >/dev/null 2>&1 || true
|
|
else
|
|
# Fallback: direct rc.conf edit
|
|
if ! grep -q "^lightdm_enable=" "$RC_CONF" 2>/dev/null; then
|
|
echo 'lightdm_enable="YES"' >> "$RC_CONF"
|
|
else
|
|
sed -i.bak 's/^lightdm_enable=.*/lightdm_enable="YES"/' "$RC_CONF"
|
|
rm -f "$RC_CONF.bak"
|
|
fi
|
|
fi
|
|
|
|
echo "[DESKTOP] LUMINA" >> "$PROGRESS_FILE"
|
|
log_msg "[desktop] Desktop enabled (lightdm_enable=YES)"
|
|
else
|
|
log_msg "[desktop] No display controller - headless mode"
|
|
|
|
# Disable lightdm for headless operation
|
|
if command -v sysrc >/dev/null 2>&1; then
|
|
sysrc lightdm_enable=NO >/dev/null 2>&1 || true
|
|
else
|
|
# Fallback: direct rc.conf edit
|
|
if ! grep -q "^lightdm_enable=" "$RC_CONF" 2>/dev/null; then
|
|
echo 'lightdm_enable="NO"' >> "$RC_CONF"
|
|
else
|
|
sed -i.bak 's/^lightdm_enable=.*/lightdm_enable="NO"/' "$RC_CONF"
|
|
rm -f "$RC_CONF.bak"
|
|
fi
|
|
fi
|
|
|
|
echo "[DESKTOP] HEADLESS" >> "$PROGRESS_FILE"
|
|
log_msg "[desktop] Desktop disabled (lightdm_enable=NO)"
|
|
log_msg "[desktop] wayvnc available for remote graphical access"
|
|
fi
|
|
|
|
log_msg "[desktop] Desktop configuration complete"
|
|
}
|
|
|
|
# ============================================================================
|
|
# VALIDATION
|
|
# ============================================================================
|
|
|
|
clawdie_shell_desktop_validate() {
|
|
# Verify desktop configuration
|
|
|
|
if [ ! -f "$RC_CONF" ]; then
|
|
log_msg "[desktop] ERROR: $RC_CONF not found"
|
|
return 1
|
|
fi
|
|
|
|
if ! grep -q "^lightdm_enable=" "$RC_CONF" 2>/dev/null; then
|
|
log_msg "[desktop] ERROR: lightdm_enable not configured"
|
|
return 1
|
|
fi
|
|
|
|
return 0
|
|
}
|
|
|
|
# ============================================================================
|
|
# LOGGING HELPER
|
|
# ============================================================================
|
|
|
|
log_msg() {
|
|
echo "$(date '+%H:%M:%S') $1" | tee -a "$LOG_FILE" 2>/dev/null || true
|
|
}
|
|
|
|
# Only run if sourced directly (not during test)
|
|
if [ "${SHELL_DESKTOP_TEST:-0}" -eq 0 ]; then
|
|
clawdie_shell_desktop_detect
|
|
fi
|