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"