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

#NOTE: the NODM_ENABLED in /etc/default/nodm is ignored (policy 9.3.3.1.),
#we ship disabled by default: to start it just enable it with update-service

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

# don't start if nodm is not the default DM
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

exec 2>&1

exec ##bin## $NODM_OPTIONS --no-syslog --stderr
