#!/usr/bin/env /lib/runit/invoke-run
#Copyright: 2026 Lorenzo Puliti <plorenzo@disroot.org>
#License: CC0-1.0

DEFAULT_DISPLAY_MANAGER=$(cat /etc/X11/default-display-manager)

# don't start if greetd is not the default DM //we ship as disabled for now
##NOTE this needs a fix in greetd deb package as it's missing the
## postinst code to add itself to the display manager debconf (postinst/prerm)
## see #1137075  https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1137075
##if [ $DEFAULT_DISPLAY_MANAGER != ##bin## ]; then
##	exit 161
##fi

sv start dbus || true
sv start elogind || true

if [ -x /bin/plymouth ] ; then
        /bin/plymouth quit || true
fi

#see MR 8/Salsa: https://salsa.debian.org/debian/greetd/-/merge_requests/8
#install -o _greetd -g _greetd -m 0755 -d /var/lib/greetd

exec 2>&1

exec ##bin##
