mirror of
https://github.com/NVIDIA/OpenShell.git
synced 2026-10-14 04:59:28 +08:00
Add safe.directory and use --global git config in the docs-build publish job to fix "fatal: not in a git directory" inside containers. Rename the rolling release tag and GitHub Release from "snapshot" to "devel" across the publish workflow and install script.
116 lines
3.1 KiB
Bash
Executable File
116 lines
3.1 KiB
Bash
Executable File
#!/bin/sh
|
|
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
# Install the NemoClaw CLI binary.
|
|
#
|
|
# Usage:
|
|
# curl -fsSL https://raw.githubusercontent.com/NVIDIA/NemoClaw/main/install.sh | sh
|
|
#
|
|
# Environment variables:
|
|
# NEMOCLAW_VERSION - Release tag to install (default: "devel")
|
|
# NEMOCLAW_INSTALL_DIR - Directory to install into (default: /usr/local/bin)
|
|
#
|
|
set -eu
|
|
|
|
REPO="NVIDIA/NemoClaw"
|
|
VERSION="${NEMOCLAW_VERSION:-devel}"
|
|
INSTALL_DIR="${NEMOCLAW_INSTALL_DIR:-/usr/local/bin}"
|
|
|
|
info() {
|
|
echo "nemoclaw: $*" >&2
|
|
}
|
|
|
|
error() {
|
|
echo "nemoclaw: error: $*" >&2
|
|
exit 1
|
|
}
|
|
|
|
get_os() {
|
|
case "$(uname -s)" in
|
|
Darwin) echo "apple-darwin" ;;
|
|
Linux) echo "unknown-linux-musl" ;;
|
|
*) error "unsupported OS: $(uname -s)" ;;
|
|
esac
|
|
}
|
|
|
|
get_arch() {
|
|
case "$(uname -m)" in
|
|
x86_64|amd64) echo "x86_64" ;;
|
|
aarch64|arm64) echo "aarch64" ;;
|
|
*) error "unsupported architecture: $(uname -m)" ;;
|
|
esac
|
|
}
|
|
|
|
get_target() {
|
|
arch="$(get_arch)"
|
|
os="$(get_os)"
|
|
target="${arch}-${os}"
|
|
|
|
# Only these targets have published binaries.
|
|
case "$target" in
|
|
x86_64-unknown-linux-musl|aarch64-unknown-linux-musl|aarch64-apple-darwin) ;;
|
|
x86_64-apple-darwin) error "macOS x86_64 is not supported; use Apple Silicon (aarch64) or Rosetta 2" ;;
|
|
*) error "no prebuilt binary for $target" ;;
|
|
esac
|
|
|
|
echo "$target"
|
|
}
|
|
|
|
download() {
|
|
url="$1" dest="$2"
|
|
if command -v curl >/dev/null 2>&1; then
|
|
curl -fsSL -o "$dest" "$url"
|
|
elif command -v wget >/dev/null 2>&1; then
|
|
wget -qO "$dest" "$url"
|
|
else
|
|
error "curl or wget is required"
|
|
fi
|
|
}
|
|
|
|
verify_checksum() {
|
|
archive="$1" checksums="$2" filename="$3"
|
|
|
|
if command -v sha256sum >/dev/null 2>&1; then
|
|
echo "$(grep "$filename" "$checksums" | awk '{print $1}') $archive" | sha256sum -c --quiet 2>/dev/null
|
|
elif command -v shasum >/dev/null 2>&1; then
|
|
echo "$(grep "$filename" "$checksums" | awk '{print $1}') $archive" | shasum -a 256 -c --quiet 2>/dev/null
|
|
else
|
|
info "warning: sha256sum/shasum not found, skipping checksum verification"
|
|
return 0
|
|
fi
|
|
}
|
|
|
|
main() {
|
|
target="$(get_target)"
|
|
filename="nemoclaw-${target}.tar.gz"
|
|
base_url="https://github.com/${REPO}/releases/download/${VERSION}"
|
|
|
|
tmpdir="$(mktemp -d)"
|
|
trap 'rm -rf "$tmpdir"' EXIT
|
|
|
|
info "downloading ${filename} (${VERSION})..."
|
|
download "${base_url}/${filename}" "${tmpdir}/${filename}"
|
|
|
|
info "verifying checksum..."
|
|
download "${base_url}/nemoclaw-checksums-sha256.txt" "${tmpdir}/checksums.txt"
|
|
if ! verify_checksum "${tmpdir}/${filename}" "${tmpdir}/checksums.txt" "$filename"; then
|
|
error "checksum verification failed"
|
|
fi
|
|
|
|
info "extracting..."
|
|
tar -xzf "${tmpdir}/${filename}" -C "${tmpdir}"
|
|
|
|
info "installing to ${INSTALL_DIR}/nemoclaw..."
|
|
if [ -w "$INSTALL_DIR" ]; then
|
|
mv "${tmpdir}/nemoclaw" "${INSTALL_DIR}/nemoclaw"
|
|
else
|
|
sudo mv "${tmpdir}/nemoclaw" "${INSTALL_DIR}/nemoclaw"
|
|
fi
|
|
chmod +x "${INSTALL_DIR}/nemoclaw"
|
|
|
|
info "installed nemoclaw $(${INSTALL_DIR}/nemoclaw --version 2>/dev/null || echo "${VERSION}") to ${INSTALL_DIR}/nemoclaw"
|
|
}
|
|
|
|
main
|