eden/tools/cpm/hash.sh
crueter 67f3bf79c1
[tools] refactor: update/hash checking scripts, use tags for more deps
Uses tags for a bunch of deps that can use them

Also adds a bunmch of scripts to tools/cpm, notably for checking hashes
and checking for updates.

TODO:
- Documentation
- CI target to check hashes
- Script to update the json directly (dedup)
- Function to filter tags (dedup)
- Weekly CI to check for updates

Need to get that other CI runner up

Signed-off-by: crueter <crueter@eden-emu.dev>
2025-10-03 16:56:46 -04:00

22 lines
564 B
Bash
Executable file

#!/bin/sh -e
# usage: hash.sh repo tag-or-sha
# env vars: GIT_HOST, USE_TAG (use tag instead of sha), ARTIFACT (download artifact with that name instead of src archive)
REPO="$1"
[ -z "$GIT_HOST" ] && GIT_HOST=github.com
GIT_URL="https://$GIT_HOST/$REPO"
if [ "$USE_TAG" = "true" ]; then
if [ -z "$ARTIFACT" ]; then
URL="${GIT_URL}/archive/refs/tags/$2.tar.gz"
else
URL="${GIT_URL}/releases/download/$2/${ARTIFACT}"
fi
else
URL="${GIT_URL}/archive/$2.zip"
fi
SUM=$(wget -q "$URL" -O - | sha512sum)
echo "$SUM" | cut -d " " -f1