CRITICAL FIX: Correct SCRIPT_DIR path calculation in enable-cphulk.sh
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 <noreply@anthropic.com>
This commit is contained in:
@@ -18,8 +18,8 @@
|
|||||||
# - Supports multiple IP formats: simple IPs, s=IP, d=IP, CIDR notation
|
# - Supports multiple IP formats: simple IPs, s=IP, d=IP, CIDR notation
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
# Get script directory
|
# Get script directory (go up 2 levels: /modules/security -> /modules -> /root/server-toolkit)
|
||||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
||||||
source "$SCRIPT_DIR/lib/common-functions.sh"
|
source "$SCRIPT_DIR/lib/common-functions.sh"
|
||||||
source "$SCRIPT_DIR/lib/system-detect.sh"
|
source "$SCRIPT_DIR/lib/system-detect.sh"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user