Xsession 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #!/bin/bash
  2. # use bash for "exec -l", howto run login shell by /bin/sh ?
  3. if [ `which "$1"` ]; then
  4. LXSESSION=$1
  5. else
  6. # default session
  7. LXSESSION=`grep -ri "exec" ~/.xinitrc | cut -d' ' -f2`
  8. fi
  9. [ -f /etc/profile ] && . /etc/profile
  10. [ -f /etc/bashrc ] && . /etc/bashrc
  11. if [ -f /etc/X11/xinit/xinitrc-common ]; then
  12. # fedora
  13. . /etc/X11/xinit/xinitrc-common
  14. exec -l bash -c "$LXSESSION"
  15. elif [ -x /etc/X11/xinit/Xsession ]; then
  16. # fedora
  17. exec /etc/X11/xinit/Xsession "$LXSESSION"
  18. elif [ -x /etc/X11/Xsession ]; then
  19. # mandriva, debian, ubuntu
  20. exec /etc/X11/Xsession "$LXSESSION"
  21. elif [ -x /etc/X11/xinit/xinitrc ]; then
  22. #suse
  23. export WINDOWMANAGER=$LXSESSION
  24. exec -l bash -c /etc/X11/xinit/xinitrc
  25. else
  26. # unknown, user should custom /etc/lxdm/xinitrc self
  27. if [ -x /etc/lxdm/xinitrc ]; then
  28. . /etc/lxdm/xinitrc "$LXSESSION"
  29. fi
  30. if [ -d /etc/X11/xinit/xinitrc.d ] ; then
  31. for f in /etc/X11/xinit/xinitrc.d/* ; do
  32. [ -x "$f" ] && . "$f"
  33. done
  34. unset f
  35. fi
  36. if which dbus-launch >/dev/null && test -z "$DBUS_SESSION_BUS_ADDRESS";
  37. then
  38. eval "$(dbus-launch --sh-syntax --exit-with-session)"
  39. fi
  40. exec -l bash -c "$LXSESSION"
  41. fi