#!/bin/bash # The OpenCode CLI, the official Linux x64 release, pinned by version and by the sha256 of both the archive and the binary, # at /opt/opencode/bin/opencode with `opencode` on PATH. Used by both generation images. # Also ripgrep, the release OpenCode 1.19.5 itself downloads from GitHub on first use (its glob and grep tools run `rg`): # the container cannot reach GitHub, so without it those tools fail with "ripgrep execution failed". set -euo pipefail VERSION=1.19.5 ARCHIVE_SHA256=588310a336fa3b9df36b3f0225b26f679d453efaad0cf3d66c3651ef3ec1647a BINARY_SHA256=7df4e4136301f16589b0f30bf91a61380fca5f8ef22dd36570f5ebe1d4ec802c RG_VERSION=15.1.0 RG_ARCHIVE_SHA256=1c9297be4a084eea7ecaedf93eb03d058d6faae29bbc57ecdaf5063921491599 RG_BINARY_SHA256=ebeaf56f8a25e102e9419933423738b3a2a613a444fd749d695e15eba53f71f2 RG=ripgrep-${RG_VERSION}-x86_64-unknown-linux-musl curl -fsSL --retry 30 --retry-all-errors --retry-delay 10 -o /tmp/opencode.tar.gz https://github.com/anomalyco/opencode/releases/download/v${VERSION}/opencode-linux-x64.tar.gz echo "${ARCHIVE_SHA256} /tmp/opencode.tar.gz" | sha256sum -c - mkdir -p /opt/opencode/bin tar -xzf /tmp/opencode.tar.gz -C /opt/opencode/bin opencode rm /tmp/opencode.tar.gz echo "${BINARY_SHA256} /opt/opencode/bin/opencode" | sha256sum -c - chmod 755 /opt/opencode/bin/opencode ln -s /opt/opencode/bin/opencode /usr/local/bin/opencode test "$(/opt/opencode/bin/opencode --version)" = "${VERSION}" curl -fsSL --retry 30 --retry-all-errors --retry-delay 10 -o /tmp/${RG}.tar.gz https://github.com/BurntSushi/ripgrep/releases/download/${RG_VERSION}/${RG}.tar.gz echo "${RG_ARCHIVE_SHA256} /tmp/${RG}.tar.gz" | sha256sum -c - tar -xzf /tmp/${RG}.tar.gz -C /tmp ${RG}/rg install -m 755 /tmp/${RG}/rg /opt/opencode/bin/rg rm -rf /tmp/${RG}.tar.gz /tmp/${RG} echo "${RG_BINARY_SHA256} /opt/opencode/bin/rg" | sha256sum -c - ln -s /opt/opencode/bin/rg /usr/local/bin/rg