AtlatestRepositorycore-channel
core-channel / tree / seed / scriptsgate-crosspath.sh
1
#!/bin/sh2
set -eu4
seed=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)5
repo=$(CDPATH= cd -- "$seed/.." && pwd)6
scratch=$(mktemp -d /tmp/sigil-channel-crosspath.XXXXXX)7
clone="$scratch/clone"8
cleanup() { rm -rf "$scratch"; }9
trap cleanup EXIT HUP INT TERM11
fetch_sources() {12
target=$113
mkdir -p "$target/seed/sources"14
while IFS=' ' read -r hash url file rest; do15
case "$hash" in ''|'#'*) continue ;; esac16
curl --fail --location --silent --show-error "$url" --output "$target/seed/$file"17
actual=$(sha256sum "$target/seed/$file" | awk '{print $1}')18
[ "$actual" = "$hash" ] || { echo "source hash mismatch: $file" >&2; exit 1; }19
done < "$target/seed/MANIFEST.sources"20
}22
fetch_sources "$repo"23
"$seed/scripts/build-seed.sh"24
primary=$(awk '{print $1}' "$seed/seed-x86_64-linux.tar.gz.sha256")26
git clone --quiet --no-hardlinks "$repo" "$clone"27
SIGIL_BOOTSTRAP_SEED_URL="${SIGIL_BOOTSTRAP_SEED_URL:-}" \28
SIGIL_BOOTSTRAP_ZIG_URL="${SIGIL_BOOTSTRAP_ZIG_URL:-}" "$clone/bootstrap"29
fetch_sources "$clone"30
"$clone/seed/scripts/build-seed.sh"31
rebuilt=$(awk '{print $1}' "$clone/seed/seed-x86_64-linux.tar.gz.sha256")33
echo "primary=$primary"34
echo "crosspath=$rebuilt"35
if [ "$primary" != "$rebuilt" ]; then36
echo "cross-path seed hash mismatch" >&237
exit 138
fi39
echo "MATCH"