Auto-detect latest Maldet release instead of hardcoding version
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
This commit is contained in:
@@ -285,12 +285,15 @@ install_maldet_only() {
|
|||||||
rm -f "$temp_file"
|
rm -f "$temp_file"
|
||||||
fi
|
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
|
# Download sources in priority order
|
||||||
# Format: "name|url|label" (using | as delimiter to avoid splitting https://)
|
# Format: "name|url|label" (using | as delimiter to avoid splitting https://)
|
||||||
# Note: Repository is rfxn/linux-malware-detect (not maldet)
|
# Note: Repository is rfxn/linux-malware-detect (not maldet)
|
||||||
local sources=(
|
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-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-1.6|https://api.github.com/repos/rfxn/linux-malware-detect/tarball/1.6.6.1|GitHub Release 1.6.6.1 (Stable)"
|
|
||||||
"github-main|https://github.com/rfxn/linux-malware-detect/archive/refs/heads/main.tar.gz|GitHub main branch (Development)"
|
"github-main|https://github.com/rfxn/linux-malware-detect/archive/refs/heads/main.tar.gz|GitHub main branch (Development)"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user