Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate

Advertising

Paste Description for /etc/gdm/Xsession

The content of my /etc/gdm/Xsession

/etc/gdm/Xsession
Sunday, November 14th, 2010 at 7:03:52am UTC 

  1. #!/bin/sh
  2. #
  3. # This is SORT OF LIKE an X session, but not quite.  You get a command as the
  4. # first argument (it could be multiple words, so run it with "eval").  As a
  5. # special case, the command can be:
  6. #  default - Run the appropriate Xclients startup (see the code below)
  7. #  custom - Run ~/.xsession and if that's not available run 'default'
  8. #
  9. # (Note that other arguments could also follow, but only the command one is
  10. # right now relevant and supported)
  11. #
  12. # The output is ALREADY redirected to .xsession-errors in GDM.  This way
  13. # .xsession-errors actually gets more output such as if the PreSession script
  14. # is failing.  This also prevents DoS attacks if some app in the users session
  15. # can be prodded to dump lots of stuff on the stdout/stderr.  We wish to be
  16. # robust don't we?  In case you wish to use an existing script for other DM's,
  17. # you can just not redirect when GDMSESSION is set.  GDMSESSION will always
  18. # be set from gdm.
  19. #
  20. # Also note that this is not run as a login shell, this is just executed.
  21. # This is why we source the profile files below.
  22. #
  23. # based on:
  24. # $XConsortium: Xsession /main/10 1995/12/18 18:21:28 gildea $
  25.  
  26.  
  27. # this will go into the .xsession-errors along with all other echo's
  28. # good for debugging where things went wrong
  29. echo "$0: Beginning session setup..."
  30.  
  31. # First read /etc/profile and .profile
  32. test -f /etc/profile && . /etc/profile
  33. test -f "$HOME/.profile" && . "$HOME/.profile"
  34. # Second read /etc/xprofile and .xprofile for X specific setup
  35. test -f /etc/xprofile && . /etc/xprofile
  36. test -f "$HOME/.xprofile" && . "$HOME/.xprofile"
  37.  
  38. # Translation stuff
  39. if [ -x "/usr/lib/gdm/gdmtranslate" ] ; then
  40.   gdmtranslate="/usr/lib/gdm/gdmtranslate"
  41. else
  42.   gdmtranslate=
  43. fi
  44.  
  45. # Note that this should only go to zenity dialogs which always expect utf8
  46. gettextfunc () {
  47.   if [ "x$gdmtranslate" != "x" ] ; then
  48.     "$gdmtranslate" --utf8 "$1"
  49.   else
  50.     echo "$1"
  51.   fi
  52. }
  53.  
  54. OLD_IFS=$IFS
  55.  
  56. gdmwhich () {
  57.   COMMAND="$1"
  58.   OUTPUT=
  59.   IFS=:
  60.   for dir in $PATH
  61.   do
  62.     if test -x "$dir/$COMMAND" ; then
  63.       if test "x$OUTPUT" = "x" ; then
  64.         OUTPUT="$dir/$COMMAND"
  65.       fi
  66.     fi
  67.   done
  68.   IFS=$OLD_IFS
  69.   echo "$OUTPUT"
  70. }
  71.  
  72. zenity=`gdmwhich zenity`
  73.  
  74. # Note: ~/.xsession-errors is now done in the daemon so that it
  75. # works for ALL sessions (except ones named 'Failsafe')
  76.  
  77. # clean up after xbanner
  78. freetemp=`gdmwhich freetemp`
  79. if [ -n "$freetemp" ] ; then
  80.         "$freetemp"
  81. fi
  82.  
  83. userresources="$HOME/.Xresources"
  84. usermodmap="$HOME/.Xmodmap"
  85. userxkbmap="$HOME/.Xkbmap"
  86.  
  87. sysresources=/etc/X11/Xresources
  88. sysmodmap=/etc/X11/Xmodmap
  89. sysxkbmap=/etc/X11/Xkbmap
  90.  
  91. rh6sysresources=/etc/X11/xinit/Xresources
  92. rh6sysmodmap=/etc/X11/xinit/Xmodmap
  93.  
  94. # merge in defaults
  95. if [ -f "$rh6sysresources" ]; then
  96.     xrdb -nocpp -merge "$rh6sysresources"
  97. fi
  98.  
  99. if [ -f "$sysresources" ]; then
  100.     xrdb -nocpp -merge "$sysresources"
  101. fi
  102.  
  103. if [ -f "$userresources" ]; then
  104.     xrdb -nocpp -merge "$userresources"
  105. fi
  106.  
  107. # merge in keymaps
  108. if [ -f "$sysxkbmap" ]; then
  109.     setxkbmap `cat "$sysxkbmap"`
  110.     XKB_IN_USE=yes
  111. fi
  112.  
  113. if [ -f "$userxkbmap" ]; then
  114.     setxkbmap `cat "$userxkbmap"`
  115.     XKB_IN_USE=yes
  116. fi
  117.  
  118. #
  119. # Eeek, this seems like too much magic here
  120. #
  121. if [ -z "$XKB_IN_USE" -a ! -L /etc/X11/X ]; then
  122.     if grep '^exec.*/Xsun' /etc/X11/X > /dev/null 2>&1 && [ -f /etc/X11/XF86Config ]; then
  123.        xkbsymbols=`sed -n -e 's/^[     ]*XkbSymbols[   ]*"\(.*\)".*$/\1/p' /etc/X11/XF86Config`
  124.        if [ -n "$xkbsymbols" ]; then
  125.            setxkbmap -symbols "$xkbsymbols"
  126.            XKB_IN_USE=yes
  127.        fi
  128.     fi
  129. fi
  130.  
  131. # xkb and xmodmap don't play nice together
  132. if [ -z "$XKB_IN_USE" ]; then
  133.     if [ -f "$rh6sysmodmap" ]; then
  134.        xmodmap "$rh6sysmodmap"
  135.     fi
  136.  
  137.     if [ -f "$sysmodmap" ]; then
  138.        xmodmap "$sysmodmap"
  139.     fi
  140.  
  141.     if [ -f "$usermodmap" ]; then
  142.        xmodmap "$usermodmap"
  143.     fi
  144. fi
  145.  
  146. unset XKB_IN_USE
  147.  
  148. # Overwrite $LANG from /etc/profile (and friends) with the one picked in the
  149. # greeter
  150. if [ -n "$GDM_LANG" ]; then
  151.   LANG="$GDM_LANG"
  152.   export LANG
  153. fi
  154.  
  155. # run all system xinitrc shell scripts.
  156. if [ -d /etc/X11/xinit/xinitrc.d ]; then
  157.     for i in /etc/X11/xinit/xinitrc.d/* ; do
  158.         if [ -x "$i" -a ! -d "$i" ]; then
  159.             . "$i"
  160.         fi
  161.     done
  162. fi
  163.  
  164. # run /etc/X11/Xsession.d/
  165. OPTIONFILE=/etc/X11/Xsession.options
  166. USERXSESSION=$HOME/.xsession
  167. USERXSESSIONRC=$HOME/.xsessionrc
  168. ALTUSERXSESSION=$HOME/.Xsession
  169. if [ -d /etc/X11/Xsession.d ]; then
  170.     for i in `ls /etc/X11/Xsession.d/` ; do
  171.         if [ -r "/etc/X11/Xsession.d/$i" ] && expr "$i" : '^[[:alnum:]_-]\+$' > /dev/null; then
  172.             . "/etc/X11/Xsession.d/$i"
  173.         fi
  174.     done
  175. fi
  176.  
  177. if [ "x$command" = "xcustom" ] ; then
  178.   if [ -x "$HOME/.xsession" ]; then
  179.     command="$HOME/.xsession"
  180.   else
  181.     echo "$0: Cannot find ~/.xsession will try the default session"
  182.     command="default"
  183.   fi
  184. fi
  185.  
  186. if [ "x$command" = "xdefault" ] ; then
  187.   if [ -x "$HOME/.Xclients" ]; then
  188.     command="$HOME/.Xclients"
  189.   elif [ -x /etc/X11/xinit/Xclients ]; then
  190.     command="/etc/X11/xinit/Xclients"
  191.   elif [ -x /etc/X11/Xclients ]; then
  192.     command="/etc/X11/Xclients"
  193.   else
  194.     if [ -n "$zenity" ] ; then
  195.         disptext=`gettextfunc "System has no Xclients file, so starting a failsafe xterm session.  Windows will have focus only if the mouse pointer is above them.  To get out of this mode type 'exit' in the window."`
  196.       "$zenity" --info --text "$disptext"
  197.     else
  198.       echo "$0: Cannot find Xclients"
  199.     fi
  200.     exec xterm -geometry 80x24+0+0
  201.   fi
  202. fi
  203.  
  204. # add ssh-agent if found
  205. sshagent="`gdmwhich ssh-agent`"
  206. if [ -n "$sshagent" ] && [ -x "$sshagent" ] && [ -z "$SSH_AUTH_SOCK" ]; then
  207.     command="$sshagent -- $command"
  208. elif [ -z "$sshagent" ] ; then
  209.     echo "$0: ssh-agent not found!"
  210. fi
  211.  
  212. echo "$0: Setup done, will execute: $command"
  213.  
  214. eval exec $command
  215.  
  216. echo "$0: Executing $command failed, will run xterm"
  217.  
  218. if [ -n "$zenity" ] ; then
  219.         disptext=`gettextfunc "Failed to start the session, so starting a failsafe xterm session.  Windows will have focus only if the mouse pointer is above them.  To get out of this mode type 'exit' in the window."`
  220.         "$zenity" --info --text "$disptext"
  221. fi
  222.  
  223. exec xterm -geometry 80x24+0+0

advertising

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will not expire by default. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

comments powered by Disqus
worth-right