← Commit history

Merge PR #527: install.sh: don't fail the install on non-x86_64 (fixes adom/core auto-update on Apple Silicon)

Colby Knox ·6c9a5d21b4 · ·parent 96d169a
1 file changed +33−22
install.sh+33−22
@@ -12,31 +12,41 @@ cd "$DIR" BIN_DIR="${HOME}/.local/bin" mkdir -p "$BIN_DIR" VER="$(sed -n 's/^ *"version": *"\([0-9][0-9.]*\)".*/\1/p' "$DIR/package.json" | head -1)"-case "$(uname -m)" in-  x86_64|amd64) ;;-  *) echo "adom-tts: no $(uname -m) build yet (x86_64 Linux only). Ask on https://wiki.adom.inc/adom/adom-tts/issues" >&2; exit 1 ;;+# Only x86_64 has a release binary so far. On any other arch, skip the binary but still install+# the skills and completion, and exit 0: a non-zero exit rolls back the whole package, and because+# adom/core depends on adom-tts it also fails every core auto-update on that machine (every Apple+# Silicon Hydrogen workspace is aarch64).+ARCH="$(uname -m)"+case "$ARCH" in+  x86_64|amd64) HAVE_BUILD=1 ;;+  *) HAVE_BUILD=0 ;; esac-URL="https://wiki.adom.inc/download/adom/adom-tts/${VER}/adom-tts"-WANT="$(cut -d' ' -f1 "$DIR/bin/adom-tts.sha256")"-TMP="$(mktemp)"-trap 'rm -f "$TMP"' EXIT-got=""-# Retries cover the seconds between publishing a version and uploading its binary.-for attempt in 1 2 3 4 5 6; do-  if curl -fsSL --max-time 120 "$URL" -o "$TMP"; then-    got="$(sha256sum "$TMP" | cut -d' ' -f1)"-    [ "$got" = "$WANT" ] && break-  fi+if [ "$HAVE_BUILD" = 1 ]; then+  URL="https://wiki.adom.inc/download/adom/adom-tts/${VER}/adom-tts"+  WANT="$(cut -d' ' -f1 "$DIR/bin/adom-tts.sha256")"+  TMP="$(mktemp)"+  trap 'rm -f "$TMP"' EXIT   got=""-  [ "$attempt" -lt 6 ] && sleep 5-done-if [ -z "$got" ]; then-  echo "adom-tts: could not download the ${VER} binary from $URL (or its sha256 did not match $WANT)." >&2-  if [ -x "$BIN_DIR/adom-tts" ]; then echo "         Your installed $("$BIN_DIR/adom-tts" --version 2>/dev/null) is unchanged. Retry: adom-wiki pkg install adom/adom-tts" >&2; fi-  exit 1+  # Retries cover the seconds between publishing a version and uploading its binary.+  for attempt in 1 2 3 4 5 6; do+    if curl -fsSL --max-time 120 "$URL" -o "$TMP"; then+      got="$(sha256sum "$TMP" | cut -d' ' -f1)"+      [ "$got" = "$WANT" ] && break+    fi+    got=""+    [ "$attempt" -lt 6 ] && sleep 5+  done+  if [ -z "$got" ]; then+    echo "adom-tts: could not download the ${VER} binary from $URL (or its sha256 did not match $WANT)." >&2+    if [ -x "$BIN_DIR/adom-tts" ]; then echo "         Your installed $("$BIN_DIR/adom-tts" --version 2>/dev/null) is unchanged. Retry: adom-wiki pkg install adom/adom-tts" >&2; fi+    exit 1+  fi+  install -m 0755 "$TMP" "$BIN_DIR/adom-tts"+  echo "Installed adom-tts ${VER} -> $BIN_DIR/adom-tts (sha256 verified)"+else+  echo "adom-tts: no ${ARCH} build yet (x86_64 Linux only), so the adom-tts binary was NOT installed;" >&2+  echo "          the skills and completion still are. Ask on https://wiki.adom.inc/adom/adom-tts/issues" >&2 fi-install -m 0755 "$TMP" "$BIN_DIR/adom-tts"-echo "Installed adom-tts ${VER} -> $BIN_DIR/adom-tts (sha256 verified)"  # 2) Claude Code skill (user tier only — dev/publish skills stay in source). SKILL_DIR="${HOME}/.claude/skills"@@ -55,6 +65,7 @@ if [ -f "$DIR/completions/adom-tts.bash" ]; then   install -m 0644 "$DIR/completions/adom-tts.bash" "$COMP_DIR/adom-tts" || true fi +[ "$HAVE_BUILD" = 1 ] || exit 0 echo echo "adom-tts installed. Verify the shared voice service is reachable:" echo "  adom-tts health"