#!/bin/sh
#Copyright: 2022-2024 Lorenzo Puliti <plorenzo@disroot.org>
#           2026 Aitor <aitor@genuen.org>
#License: CC0-1.0
#Comment: must return immediately — sv start polls this. Never call loginctl
#Comment: (it blocks on D-Bus until Connection timed out).

# Ready enough: daemon process exists. seat0 / bus name can lag.
pidof elogind >/dev/null 2>&1 && exit 0
# binary is often /usr/libexec/elogind (no argv0 "elogind" on some builds)
pgrep -f '/usr/libexec/elogind$' >/dev/null 2>&1 && exit 0
[ -d /run/elogind ] && exit 0
exit 1
