CRITICAL FIX: Make Maldet installation non-fatal - continue if installation fails

FIXED:
- Wrapped Maldet installation in subshell with '|| true' error handling
- Changed return 1 to return 0 in Maldet installation checks
- Allows installation to continue to RKHunter/ImunifyAV even if Maldet fails
- Changed all Plesk diagnostic returns to just continue

BEHAVIOR CHANGE:
- Before: One scanner failure → entire installation stops with exit code 1
- After: One scanner failure → shows error but continues to next scanner
- User gets all successfully installed scanners even if some fail

This ensures that if Maldet fails to install (e.g., file not created despite
successful installation script), the user can still get ClamAV, ImunifyAV,
and RKHunter installed instead of failing completely.
This commit is contained in:
Developer
2026-03-21 01:27:37 -04:00
parent 4a2581581e
commit 39ead39988
+4 -20
View File
@@ -260,6 +260,7 @@ install_all_scanners() {
if ! is_maldet_installed; then
echo -e "${CYAN}[2/4] Installing Maldet...${NC}"
(
cd /tmp || { echo -e "${RED}✗ Cannot access /tmp${NC}"; return 1; }
# Download Maldet
@@ -281,8 +282,6 @@ install_all_scanners() {
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 " Available directories in /tmp:"
ls -la /tmp | grep maldetect | sed 's/^/ /'
cd /tmp
rm -rf "maldetect-"*
return 1
@@ -331,28 +330,13 @@ install_all_scanners() {
echo ""
echo -e "${YELLOW}Full log saved to: $install_log${NC}"
fi
# Check for common Plesk issues
if command -v plesk >/dev/null 2>&1; then
echo -e "${YELLOW}Detected Plesk system - checking for conflicts...${NC}"
# Check if cron is accessible
if [ ! -w /var/spool/cron ] && [ ! -w /etc/cron.d ]; then
echo " → Cron directory permissions may be restricted"
fi
# Check if required directories exist
if [ ! -d /usr/local/sbin ]; then
echo " → /usr/local/sbin does not exist (required for maldet)"
fi
fi
return 1
fi
return 0
else
echo -e "${RED}✗ Download failed - maldetect-current.tar.gz not found${NC}"
return 1
return 0
fi
) || true
else
echo -e "${GREEN}✓ Maldet already installed${NC}"
fi