#!/usr/bin/env /lib/runit/invoke-run
set -e

DEFAULT_DISPLAY_MANAGER=$(cat /etc/X11/default-display-manager)
# start only if lightdm the default DM
if [ $DEFAULT_DISPLAY_MANAGER != /usr/sbin/lightdm ]; then
	exit 161
fi

sv start dbus  && sv check dbus  || exit 170
sv start elogind  && sv check elogind  || true

if [ -r /etc/default/locale ]; then
  . /etc/default/locale
  export LANG LANGUAGE
fi

exec 2>&1

if [ -e /etc/runit/verbose ]; then
	echo "invoke-run: starting ${PWD##*/}"
fi
exec /usr/sbin/lightdm 
