Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions kickoff.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,14 @@ _clk_setup() {
}

_sv_confirm() {
local prompt="$1" default="${2:-N}" v
v="$(_sv_read "$prompt [$default]" "$default")"
local prompt="$1" default="${2:-N}" v hint
case "${default^^}" in
Y|YES) hint="Y/n" ;;
*) hint="y/N" ;;
esac
printf '%s [%s]: ' "$prompt" "$hint" >&4
IFS= read -r v <&3 || v=""
v="${v:-$default}"
case "${v,,}" in y|yes) return 0 ;; *) return 1 ;; esac
}

Expand Down
20 changes: 19 additions & 1 deletion scripts/install_tool.sh
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,28 @@ check_tool() {
;;
openwebui)
local endpoint="${CLK_OPENWEBUI_ENDPOINT:-http://localhost:8080}"
# Prefer an HTTP probe — many minimal shells lack /dev/tcp, and we
# care that OpenWebUI is *responding*, not just that a port is open.
# Any HTTP status (including 401/403 for authenticated instances)
# counts as reachable.
if _it_has curl; then
local code
code="$(curl -sS -o /dev/null -m 4 -w '%{http_code}' "$endpoint" 2>/dev/null || echo 000)"
[ "$code" != "000" ] && return 0
# Also try the health endpoint that OpenWebUI exposes.
code="$(curl -sS -o /dev/null -m 4 -w '%{http_code}' "${endpoint%/}/health" 2>/dev/null || echo 000)"
[ "$code" != "000" ] && return 0
fi
# Fallback: raw TCP probe for environments without curl.
local host port
host="$(echo "$endpoint" | sed -E 's|^https?://||; s|/.*||; s|:.*||')"
port="$(echo "$endpoint" | sed -nE 's|^https?://[^:/]+:([0-9]+).*|\1|p')"
port="${port:-8080}"
if [ -z "$port" ]; then
case "$endpoint" in
https://*) port=443 ;;
*) port=8080 ;;
esac
fi
(echo > "/dev/tcp/$host/$port") 2>/dev/null
;;
*)
Expand Down
Loading