Rocko's work committed by Sage (Rocko has no git authority). Candidate
manifest sha256 4927de66, base 27a1a2bb.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
37 lines
1.9 KiB
Bash
Executable File
37 lines
1.9 KiB
Bash
Executable File
#!/bin/bash
|
|
# Row 77 byte check: render without --copy, base script against candidate,
|
|
# same tree, same flags. Usage: byte-check.sh <tree> <base-commit> <out-dir>
|
|
# The base script is placed beside the candidate in <tree>/scripts for the
|
|
# run (so both resolve the same REPO and template) and removed afterwards.
|
|
# Only render runs; nothing installs, reads systemd or starts anything.
|
|
set -u
|
|
tree=$1 base=$2 out=$3
|
|
mkdir -p "$out"
|
|
b="$tree/scripts/.webui-service.base.sh"
|
|
git -C "$tree" show "$base:scripts/webui-service.sh" > "$b" && chmod +x "$b" || exit 1
|
|
trap 'rm -f "$b"' EXIT
|
|
# The base renders its own template; check the template's body is unchanged
|
|
# apart from the header comment, so the comparison is fair.
|
|
diff <(git -C "$tree" show "$base:packages/webui/systemd/mosaic-webui.service.in" | grep -v '^#') <(grep -v '^#' "$tree/packages/webui/systemd/mosaic-webui.service.in") > "$out/template-body.diff" && echo "template body: same" || echo "template body: DIFFERS"
|
|
uid=6f1c0e2a9b8d7c4e5f3a2b1c0d9e8f7a6b5c4d3e2f1a0b9c8d7e6f5a4b3c2d1e
|
|
n=0 same=0
|
|
while IFS= read -r flags; do
|
|
n=$((n+1))
|
|
# shellcheck disable=SC2086
|
|
"$b" render $flags 2>&1 | grep -v '^#' > "$out/base-$n.txt"; bs=${PIPESTATUS[0]}
|
|
# shellcheck disable=SC2086
|
|
"$tree/scripts/webui-service.sh" render $flags 2>&1 | grep -v '^#' > "$out/cand-$n.txt"; cs=${PIPESTATUS[0]}
|
|
if [ "$bs" = "$cs" ] && cmp -s "$out/base-$n.txt" "$out/cand-$n.txt"; then same=$((same+1)); r=same; else r=DIFFERS; fi
|
|
echo "$n exit $bs/$cs $r: render $flags"
|
|
done <<FLAGS
|
|
|
|
--port 7444
|
|
--business mosaic --board http://127.0.0.1:7331
|
|
--public-host console.example.com --auth-header X-authentik-uid --allow-user $uid
|
|
--public-host console.example.com --auth-header X-authentik-uid --allow-user $uid --send
|
|
--public-host console.example.com --auth-header X-authentik-username --allow-user jason
|
|
--port 0
|
|
--business a.b
|
|
FLAGS
|
|
echo "$same of $n same"
|