Advertisement
Guest User

Untitled

a guest
Mar 30th, 2020
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.23 KB | None | 0 0
  1. #!/bin/bash
  2. # Copyright (C) 1999 - 2004 Red Hat, Inc. All rights reserved. This
  3. # copyrighted material is made available to anyone wishing to use, modify,
  4. # copy, or redistribute it subject to the terms and conditions of the
  5. # GNU General Public License version 2.
  6. #
  7. # You should have received a copy of the GNU General Public License
  8. # along with this program; if not, write to the Free Software
  9. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  10.  
  11. XFCESESSION="$(type -p xfce4-session)"
  12. GSESSION="$(type -p gnome-session)"
  13. STARTKDE="$(type -p startkde)"
  14.  
  15. # check to see if the user has a preferred desktop
  16. PREFERRED=
  17. if [ -f /etc/sysconfig/desktop ]; then
  18.     . /etc/sysconfig/desktop
  19.     if [ "$DESKTOP" = "GNOME" ]; then
  20.         PREFERRED="$GSESSION"
  21.     elif [ "$DESKTOP" = "KDE" ]; then
  22.         PREFERRED="$STARTKDE"
  23.     elif [ "$DESKTOP" = "XFCE" ]; then
  24.         PREFERRED="$XFCESESSION"
  25.     fi
  26. fi
  27.  
  28. if [ -n "$PREFERRED" ]; then
  29.     exec "$PREFERRED"
  30. fi
  31.  
  32. # now if we can reach here, either no desktop file was present,
  33. # or the desktop requested is not installed.
  34.  
  35. if [ -n "$XFCESESSION" -a -f /usr/share/xsessions/xfce.desktop ]; then
  36.     # by default, we run XFCE.
  37.     exec "$XFCESESSION"
  38. elif [ -n "$STARTKDE" ]; then
  39.     # if XFCE isn't installed, try KDE.
  40.     exec "$STARTKDE"
  41. fi
  42.  
  43. # We should also support /etc/X11/xinit/Xclients.d scripts
  44. XCLIENTS_D=/etc/X11/xinit/Xclients.d
  45. if [ "$#" -eq 1 ] && [ -x "$XCLIENTS_D/Xclients.$1.sh" ]; then
  46.     exec -l $SHELL -c "$SSH_AGENT $XCLIENTS_D/Xclients.$1.sh"
  47. fi
  48.  
  49. # Failsafe.
  50. # these files are left sitting around by TheNextLevel.
  51. rm -f $HOME/Xrootenv.0
  52.  
  53. # Argh! Nothing good is installed. Fall back to twm
  54. {
  55.     # gosh, neither fvwm95 nor fvwm2 is available;
  56.     # fall back to failsafe settings
  57.     [ -x /usr/bin/xsetroot ] && /usr/bin/xsetroot -solid '#222E45'
  58.  
  59.     if [ -x /usr/bin/xclock ] ; then
  60.         /usr/bin/xclock -geometry 100x100-5+5 &
  61.     fi
  62.     if [ -x /usr/bin/xterm ] ; then
  63.         /usr/bin/xterm -geometry 80x50-50+150 &
  64.     fi
  65.     if [ -x /usr/bin/firefox -a -f /usr/share/doc/HTML/index.html ]; then
  66.         /usr/bin/firefox /usr/share/doc/HTML/index.html &
  67.     fi
  68.     if [ -x /usr/bin/twm ] ; then
  69.         exec /usr/bin/twm
  70.     fi
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement