diff options
| author | salmonik <salmonik@tuta.io> | 2026-11-15 02:54:21 +0100 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-11-15 02:54:21 +0100 |
| commit | 7175543e00caa9ce35487fa7f8b1b479c1ba00a2 (patch) | |
| tree | 10f89f85ca35d6ac7515bbe88518255788d6dc22 /scripts/check-glibc.sh | |
| download | agent686-7175543e00caa9ce35487fa7f8b1b479c1ba00a2.tar.gz agent686-7175543e00caa9ce35487fa7f8b1b479c1ba00a2.zip | |
M0: streaming provider, SSE decoder, mock provider, i686 build gate
Diffstat (limited to 'scripts/check-glibc.sh')
| -rwxr-xr-x | scripts/check-glibc.sh | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/scripts/check-glibc.sh b/scripts/check-glibc.sh new file mode 100755 index 0000000..bb9052f --- /dev/null +++ b/scripts/check-glibc.sh | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | #!/usr/bin/env bash | ||
| 2 | # Gate a release on the glibc the target actually has. | ||
| 3 | # | ||
| 4 | # The dev host's 32-bit glibc is newer than Debian 12's, so a dependency can | ||
| 5 | # silently raise the required symbol version. Without this check the failure | ||
| 6 | # only shows up as "version `GLIBC_2.38' not found" on the target machine. | ||
| 7 | set -euo pipefail | ||
| 8 | |||
| 9 | binary=${1:?usage: check-glibc.sh <binary> [ceiling, default 2.36]} | ||
| 10 | ceiling=${2:-2.36} | ||
| 11 | |||
| 12 | if [ ! -f "$binary" ]; then | ||
| 13 | echo "check-glibc: no such file: $binary" >&2 | ||
| 14 | exit 2 | ||
| 15 | fi | ||
| 16 | |||
| 17 | max=$(readelf -V "$binary" 2>/dev/null \ | ||
| 18 | | grep -oE 'GLIBC_[0-9]+\.[0-9]+' \ | ||
| 19 | | sed 's/^GLIBC_//' \ | ||
| 20 | | sort -Vu \ | ||
| 21 | | tail -1 || true) | ||
| 22 | |||
| 23 | if [ -z "${max:-}" ]; then | ||
| 24 | echo "check-glibc: no versioned symbols (statically linked?) — nothing to check" | ||
| 25 | exit 0 | ||
| 26 | fi | ||
| 27 | |||
| 28 | echo "check-glibc: max symbol version GLIBC_$max, ceiling GLIBC_$ceiling" | ||
| 29 | |||
| 30 | if [ "$(printf '%s\n%s\n' "$ceiling" "$max" | sort -V | tail -1)" != "$ceiling" ]; then | ||
| 31 | echo "check-glibc: FAIL — binary needs GLIBC_$max, target has GLIBC_$ceiling" >&2 | ||
| 32 | exit 1 | ||
| 33 | fi | ||
| 34 | |||
| 35 | echo "check-glibc: ok" | ||
