GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — agent2learn/install.sh at main · ManagementMO/agent2learn Expand file tree/ Copy pathinstall.shMore file actions executable file ·146 lines (129 loc) · 5.34 KB / Copy pathinstall.shFile metadata and controlsexecutable file ·146 lines (129 loc) · 5.34 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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 #!/usr/bin/env bash # Agent2Learn installer for macOS and Linux. # # It installs one pinned Agent2Learn release with uv, verifies the command, and — only when a real # terminal is on both ends — hands straight to interactive onboarding. Onboarding is what asks # before writing anything: this script never creates a vault, an agent skills directory, or a # browser profile, and it never needs administrator rights. # # Everything it installs is pinned in the constants block below. There is deliberately no flag or # environment variable for pointing it at another package, index, or URL: a one-line installer that # can be aimed anywhere is an attack surface, not a convenience. set -euo pipefail # ---- reviewed constants --------------------------------------------------------------- UV_VERSION="0.12.5" A2L_VERSION="0.1.9" PYTHON_REQUIREMENT=">=3.11,<3.15" # --------------------------------------------------------------------------------------- UV_INSTALLER="https://astral.sh/uv/${UV_VERSION}/install.sh" say() { printf '%s\n' "$*"; } fail() { printf 'error: %s\n' "$*" >&2; exit 1; } # Compare dotted numeric versions without sort -V, which BSD and GNU disagree about. version_at_least() { local have="$1" want="$2" index have_part want_part local -a have_parts want_parts IFS='.' read -r -a have_parts <<< "$have" IFS='.' read -r -a want_parts <<< "$want" for index in 0 1 2; do have_part="${have_parts[index]:-0}" want_part="${want_parts[index]:-0}" if ((10#$have_part > 10#$want_part)); then return 0; fi if ((10#$have_part < 10#$want_part)); then return 1; fi done return 0 } detect_uv_version() { local raw raw="$(uv --version 2>/dev/null || true)" # "uv 0.12.5 (abcdef 2026-01-01)" -> "0.12.5" printf '%s' "$raw" | sed -n 's/^uv[[:space:]]\{1,\}\([0-9][0-9.]*\).*/\1/p' } installed_uv_bin() { local directory="${UV_INSTALL_DIR:-${CARGO_DIST_FORCE_INSTALL_DIR:-${UV_UNMANAGED_INSTALL:-}}}" if [ -n "$directory" ]; then if [ "$directory" = "${CARGO_HOME:-${HOME:-}/.cargo}" ]; then directory="$directory/bin"; fi elif [ -n "${XDG_BIN_HOME:-}" ]; then directory="$XDG_BIN_HOME" elif [ -n "${XDG_DATA_HOME:-}" ]; then directory="$XDG_DATA_HOME/../bin" elif [ -n "${HOME:-}" ]; then directory="$HOME/.local/bin" else fail "could not locate the user executable directory for uv" fi printf '%s\n' "$directory" } main() { local existing="" existing_raw="" needs_uv=1 if command -v uv > /dev/null 2>&1; then existing_raw="$(uv --version 2>/dev/null || true)" existing="$(detect_uv_version)" if [ -z "$existing" ]; then fail "found uv but could not read its version from: ${existing_raw:-<no output>} Install the tested version yourself, then rerun this installer: curl -fsSL ${UV_INSTALLER} | sh" fi if version_at_least "$existing" "$UV_VERSION"; then needs_uv=0 fi fi say "Agent2Learn installer" say "" say "This will:" if [ "$needs_uv" -eq 1 ]; then if [ -n "$existing" ]; then say " - replace uv ${existing} with the tested uv ${UV_VERSION} from ${UV_INSTALLER}" else say " - install uv ${UV_VERSION} from ${UV_INSTALLER}" fi else say " - reuse the uv ${existing} already on your PATH" fi say " - use Python 3.11-3.14, downloading a compatible interpreter if needed" say " - install agent2learn==${A2L_VERSION} as a uv tool" say " - add the uv tool directory to your shell PATH" say " - verify that a2l runs" say "" say "It does not create a vault, install agent skills, open a browser, or use sudo." say "" if [ "$needs_uv" -eq 1 ]; then local installer installer="$(mktemp)" # Download first, then run, so the fetched bytes are a file we could inspect rather than # an unnamed pipe straight into a shell. curl -fsSL "$UV_INSTALLER" -o "$installer" \ || fail "could not download the uv installer from ${UV_INSTALLER}" sh "$installer" || { rm -f "$installer"; fail "the uv installer did not complete"; } rm -f "$installer" local bootstrap_bin bootstrap_bin="$(installed_uv_bin)" PATH="${bootstrap_bin}:${PATH}" export PATH hash -r 2>/dev/null || true fi command -v uv > /dev/null 2>&1 || fail "uv is still not on PATH after installation" say "installing agent2learn==${A2L_VERSION}" uv tool install "agent2learn==${A2L_VERSION}" --python "$PYTHON_REQUIREMENT" uv tool update-shell || true local tool_bin tool_bin="$(uv tool dir --bin)" [ -n "$tool_bin" ] || fail "uv did not report its tool executable directory" PATH="${tool_bin}:${PATH}" export PATH local reported reported="$(a2l --version 2>/dev/null || true)" case "$reported" in *"${A2L_VERSION}"*) : ;; "") fail "a2l did not run after installation" ;; *) fail "expected agent2learn ${A2L_VERSION} but a2l reported: ${reported}" ;; esac say "verified: ${reported}" say "" if [ -t 0 ] && [ -t 1 ]; then say "starting setup; it will preview and ask before writing anything" exec a2l init fi say "Installed. Onboarding is interactive, so finish it yourself:" say "run in a terminal: a2l init" } main "$@" |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |