diff --git a/studio/setup.sh b/studio/setup.sh index f623c9ab0b..8b81c215ec 100755 --- a/studio/setup.sh +++ b/studio/setup.sh @@ -972,14 +972,39 @@ install_python_stack() { python "$SCRIPT_DIR/install_python_stack.py" } +# ── HTTP GET to stdout (supports curl and wget) ── +# install.sh accepts either transport everywhere (its download() and _http_get), +# so a wget-only box gets that far and then stalled here, where curl was the only +# way to fetch anything. Same preference order: curl, else wget. +_setup_http_get() { + if command -v curl >/dev/null 2>&1; then + curl -LsSf "$1" + elif command -v wget >/dev/null 2>&1; then + wget -qO- "$1" + else + return 1 + fi +} + +# Same, with a deadline, for the checks that must not hang the install. +_setup_http_get_timed() { + if command -v curl >/dev/null 2>&1; then + curl -fsSL --max-time 5 "$1" + elif command -v wget >/dev/null 2>&1; then + wget -qO- --timeout=5 "$1" + else + return 1 + fi +} + USE_UV=false if command -v uv &>/dev/null; then USE_UV=true elif { if _is_verbose; then - curl -LsSf https://astral.sh/uv/install.sh | sh + _setup_http_get https://astral.sh/uv/install.sh | sh else - curl -LsSf https://astral.sh/uv/install.sh | sh > /dev/null 2>&1 + _setup_http_get https://astral.sh/uv/install.sh | sh > /dev/null 2>&1 fi }; then export PATH="$HOME/.local/bin:$PATH" @@ -1020,7 +1045,7 @@ import sys; from importlib.metadata import version print(version(sys.argv[1])) " "$_PKG_NAME" 2>/dev/null || echo "") - LATEST_VER=$(curl -fsSL --max-time 5 "https://pypi.org/pypi/$_PKG_NAME/json" 2>/dev/null \ + LATEST_VER=$(_setup_http_get_timed "https://pypi.org/pypi/$_PKG_NAME/json" 2>/dev/null \ | "$VENV_DIR/bin/python" -c "import sys,json; print(json.load(sys.stdin)['info']['version'])" 2>/dev/null \ || echo "")