Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions scripts/install-openshell.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,23 @@ esac
tmpdir="$(mktemp -d)"
trap 'rm -rf "$tmpdir"' EXIT

CHECKSUM_FILE="openshell-checksums-sha256.txt"
if command -v gh >/dev/null 2>&1; then
GH_TOKEN="${GITHUB_TOKEN:-}" gh release download --repo NVIDIA/OpenShell \
--pattern "$ASSET" --dir "$tmpdir"
GH_TOKEN="${GITHUB_TOKEN:-}" gh release download --repo NVIDIA/OpenShell \
--pattern "$CHECKSUM_FILE" --dir "$tmpdir"
else
curl -fsSL "https://github.com/NVIDIA/OpenShell/releases/latest/download/$ASSET" \
-o "$tmpdir/$ASSET"
curl -fsSL "https://github.com/NVIDIA/OpenShell/releases/latest/download/$CHECKSUM_FILE" \
-o "$tmpdir/$CHECKSUM_FILE"
fi

info "Verifying SHA-256 checksum..."
(cd "$tmpdir" && grep "$ASSET" "$CHECKSUM_FILE" | shasum -a 256 -c -) \
|| fail "SHA-256 checksum verification failed for $ASSET"

tar xzf "$tmpdir/$ASSET" -C "$tmpdir"

target_dir="/usr/local/bin"
Expand Down
9 changes: 9 additions & 0 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -341,15 +341,24 @@ install_openshell() {
esac

tmpdir="$(mktemp -d)"
CHECKSUM_FILE="openshell-checksums-sha256.txt"
if command -v gh >/dev/null 2>&1; then
GH_TOKEN="${GITHUB_TOKEN:-}" gh release download --repo NVIDIA/OpenShell \
--pattern "$ASSET" --dir "$tmpdir"
GH_TOKEN="${GITHUB_TOKEN:-}" gh release download --repo NVIDIA/OpenShell \
--pattern "$CHECKSUM_FILE" --dir "$tmpdir"
else
# Fallback: curl latest release
curl -fsSL "https://github.com/NVIDIA/OpenShell/releases/latest/download/$ASSET" \
-o "$tmpdir/$ASSET"
curl -fsSL "https://github.com/NVIDIA/OpenShell/releases/latest/download/$CHECKSUM_FILE" \
-o "$tmpdir/$CHECKSUM_FILE"
fi

info "Verifying SHA-256 checksum..."
(cd "$tmpdir" && grep "$ASSET" "$CHECKSUM_FILE" | shasum -a 256 -c -) \
|| fail "SHA-256 checksum verification failed for $ASSET"

tar xzf "$tmpdir/$ASSET" -C "$tmpdir"

if [ -w /usr/local/bin ]; then
Expand Down
12 changes: 12 additions & 0 deletions test/runner.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,5 +293,17 @@ describe("regression guards", () => {
expect(line.includes("NVIDIA_API_KEY")).toBe(false);
}
});

it("install.sh verifies OpenShell binary checksum after download", () => {
const src = fs.readFileSync(path.join(import.meta.dirname, "..", "scripts", "install.sh"), "utf-8");
expect(src).toContain("openshell-checksums-sha256.txt");
expect(src).toContain("shasum -a 256 -c");
});

it("install-openshell.sh verifies OpenShell binary checksum after download", () => {
const src = fs.readFileSync(path.join(import.meta.dirname, "..", "scripts", "install-openshell.sh"), "utf-8");
expect(src).toContain("openshell-checksums-sha256.txt");
expect(src).toContain("shasum -a 256 -c");
});
});
});
Loading