spacepaste

  1.  
  2. #!/bin/sh
  3. #
  4. # LightDM wrapper to run around X sessions.
  5. echo "Running X session wrapper"
  6. # Load profile
  7. for file in "/etc/profile" "$HOME/.profile" "/etc/xprofile" "$HOME/.xprofile"; do
  8. if [ -f "$file" ]; then
  9. echo "Loading profile from $file";
  10. . "$file"
  11. fi
  12. done
  13. # Load resources
  14. for file in "/etc/X11/Xresources" "$HOME/.Xresources"; do
  15. if [ -f "$file" ]; then
  16. echo "Loading resource: $file"
  17. xrdb -nocpp -merge "$file"
  18. fi
  19. done
  20. # Load keymaps
  21. for file in "/etc/X11/Xkbmap" "$HOME/.Xkbmap"; do
  22. if [ -f "$file" ]; then
  23. echo "Loading keymap: $file"
  24. setxkbmap `cat "$file"`
  25. XKB_IN_USE=yes
  26. fi
  27. done
  28. # Load xmodmap if not using XKB
  29. if [ -z "$XKB_IN_USE" ]; then
  30. for file in "/etc/X11/Xmodmap" "$HOME/.Xmodmap"; do
  31. if [ -f "$file" ]; then
  32. echo "Loading modmap: $file"
  33. xmodmap "$file"
  34. fi
  35. done
  36. fi
  37. unset XKB_IN_USE
  38. # /etc/X11/xinit/xinitrc.d/80-dbus expects $command to be
  39. # set to the Xsession arguments. So make it happy. See
  40. # https://bugs.gentoo.org/show_bug.cgi?id=533456
  41. command="$@"
  42. # Run all system xinitrc shell scripts.
  43. xinitdir="/etc/X11/xinit/xinitrc.d"
  44. if [ -d "$xinitdir" ]; then
  45. for script in $xinitdir/*; do
  46. echo "Loading xinit script $script"
  47. if [ -x "$script" -a ! -d "$script" ]; then
  48. . "$script"
  49. fi
  50. done
  51. fi
  52. # Load Xsession scripts
  53. xsessionddir="/etc/X11/Xsession.d"
  54. if [ -d "$xsessionddir" ]; then
  55. for i in `ls $xsessionddir`; do
  56. script="$xsessionddir/$i"
  57. echo "Loading X session script $script"
  58. if [ -r "$script" -a -f "$script" ] && expr "$i" : '^[[:alnum:]_-]\+$' > /dev/null; then
  59. . "$script"
  60. fi
  61. done
  62. fi
  63. echo "X session wrapper complete, running session $@"
  64. exec $command
  65.