Fix ps detection

This commit is contained in:
Miguel Jacq 2026-06-21 16:57:24 +10:00
parent 9d251c1bbc
commit ddd118e3bb
Signed by: mig5
GPG key ID: 03906B4110AAD3B8
2 changed files with 13 additions and 3 deletions

View file

@ -90,9 +90,19 @@ require_supported_ci_os() {
}
pid1_comm() {
if [[ -r /proc/1/comm ]]; then
tr -d '[:space:]' </proc/1/comm || true
return
fi
if command -v ps >/dev/null 2>&1; then
ps -p 1 -o comm= 2>/dev/null | tr -d '[:space:]' || true
fi
}
configure_ansible_playbook_extra_args() {
local pid1
pid1="$(ps -p 1 -o comm= 2>/dev/null | tr -d '[:space:]' || true)"
pid1="$(pid1_comm)"
ANSIBLE_PLAYBOOK_EXTRA_ARGS=()
if [[ "${pid1}" != "systemd" ]]; then