From e1576dc86913ac7f524620ba8a298f0c914c96e7 Mon Sep 17 00:00:00 2001 From: Developer Date: Tue, 21 Apr 2026 19:54:18 -0400 Subject: [PATCH] Fix: Use offline archive directly instead of copying, add tar validation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Issue: Archive found but copy/validation was failing ('✗ Failed to copy or validate archive'). Solution: - Use archive directly from its location instead of copying - Add tar validation: verify file is readable tar before proceeding - Better error messages: 'corrupted', 'missing', or 'empty' - Avoid copy operation which was failing on some systems Now validates archive with: tar -tzf (reads tar header without extracting) --- modules/security/malware-scanner.sh | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/modules/security/malware-scanner.sh b/modules/security/malware-scanner.sh index cdef99f..31eb7d6 100755 --- a/modules/security/malware-scanner.sh +++ b/modules/security/malware-scanner.sh @@ -348,14 +348,24 @@ install_maldet_only() { if [ -n "$local_archive" ]; then echo "" - echo "Using pre-downloaded archive..." - temp_file="/tmp/maldetect-offline.tar.gz" - if cp "$local_archive" "$temp_file" 2>/dev/null && [ -f "$temp_file" ] && [ -s "$temp_file" ]; then - download_success=true - best_source="offline-archive" - echo -e "${GREEN}✓ Archive ready for extraction${NC}" + echo "Using pre-downloaded archive: $local_archive" + # Use archive directly without copying + temp_file="$local_archive" + + # Validate the archive + if [ -f "$temp_file" ] && [ -s "$temp_file" ]; then + # Quick check: can we read it as tar? + if tar -tzf "$temp_file" >/dev/null 2>&1; then + download_success=true + best_source="offline-archive" + echo -e "${GREEN}✓ Archive validated and ready for extraction${NC}" + else + echo -e "${RED}✗ Archive is corrupted or not a valid tar file${NC}" + download_success=false + temp_file="" + fi else - echo -e "${RED}✗ Failed to copy or validate archive${NC}" + echo -e "${RED}✗ Archive file is missing or empty${NC}" download_success=false temp_file="" fi