aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/check-glibc.sh
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-11-15 02:54:21 +0100
committersalmonik <salmonik@tuta.io>2026-11-15 02:54:21 +0100
commit7175543e00caa9ce35487fa7f8b1b479c1ba00a2 (patch)
tree10f89f85ca35d6ac7515bbe88518255788d6dc22 /scripts/check-glibc.sh
downloadagent686-7175543e00caa9ce35487fa7f8b1b479c1ba00a2.tar.gz
agent686-7175543e00caa9ce35487fa7f8b1b479c1ba00a2.zip
M0: streaming provider, SSE decoder, mock provider, i686 build gate
Diffstat (limited to '')
-rwxr-xr-xscripts/check-glibc.sh35
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.
7set -euo pipefail
8
9binary=${1:?usage: check-glibc.sh <binary> [ceiling, default 2.36]}
10ceiling=${2:-2.36}
11
12if [ ! -f "$binary" ]; then
13 echo "check-glibc: no such file: $binary" >&2
14 exit 2
15fi
16
17max=$(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
23if [ -z "${max:-}" ]; then
24 echo "check-glibc: no versioned symbols (statically linked?) — nothing to check"
25 exit 0
26fi
27
28echo "check-glibc: max symbol version GLIBC_$max, ceiling GLIBC_$ceiling"
29
30if [ "$(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
33fi
34
35echo "check-glibc: ok"