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 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:
@@ -257,6 +257,7 @@ install_all_scanners() {
|
|||||||
if ! is_maldet_installed; then
|
if ! is_maldet_installed; then
|
||||||
echo -e "${CYAN}[2/4] Installing Maldet...${NC}"
|
echo -e "${CYAN}[2/4] Installing Maldet...${NC}"
|
||||||
|
|
||||||
|
(
|
||||||
cd /tmp || { echo -e "${RED}✗ Cannot access /tmp${NC}"; return 1; }
|
cd /tmp || { echo -e "${RED}✗ Cannot access /tmp${NC}"; return 1; }
|
||||||
|
|
||||||
# Download Maldet
|
# Download Maldet
|
||||||
@@ -278,8 +279,6 @@ install_all_scanners() {
|
|||||||
local maldet_dir=$(find /tmp -maxdepth 1 -type d -name "maldetect-*" 2>/dev/null | head -1)
|
local maldet_dir=$(find /tmp -maxdepth 1 -type d -name "maldetect-*" 2>/dev/null | head -1)
|
||||||
if [ -z "$maldet_dir" ]; then
|
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
|
cd /tmp
|
||||||
rm -rf "maldetect-"*
|
rm -rf "maldetect-"*
|
||||||
return 1
|
return 1
|
||||||
@@ -328,28 +327,13 @@ install_all_scanners() {
|
|||||||
echo ""
|
echo ""
|
||||||
echo -e "${YELLOW}Full log saved to: $install_log${NC}"
|
echo -e "${YELLOW}Full log saved to: $install_log${NC}"
|
||||||
fi
|
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
|
fi
|
||||||
|
return 0
|
||||||
else
|
else
|
||||||
echo -e "${RED}✗ Download failed - maldetect-current.tar.gz not found${NC}"
|
echo -e "${RED}✗ Download failed - maldetect-current.tar.gz not found${NC}"
|
||||||
return 1
|
return 0
|
||||||
fi
|
fi
|
||||||
|
) || true
|
||||||
else
|
else
|
||||||
echo -e "${GREEN}✓ Maldet already installed${NC}"
|
echo -e "${GREEN}✓ Maldet already installed${NC}"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user