From 647b54f9f5451ec7a2ddf0f305376fe3c31ed711 Mon Sep 17 00:00:00 2001 From: Craig Comstock Date: Thu, 5 Dec 2024 16:04:58 -0600 Subject: [PATCH] Adjusted cf-support for exotic UNIX platforms head -c 8 doesn't work on hpux 11.23 that we test on currently dd count=1 bs=8 should work on all UNIX systems tr on solaris needs LC_CTYPE=C as it can't handle binary data. Silence not found sysctl command where it is not present. Ticket: ENT-9786 Changelog: title libre --- misc/cf-support | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/misc/cf-support b/misc/cf-support index df7d1439b0..88ba2fb3b8 100755 --- a/misc/cf-support +++ b/misc/cf-support @@ -120,7 +120,7 @@ make_temp_dir() else # shellcheck disable=SC2021 # ^^ legacy/POSIX requires square brackets - _tmp="/tmp/`tr -dc "[A-Z][a-z][0-9]" /dev/null`" mkdir "$_tmp" echo "$_tmp" fi @@ -150,7 +150,11 @@ mkdir -p "$tmpdir" echo "Analyzing CFEngine core dumps" _core_log="$tmpdir"/core-dump.log -_sysctl_kernel_core_pattern="$(sysctl -n kernel.core_pattern)" +if command -v sysctl >/dev/null; then + _sysctl_kernel_core_pattern="$(sysctl -n kernel.core_pattern)" +else + _sysctl_kernel_core_pattern="" +fi if expr "$_sysctl_kernel_core_pattern" : ".*/systemd-coredump.*" > /dev/null 2>&1; then echo "Found systemd-coredump used in sysctl kernel.core_pattern \"$_sysctl_kernel_core_pattern\"" echo "Using coredumpctl to analyze CFEngine core dumps"