From cc40c0c60eecf749659c6c42ced865ad637b8c68 Mon Sep 17 00:00:00 2001 From: "Vester \"Vic\" Thacker" Date: Sun, 16 Nov 2025 14:02:32 +0900 Subject: [PATCH] Fix CONFIG_DIR to check system-wide location first The CONFIG_DIR was hardcoded to "$SCRIPT_DIR/cardDetect", causing the script to look for configuration templates in /usr/local/bin/cardDetect when installed via the port, rather than the correct system-wide location at /usr/local/etc/X11/cardDetect. This change updates the CONFIG_DIR initialization to: 1. Check /usr/local/etc/X11/cardDetect first (system-wide installation) 2. Fall back to $SCRIPT_DIR/cardDetect (development/portable usage) This matches the documented dual-location behavior in README.md and ensures the script works correctly when installed via the x11/xconfig port, which installs config templates to /usr/local/etc/X11/cardDetect per the Makefile. The script now functions correctly in both scenarios: - Production: Installed via pkg/port with configs in /usr/local/etc/X11 - Development: Run in-tree with configs in ./cardDetect Fixes issue where xconfig couldn't find XF86Config.* templates during GhostBSD bootstrap when installed from package. --- bin/xconfig | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bin/xconfig b/bin/xconfig index 7478333..02bbeec 100755 --- a/bin/xconfig +++ b/bin/xconfig @@ -13,7 +13,13 @@ SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" LOG_FILE="/var/log/xconfig.log" XORG_CONF="/etc/X11/xorg.conf" BACKUP_DIR="/etc/X11/backup" -CONFIG_DIR="$SCRIPT_DIR/cardDetect" + +# Try system-wide location first, then fall back to development location +if [ -d "/usr/local/etc/X11/cardDetect" ]; then + CONFIG_DIR="/usr/local/etc/X11/cardDetect" +else + CONFIG_DIR="$SCRIPT_DIR/cardDetect" +fi # Logging with structured output (stderr-safe for $(...) usage) log() {