#!/bin/sh

pwfile="/etc/passwd"
for user in $(sed -e 's/^\(.*\):x:\(.*\):.*:.*:.*:.*$/\1/' $pwfile) ; do
	uid="$(grep -e "^$user:.*$" $pwfile | cut -d: -f 3 )"
	if [ "$uid" -lt "500" ] ; then
		blacklist="$blacklist $user"
	fi
done
sed -i "s/^black.*/black=$blacklist/" /etc/lxdm/lxdm.conf

if [ -r /etc/profile.d/lang.sh ]; then
	. /etc/profile.d/lang.sh
fi

if [ -n "$DEFAULT_WM" ]; then
	PREFERRED=$DEFAULT_WM
fi

if [ -n "$DESKTOP" ]; then
	export DESKTOP
fi

if [ -n "$PREFERRED" ]; then
	export PREFERRED
fi

ionice -c2 -n0 nice -n -15 /usr/sbin/lxdm-binary $*
#renice -n -19 -p $(pidof lxdm-binary)
