From a00a9f2b99ddec9f426ea32e992abfd99ce5e9d3 Mon Sep 17 00:00:00 2001 From: arch_agent Date: Tue, 4 Aug 2026 11:38:21 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20add=20timeouts=20to=20curl=20calls=20?= =?UTF-8?q?=E2=80=94=20installer=20hangs=20on=20unreachable=20server?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install-client.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/install-client.sh b/install-client.sh index d0b9638..b5d66fe 100644 --- a/install-client.sh +++ b/install-client.sh @@ -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"