-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·42 lines (33 loc) · 1.28 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·42 lines (33 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/sh
# Installs the `unstract` CLI. Override the source to install a branch or a
# local checkout:
# UNSTRACT_CLI_SOURCE=/path/to/checkout sh install.sh
set -eu
SOURCE="${UNSTRACT_CLI_SOURCE:-unstract-cli}"
if ! command -v uv >/dev/null 2>&1; then
echo "Installing uv..." >&2
curl -LsSf https://astral.sh/uv/install.sh | sh
# The installer only edits shell rc files, which take effect in a new
# shell; this one needs uv on PATH now.
PATH="${XDG_BIN_HOME:-${HOME}/.local/bin}:${HOME}/.cargo/bin:${PATH}"
export PATH
fi
if ! command -v uv >/dev/null 2>&1; then
echo "uv is installed but not on PATH; open a new shell and re-run." >&2
exit 1
fi
# uv fetches its own interpreter, so the CLI's Python floor is not the user's problem.
# A pre-release is taken only while no stable release exists.
uv tool install --force --prerelease if-necessary "$SOURCE"
if command -v unstract >/dev/null 2>&1; then
echo
unstract --version 2>/dev/null || true
echo "Run 'unstract auth login' to get started." >&2
exit 0
fi
cat >&2 <<MSG
Installed, but 'unstract' is not on your PATH. Add uv's tool directory:
export PATH="$(uv tool dir --bin 2>/dev/null || echo "${HOME}/.local/bin"):\$PATH"
Then re-open your shell, or run 'uv tool update-shell'.
MSG
exit 1