#!/bin/ash
#/usr/bin/sdm-session

# Copyright 2003, 2004 Vagrant Cascadian <vagrant@freegeek.org>.
# Licensed under the terms of the GNU General Public License,
# version 2 or any later version.

# no longer "exec"s Xsession, so that we can kill sshd if 
# needed later...
if [ -x /etc/sdm/Xsession ]; then
	/etc/sdm/Xsession $@
elif [ -x /etc/X11/Xsession ]; then
	/etc/X11/Xsession $1
elif [ -x $(which $1) ]; then
  $1
else
  echo "not able to find login session"
  xmessage -timeout 15 -center "not able to find login session"
fi

# kill the parent-process id, sshd.
# it's kind of crude, but prevents sdm from hanging if the
# user was running backgrounded processes...
kill $PPID
