Skip to content

Commit 0fc4a6d

Browse files
committed
update install-agent.sh to prefer glibc binary on linux glibc systems
1 parent af0c1d3 commit 0fc4a6d

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

supplemental/scripts/install-agent.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,24 @@ is_freebsd() {
1212
[ "$(uname -s)" = "FreeBSD" ]
1313
}
1414

15+
is_glibc() {
16+
# Prefer glibc-enabled agent (NVML via purego) on linux/amd64 glibc systems.
17+
# Check common dynamic loader paths first (fast + reliable).
18+
for p in \
19+
/lib64/ld-linux-x86-64.so.2 \
20+
/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 \
21+
/lib/ld-linux-x86-64.so.2; do
22+
[ -e "$p" ] && return 0
23+
done
24+
25+
# Fallback to ldd output if available.
26+
if command -v ldd >/dev/null 2>&1; then
27+
ldd --version 2>&1 | grep -qiE 'gnu libc|glibc' && return 0
28+
fi
29+
30+
return 1
31+
}
32+
1533

1634
# If SELinux is enabled, set the context of the binary
1735
set_selinux_context() {
@@ -598,6 +616,9 @@ echo "Downloading and installing the agent..."
598616
OS=$(uname -s | sed -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/')
599617
ARCH=$(detect_architecture)
600618
FILE_NAME="beszel-agent_${OS}_${ARCH}.tar.gz"
619+
if [ "$OS" = "linux" ] && [ "$ARCH" = "amd64" ] && is_glibc; then
620+
FILE_NAME="beszel-agent_${OS}_${ARCH}_glibc.tar.gz"
621+
fi
601622

602623
# Determine version to install
603624
if [ "$VERSION" = "latest" ]; then

0 commit comments

Comments
 (0)