Fix: Handle different extracted directory names for Maldet installation
Issue: Installation failed because script expected 'maldetect-*' directory but GitHub releases extract to 'rfxn-linux-malware-detect-*'. Root cause: Hardcoded glob pattern 'cd maldetect-*' didn't match actual extracted directory name. Solution: - Use find to locate extracted directory (matches both *malware* and *maldet*) - Check if install.sh exists before attempting to run it - Better error messages showing what went wrong - Also clean up rfxn-linux-malware-detect-* directories - Proper error reporting if directory not found Now supports multiple Maldet archive formats/naming schemes.
This commit is contained in:
@@ -425,21 +425,32 @@ install_maldet_only() {
|
|||||||
echo " Extracting archive..."
|
echo " Extracting archive..."
|
||||||
if tar xzf "$temp_file" 2>/dev/null; then
|
if tar xzf "$temp_file" 2>/dev/null; then
|
||||||
echo " Running installer..."
|
echo " Running installer..."
|
||||||
if cd maldetect-* 2>/dev/null && bash install.sh > /tmp/maldet-install.log 2>&1; then
|
# Find the extracted directory (could be maldetect-* or rfxn-linux-malware-detect-*)
|
||||||
echo -e " ${GREEN}✓ Maldet installed successfully${NC}"
|
local install_dir
|
||||||
|
install_dir=$(find . -maxdepth 1 -type d \( -name "*malware*" -o -name "*maldet*" \) 2>/dev/null | head -1)
|
||||||
|
|
||||||
# Update signatures in background
|
if [ -n "$install_dir" ] && [ -f "$install_dir/install.sh" ]; then
|
||||||
echo ""
|
if cd "$install_dir" 2>/dev/null && bash install.sh > /tmp/maldet-install.log 2>&1; then
|
||||||
echo "Updating malware signatures..."
|
echo -e " ${GREEN}✓ Maldet installed successfully${NC}"
|
||||||
if command -v maldet &>/dev/null; then
|
|
||||||
maldet -u > /dev/null 2>&1 &
|
# Update signatures in background
|
||||||
echo " (signatures updating in background)"
|
echo ""
|
||||||
|
echo "Updating malware signatures..."
|
||||||
|
if command -v maldet &>/dev/null; then
|
||||||
|
maldet -u > /dev/null 2>&1 &
|
||||||
|
echo " (signatures updating in background)"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo -e " ${RED}✗ Installation failed. Check /tmp/maldet-install.log${NC}"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo -e " ${RED}✗ Installation failed. Check /tmp/maldet-install.log${NC}"
|
echo -e " ${RED}✗ Could not find install.sh in extracted directory${NC}"
|
||||||
|
if [ -z "$install_dir" ]; then
|
||||||
|
echo " (Directory not found matching *malware* or *maldet*)"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
cd /tmp
|
cd /tmp
|
||||||
rm -rf maldetect-* maldetect-latest.tar.gz 2>/dev/null || true
|
rm -rf maldetect-* rfxn-linux-malware-detect-* maldetect-latest.tar.gz 2>/dev/null || true
|
||||||
else
|
else
|
||||||
echo -e " ${RED}✗ Failed to extract archive${NC}"
|
echo -e " ${RED}✗ Failed to extract archive${NC}"
|
||||||
rm -f "$temp_file"
|
rm -f "$temp_file"
|
||||||
|
|||||||
Reference in New Issue
Block a user