#!/bin/sh
#
# LightDM session wrapper: sets up the environment, then runs the session
# command it is given (the Exec= line of the chosen session).

[ -f /etc/profile ] && . /etc/profile
[ -f "$HOME/.profile" ] && . "$HOME/.profile"
[ -f "$HOME/.xprofile" ] && . "$HOME/.xprofile"

[ -f "$HOME/.Xresources" ] && xrdb -merge "$HOME/.Xresources"

if [ -d /etc/X11/xinit/xinitrc.d ]; then
	for f in /etc/X11/xinit/xinitrc.d/*; do
		[ -x "$f" ] && . "$f"
	done
	unset f
fi

if command -v dbus-launch >/dev/null && [ -z "$DBUS_SESSION_BUS_ADDRESS" ]; then
	eval "$(dbus-launch --sh-syntax --exit-with-session)"
fi

exec sh -l -c "$*"
