#!/bin/sh
# This file was created by ROX-Session.

if [ -d "$HOME/bin" ]; then
   PATH="${HOME}/bin:${PATH}"
   export PATH
fi

# Step 1: Try to run ROX-Session. If it works, stop right here.

if [ -x "/usr/lib/rox/ROX-Session/AppRun" ]; then
   exec "/usr/lib/rox/ROX-Session/AppRun" -w < /dev/null
fi

# Step 2: It didn't work. Try to provide a failsafe login so the user
# can fix things.

# Load a window manager. Keep trying until we find one that works!

for wm in xfwm4 sawfish sawmill enlightenment wmaker icewm blackbox fluxbox \
   metacity kwin kwm fvwm2 fvwm 4Dwm twm; do
  if [ -x "`which $wm`" ]; then break; fi;
done

"$wm" &

xmessage -file - << END
rox-start: failed to run /usr/lib/rox/ROX-Session/AppRun

If you installed this from the rox-session ebuild, this shouldn't ever
happen.  Please report this bug to http://bugs.gentoo.org/

I'll try to give you an xterm and a filer window instead - try to find
and run ROX-Session to fix the problem. Close the xterm to logout.

If all else fails, delete your .xsession and .xinitrc files to get the
system defaults.

Good luck!
END
rox &
exec xterm
