fix: add timeouts to curl calls — installer hangs on unreachable server
This commit is contained in:
+8
-1
@@ -24,6 +24,13 @@ fi
|
||||
echo "Server: http://$SHIELD_HOST:$SHIELD_PORT"
|
||||
echo ""
|
||||
|
||||
# Quick connectivity check (3s timeout)
|
||||
if ! curl -sf --max-time 3 "http://$SHIELD_HOST:$SHIELD_PORT/api/status" >/dev/null 2>&1; then
|
||||
echo "⚠ WARNING: Server at $SHIELD_HOST:$SHIELD_PORT not reachable!"
|
||||
echo " Continuing anyway — config will be written but safe-yay may fail."
|
||||
echo ""
|
||||
fi
|
||||
|
||||
# Write config file
|
||||
echo "Writing /etc/safe-yay.conf..."
|
||||
sudo tee /etc/safe-yay.conf > /dev/null << EOFCONF
|
||||
@@ -35,7 +42,7 @@ echo "✓ Config written to /etc/safe-yay.conf"
|
||||
|
||||
# Add pacman repo (skip if scan-only server — no repo needed)
|
||||
# Check if server is scan-only by querying status
|
||||
SERVER_SCAN_ONLY=$(curl -sf "http://$SHIELD_HOST:$SHIELD_PORT/api/status" 2>/dev/null | python3 -c "import sys,json; print(json.loads(sys.stdin.read()).get('scan_only',False))" 2>/dev/null || echo False)
|
||||
SERVER_SCAN_ONLY=$(curl -sf --max-time 5 "http://$SHIELD_HOST:$SHIELD_PORT/api/status" 2>/dev/null | python3 -c "import sys,json; print(json.loads(sys.stdin.read()).get('scan_only',False))" 2>/dev/null || echo False)
|
||||
|
||||
PACMAN_CONF="/etc/pacman.conf"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user