Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

xsession

By: donniezazen on Apr 10th, 2012  |  syntax: None  |  size: 1.67 KB  |  views: 71  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #!/bin/sh
  2. #
  3. # LightDM wrapper to run around X sessions.
  4.  
  5. echo "Running X session wrapper"
  6.  
  7. # Load profile
  8. for file in "/etc/profile" "$HOME/.profile" "/etc/xprofile" "$HOME/.xprofile"; do
  9.     if [ -f "$file" ]; then
  10.         echo "Loading profile from $file";
  11.         . "$file"
  12.     fi
  13. done
  14.  
  15. # Load resources
  16. for file in "/etc/X11/Xresources" "$HOME/.Xresources"; do
  17.     if [ -f "$file" ]; then
  18.         echo "Loading resource: $file"
  19.         xrdb -nocpp -merge "$file"
  20.     fi
  21. done
  22.  
  23. # Load keymaps
  24. for file in "/etc/X11/Xkbmap" "$HOME/.Xkbmap"; do
  25.     if [ -f "$file" ]; then
  26.         echo "Loading keymap: $file"
  27.         setxkbmap `cat "$file"`
  28.         XKB_IN_USE=yes
  29.     fi
  30. done    
  31.  
  32. # Load xmodmap if not using XKB
  33. if [ -z "$XKB_IN_USE" ]; then
  34.     for file in "/etc/X11/Xmodmap" "$HOME/.Xmodmap"; do
  35.         if [ -f "$file" ]; then
  36.            echo "Loading modmap: $file"
  37.            xmodmap "$file"
  38.         fi
  39.     done
  40. fi
  41.  
  42. unset XKB_IN_USE
  43.  
  44. # Run all system xinitrc shell scripts.
  45. xinitdir="/etc/X11/xinit/xinitrc.d"
  46. if [ -d "$xinitdir" ]; then
  47.     for script in $xinitdir/*; do
  48.         echo "Loading xinit script $script"
  49.         if [ -x "$script" -a ! -d "$script" ]; then
  50.             . "$script"
  51.         fi
  52.     done
  53. fi
  54.  
  55. # Load Xsession scripts
  56. xsessionddir="/etc/X11/Xsession.d"
  57. if [ -d "$xsessionddir" ]; then
  58.     for i in `ls $xsessionddir`; do
  59.         script="$xsessionddir/$i"
  60.         echo "Loading X session script $script"
  61.         if [ -r "$script"  -a -f "$script" ] && expr "$i" : '^[[:alnum:]_-]\+$' > /dev/null; then
  62.             . "$script"
  63.         fi
  64.     done
  65. fi
  66.  
  67. echo "X session wrapper complete, running session $@"
  68.  
  69. exec $@
clone this paste RAW Paste Data