Files
agent-mkosi/mkosi.prepare
T
2026-11-15 15:52:10 +01:00

13 lines
814 B
Bash
Executable File

#!/bin/sh
# Installs Claude Code: the latest stable release, checked against the sha256 in its release manifest.
# The image updates weekly, so Claude's own auto-updater is off (/etc/claude-code/managed-settings.json).
set -eu
u=https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases
v=$(curl -fsS "$u/stable")
sum=$(curl -fsS "$u/$v/manifest.json" | tr -d ' \n' | sed -n 's/.*"linux-x64":{[^}]*"checksum":"\([0-9a-f]*\)".*/\1/p')
[ -n "$sum" ]
# The binary is ~300 MB: when the download stalls (under 1 kB/s for a minute), resume it.
curl -fsS --retry 10 --retry-all-errors --speed-limit 1000 --speed-time 60 -C - -o "$BUILDROOT/usr/bin/claude" "$u/$v/linux-x64/claude"
echo "$sum $BUILDROOT/usr/bin/claude" | sha256sum -c
chmod 755 "$BUILDROOT/usr/bin/claude"