- SOUL.md: full agent identity, operating principles, voice - IDENTITY.md: runtime identity, hosts, boundaries - USER.md: operator context imported from hermes-soul - AGENTS.md: actual operating rules, infrastructure, quick reference - memories/curated/: 5 topics (tailscale, forgejo, agents, projects, vaultwarden) - skills/: 9 cross-harness skills imported from hermes-soul after review - docs/PLAN-CONFIGURE-PRIVATE-REPO.md: configuration plan - Validate: passes clean
47 lines
1.3 KiB
Bash
47 lines
1.3 KiB
Bash
#!/bin/sh
|
|
# Download a bootable .img.gz plus .sha256, resume safely, verify gzip and SHA256.
|
|
# Usage:
|
|
# verified_img_gz_download.sh URL EXPECTED_SHA256 [output-dir]
|
|
# Example:
|
|
# verified_img_gz_download.sh \
|
|
# https://example.org/downloads/image.img.gz \
|
|
# deadbeef... \
|
|
# "$HOME/Downloads"
|
|
set -eu
|
|
|
|
if [ "$#" -lt 2 ] || [ "$#" -gt 3 ]; then
|
|
echo "Usage: $0 URL EXPECTED_SHA256 [output-dir]" >&2
|
|
exit 2
|
|
fi
|
|
|
|
URL=$1
|
|
EXPECTED=$2
|
|
OUTDIR=${3:-"$HOME/Downloads"}
|
|
IMG=$(basename "$URL")
|
|
SUMURL="$URL.sha256"
|
|
PART="$IMG.part"
|
|
|
|
mkdir -p "$OUTDIR"
|
|
cd "$OUTDIR"
|
|
|
|
printf 'Downloading checksum...\n'
|
|
curl -fL --retry 5 --retry-delay 5 -o "$IMG.sha256" "$SUMURL"
|
|
|
|
printf 'Downloading image to %s/%s ...\n' "$OUTDIR" "$PART"
|
|
curl -fL --continue-at - --retry 8 --retry-delay 10 --retry-all-errors -o "$PART" "$URL"
|
|
|
|
printf 'Checking gzip integrity...\n'
|
|
gzip -t "$PART"
|
|
|
|
printf 'Checking SHA256...\n'
|
|
ACTUAL=$(sha256sum "$PART" | awk '{print $1}')
|
|
printf '%s %s\n' "$ACTUAL" "$IMG"
|
|
if [ "$ACTUAL" != "$EXPECTED" ]; then
|
|
printf 'ERROR: checksum mismatch\nexpected %s\nactual %s\n' "$EXPECTED" "$ACTUAL" >&2
|
|
exit 1
|
|
fi
|
|
|
|
mv -f "$PART" "$IMG"
|
|
printf '%s %s\n' "$EXPECTED" "$IMG" > "$IMG.sha256"
|
|
ls -lh "$IMG" "$IMG.sha256"
|
|
printf '\nDONE: download verified and ready in %s/%s\n' "$OUTDIR" "$IMG"
|