Fix Maldet directory detection after extraction
Problem: - cd maldetect-* was failing because glob expansion doesn't work reliably in this context - Error: "Cannot find extracted directory" Solution: - Use find command to locate extracted directory explicitly - Store directory path in variable before cd - Add diagnostic output showing available directories on failure - More robust error handling with explicit directory checks
This commit is contained in:
@@ -235,9 +235,20 @@ install_all_scanners() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Change to extracted directory
|
# Find the extracted directory
|
||||||
if ! cd maldetect-* 2>/dev/null; then
|
local maldet_dir=$(find /tmp -maxdepth 1 -type d -name "maldetect-*" 2>/dev/null | head -1)
|
||||||
|
if [ -z "$maldet_dir" ]; then
|
||||||
echo -e "${RED}✗ Cannot find extracted directory${NC}"
|
echo -e "${RED}✗ Cannot find extracted directory${NC}"
|
||||||
|
echo " Available directories in /tmp:"
|
||||||
|
ls -la /tmp | grep maldetect | sed 's/^/ /'
|
||||||
|
cd /tmp
|
||||||
|
rm -rf "maldetect-"*
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Change to extracted directory
|
||||||
|
if ! cd "$maldet_dir"; then
|
||||||
|
echo -e "${RED}✗ Cannot access directory: $maldet_dir${NC}"
|
||||||
cd /tmp
|
cd /tmp
|
||||||
rm -rf "maldetect-"*
|
rm -rf "maldetect-"*
|
||||||
return 1
|
return 1
|
||||||
|
|||||||
Reference in New Issue
Block a user