Fix: Add timeout to GitHub API curl to prevent hanging

Issue: Checking for latest release was hanging and closing SSH connection

Solution: Add --connect-timeout 5 and --max-time 10 to curl command
- Prevents indefinite blocking on network issues
- Falls back to v2.0.1-rc4 if API unreachable
- Script continues even if GitHub API is slow/down
This commit is contained in:
Developer
2026-04-21 20:26:22 -04:00
parent a2b24d654d
commit 9486d0604a
+2 -2
View File
@@ -285,9 +285,9 @@ install_maldet_only() {
rm -f "$temp_file" rm -f "$temp_file"
fi fi
# Get latest release dynamically from GitHub API # Get latest release dynamically from GitHub API (with timeout)
local latest_release 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) latest_release=$(curl -s --connect-timeout 5 --max-time 10 "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://)