#!/bin/sh
#-------------------------------------------------------------------------------
# XMSM X session initialization file for use with xinit/xdm
#-------------------------------------------------------------------------------

LOGFILE="$HOME/.xmsession.log"
XPROFILE="$HOME/.Xprofile"
XRESOURCES="$HOME/.Xresources"
XDEFAULTS="$HOME/.Xdefaults"

if [ -f "$LOGFILE" ]; then
	cp -f "$LOGFILE" "$LOGFILE".old
fi

exec > "$LOGFILE" 2>&1

if [ -f "$XPROFILE" ]; then
	echo "Sourcing $XPROFILE"
	. "$XPROFILE"
fi

if [ -f "$XDEFAULTS" ]; then
	echo "Merging $XDEFAULTS"
	xrdb -merge "$XDEFAULTS"
fi

if [ -f "$XRESOURCES" ]; then
	echo "Merging $XRESOURCES"
	xrdb -merge "$XRESOURCES"
fi

echo "Starting the session manager"
exec /usr/local/bin/xmsm
