From 826e18306b465e9d5f3300e32e483901da676aad Mon Sep 17 00:00:00 2001 From: cschantz Date: Tue, 2 Dec 2025 17:34:15 -0500 Subject: [PATCH] CRITICAL FIX: Correct SCRIPT_DIR path calculation in enable-cphulk.sh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit BUG #6 - Wrong SCRIPT_DIR calculation (line 22) PROBLEM: - Script located at: /root/server-toolkit/modules/security/enable-cphulk.sh - Old path: dirname/../ = /root/server-toolkit/modules (WRONG!) - Library files at: /root/server-toolkit/lib/ IMPACT: - source "$SCRIPT_DIR/lib/common-functions.sh" → FILE NOT FOUND - source "$SCRIPT_DIR/lib/system-detect.sh" → FILE NOT FOUND - Script would FAIL immediately on startup ROOT CAUSE: Script in modules/security/ subdirectory (2 levels deep) But path calculation only went up 1 level FIX: Changed from: dirname "${BASH_SOURCE[0]}")/.." Changed to: dirname "${BASH_SOURCE[0]}")/../.." Now goes up 2 levels: /modules/security → /modules → /root/server-toolkit VERIFICATION: ✓ Tested: SCRIPT_DIR now resolves to /root/server-toolkit ✓ Verified: lib/common-functions.sh found ✓ Verified: lib/system-detect.sh found ✓ Syntax validation: PASS This was the MOST CRITICAL bug - script couldn't even start! 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- modules/security/enable-cphulk.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/security/enable-cphulk.sh b/modules/security/enable-cphulk.sh index 497ccb6..cf2d7e7 100755 --- a/modules/security/enable-cphulk.sh +++ b/modules/security/enable-cphulk.sh @@ -18,8 +18,8 @@ # - Supports multiple IP formats: simple IPs, s=IP, d=IP, CIDR notation ################################################################################ -# Get script directory -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +# Get script directory (go up 2 levels: /modules/security -> /modules -> /root/server-toolkit) +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" source "$SCRIPT_DIR/lib/common-functions.sh" source "$SCRIPT_DIR/lib/system-detect.sh"