From a2b24d654d1d3b14026c65eed8a994dae2b3b264 Mon Sep 17 00:00:00 2001 From: Developer Date: Tue, 21 Apr 2026 20:19:25 -0400 Subject: [PATCH] Auto-detect latest Maldet release instead of hardcoding version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change: Script now queries GitHub API to automatically find latest release tag Benefits: - Always uses newest Maldet version (no manual updates needed) - Falls back to v2.0.1-rc4 if API is unavailable - Fallback to main branch if release fetch fails - Future-proof - works with any new releases Implementation: - Query GitHub releases/latest API - Extract tag_name dynamically - Use that version in download URL - Fallback chain: Latest → main branch --- modules/security/malware-scanner.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/security/malware-scanner.sh b/modules/security/malware-scanner.sh index e6e8c87..785e21d 100755 --- a/modules/security/malware-scanner.sh +++ b/modules/security/malware-scanner.sh @@ -285,12 +285,15 @@ install_maldet_only() { rm -f "$temp_file" fi + # Get latest release dynamically from GitHub API + local latest_release + latest_release=$(curl -s "https://api.github.com/repos/rfxn/linux-malware-detect/releases/latest" 2>/dev/null | grep -o '"tag_name":"[^"]*' | head -1 | cut -d'"' -f4) + # Download sources in priority order # Format: "name|url|label" (using | as delimiter to avoid splitting https://) # Note: Repository is rfxn/linux-malware-detect (not maldet) local sources=( - "github-api|https://api.github.com/repos/rfxn/linux-malware-detect/tarball/v2.0.1-rc4|GitHub Release v2.0.1-rc4 (Latest)" - "github-1.6|https://api.github.com/repos/rfxn/linux-malware-detect/tarball/1.6.6.1|GitHub Release 1.6.6.1 (Stable)" + "github-latest|https://api.github.com/repos/rfxn/linux-malware-detect/tarball/${latest_release:-v2.0.1-rc4}|GitHub Latest Release (${latest_release:-v2.0.1-rc4})" "github-main|https://github.com/rfxn/linux-malware-detect/archive/refs/heads/main.tar.gz|GitHub main branch (Development)" )