install.sh
AArch64 (ARM64) architecture stringReferences curl flags and HTTP URL
SHA-25623ce9a557139c20bc3f474dd88024056af84818d27ad74fa6bfcdc03a8b21e5a
Evidence
1#!/bin/sh
2# Install or update Tap and its pinned agent-browser runtime dependency.
3#
4# Usage:
5# curl -fsSL https://raw.githubusercontent.com/vaayne/tap/main/scripts/install.sh | sh
6# curl -fsSL https://raw.githubusercontent.com/vaayne/tap/main/scripts/install.sh | sh -s -- --full
7# curl -fsSL https://raw.githubusercontent.com/vaayne/tap/main/scripts/install.sh | sh -s -- --dir /usr/local/bin
8
9set -eu
10
11REPO="vaayne/tap"
12INSTALL_DIR="${HOME}/.local/bin"
13FULL=0
14WITH_AGENT_BROWSER=1
15INSTALL_CHROME=1
16
17usage() {
18 cat <<'EOF'
19Usage: install.sh [options]
20
21Options:
22 --dir PATH Install binaries under PATH (default ~/.local/bin)
23 --full Use the Tap + agent-browser full bundle
24 --skip-chrome Do not run agent-browser install
25 --without-agent-browser Install only Tap
26 -h, --help Show this help
27EOF
28}
⋯5 lines
43:24… nd --without-agent-browser cannot be combined" >&2
44 exit 1
45fi
46
47OS=$(uname -s | tr '[:upper:]' '[:lower:]')
48ARCH=$(uname -m)
49case "$ARCH" in
50 x86_64|amd64) ARCH="amd64" ;;
51 aarch64|arm64) ARCH="arm64" ;;
52 *) echo "Unsupported architecture: $ARCH" >&2; exit 1 ;;
53esac
54case "$OS" in
55 linux|darwin) ;;
56 mingw*|msys*|cygwin*) OS="windows" ;;
57 *) echo "Unsupported OS: $OS" >&2; exit 1 ;;
58esac
59
60LIBC="default"
61if [ "$OS" = "linux" ]; then
62 LIBC="glibc"
63 if (ldd --version 2>&1 || true) | grep -qi musl || ls /lib/ld-musl-*.so.1 >/dev/null 2>&1; then
64 LIBC="musl"
65 fi
66fi
67
68LATEST=$(curl -fsSL "https://api.github.com/repos/${REPO}/releases/latest" | grep '"tag_name"' | sed 's/.*"tag_name": *"//;s/".*//')
69if [ -z "$LATEST" ]; then
70 echo "Error: could not determine latest Tap version" >&2
71 exit 1
72fi
73VERSION="${LATEST#v}"
74
75TMPDIR=$(mktemp -d)
76trap 'rm -rf "$TMPDIR"' EXIT
77
78needs_agent_browser=0
79if [ "$WITH_AGENT_BROWSER" -eq 1 ]; then
80 manifest="${TMPDIR}/agent-browser.sh"
81 if [ "$FULL" -eq 1 ] || ! command -v agent-browser >/dev/null 2>&1; then
82 manifest_status=$(curl -sSL -o "$manifest" -w '%{http_code}' "https://raw.githubusercontent.com/${REPO}/${LATEST}/deps/agent-browser.sh") || {
83 echo "Error: could not download the agent-browser dependency manifest" >&2
84 exit 1
85 }
86 if [ "$manifest_ …
94:72… " >&2
95 exit 1
96 else
97 # shellcheck source=/dev/null
98 . "$manifest"
99 fi
100 fi
101
102 if [ "$WITH_AGENT_BROWSER" -eq 1 ] && [ "$FULL" -eq 1 ]; then
103 if [ "$OS" = "windows" ] && [ "$ARCH" …
103:51… " ]; then
104 echo "Error: agent-browser has no native Windows arm64 release" >&2
105 echo "Use --without-agent-browser or install a supported build manually." >&2
106 exit 1
107 fi
108 elif [ " …
114:4… needs_agent_browser=1
115 fi
116fi
117
118sha256_file() {
119 if command -v sha256sum >/dev/null 2>&1; then
120 sha256sum "$1" | awk '{print $1}'
121 else
122 shasum -a 256 "$1" | awk '{print $1}'
123 fi
124}
125
126verify_sha256() {
127 actual=$(sha256_file "$1")
128 if [ "$actual" != "$2" ]; then
129 echo "Error: checksum mismatch for $1" >&2
130 echo " want: $2" >&2
131 echo " got: $actual" >&2
⋯7 lines