Previous Page | Next Page

  1. Introduction
  2. Abbreviated Boot
  3. The Boot Process
  4. Startup and Run Levels
  5. Initialization Scripts
  6. Runlevel Scripts
  7. Login Process
  8. Bash Shell
  9. Filesystems
  10. LILO, Kernel and Root Filesystem
  11. The Kernel
  12. Passwords, Users, Groups, and Quotas
  13. The Environment
  14. The /etc/sysconfig directory
  15. The /proc filesystem
  16. Process Control
  17. Devices
  18. Daemons Services
  19. Inetd and Network Services
  20. Programs and Libraries
  21. Security and PAM
  22. The printer services
  23. Mouse support with gpm
  24. Mail
  25. News
  26. UUCP
  27. LDAP
  28. NFS and RPC
  29. Samba, NetBIOS, WINS, nmbd
  30. Identd (auth)
  31. Telnet and FTP
  32. Apache web server
  33. DNS and named
  34. How X Works
  35. X Scripts
  36. Support for Text
  37. Keymapping for Programs
  38. Keycode Table
  39. Example Keymap File
  40. Terminfo Commands
  41. VT100 ESC sequences
  42. Kernel Revisited
  43. Configuration Files
  44. Credits

Linux X Script Files

For reference, this section lists some script files used to start X sessions:

startx

#!/bin/sh
#
# (c) 1999 Red Hat Software, Inc.

bindir=/usr/X11R6/bin

userclientrc=$HOME/.xinitrc
userserverrc=$HOME/.xserverrc
sysclientrc=/etc/X11/xinit/xinitrc
sysserverrc=/etc/X11/xinit/xserverrc
clientargs=""
serverargs=""

if [ -f $userclientrc ]; then
    clientargs=$userclientrc
else if [ -f $sysclientrc ]; then
    clientargs=$sysclientrc
fi
fi

if [ -f $userserverrc ]; then
    serverargs=$userserverrc
else if [ -f $sysserverrc ]; then
    serverargs=$sysserverrc
fi
fi

display=:0
whoseargs="client"
while [ "x$1" != "x" ]; do
    case "$1" in
	/''*|\.*)	if [ "$whoseargs" = "client" ]; then
		    if [ "x$clientargs" = x ]; then
			clientargs="$1"
		    else
			clientargs="$clientargs $1"
		    fi
		else
		    if [ "x$serverargs" = x ]; then
			serverargs="$1"
		    else
			serverargs="$serverargs $1"
		    fi
		fi ;;
	--)	whoseargs="server" ;;
	*)	if [ "$whoseargs" = "client" ]; then
		    clientargs="$clientargs $1"
		else
    		    case "$1" in
		        :[0-9]) display="$1"
		        ;;
                        *) serverargs="$serverargs $1"
			;;
		    esac
		fi ;;
    esac
    shift
done

# set up default Xauth info for this machine
mcookie=`mcookie`
serverargs="$serverargs -auth $HOME/.Xauthority"
xauth add $display . $mcookie
xauth add `hostname -f`$display . $mcookie

xinit $clientargs -- $display $serverargs

# various machines need special cleaning up,
# which should be done here

/etc/X11/xinit/xinitrc

#!/bin/sh
# (c) 1999 Red Hat Software, Inc.

userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
userxkbmap=$HOME/.Xkbmap

sysresources=/etc/X11/xinit/Xresources
sysmodmap=/etc/X11/xinit/Xmodmap
sysxkbmap=/etc/X11/xinit/Xkbmap

# backward compatibility
oldsysresources=/usr/X11R6/lib/X11/xinit/.Xresources
oldsysmodmap=/usr/X11R6/lib/X11/xinit/.Xmodmap

# merge in defaults
if [ -f $oldsysresources ]; then
    xrdb -merge $oldsysresources
fi

if [ -f $sysresources ]; then
    xrdb -merge $sysresources
fi

if [ -f $userresources ]; then
    xrdb -merge $userresources
fi

# merge in keymaps
if [ -f $sysxkbmap ]; then
    setxkbmap `cat $sysxkbmap`
    XKB_IN_USE=yes
fi

if [ -f $userxkbmap ]; then
    setxkbmap `cat $userxkbmap`
    XKB_IN_USE=yes
fi

# xkb and xmodmap don't play nice together
if [ -z $XKB_IN_USE ]; then
    if [ -f $oldsysmodmap ]; then
	xmodmap $oldsysmodmap
    fi

    if [ -f $sysmodmap ]; then
	xmodmap $sysmodmap
    fi

    if [ -f $usermodmap ]; then
	xmodmap $usermodmap
    fi
fi

unset XKB_IN_USE

if [ -f $usermodmap ]; then
    xmodmap $usermodmap
fi

if [ -z "$BROWSER" ] ; then
	# we need to find a browser on this system
	BROWSER=`which netscape`
	if [ -z "$BROWSER" ] || [ ! -e "$BROWSER" ] ; then
	# not found yet
		BROWSER=
	fi
fi

if [ -z "$BROWSER" ] ; then
	# we need to find a browser on this system
	BROWSER=`which lynx`
	if [ -z "$BROWSER" ] || [ ! -e "$BROWSER" ] ; then
	# not found yet
		BROWSER=
	else
		BROWSER="xterm -font 9x15 -e lynx"
	fi
fi
export BROWSER

# The user may have their own clients they want to run.  If they don't,
# fall back to system defaults.

if [ -f $HOME/.Xclients ]; then
    exec $HOME/.Xclients
elif [ -f /etc/X11/xinit/Xclients ]; then
    exec /etc/X11/xinit/Xclients
else
       # failsafe settings.  Although we should never get here
       # (we provide fallbacks in Xclients as well) it can't hurt.
       xclock -geometry 100x100-5+5 &
       xterm -geometry 80x50-50+150 &
       if [ -f /usr/bin/netscape -a -f /usr/doc/HTML/index.html ]; then
               netscape /usr/doc/HTML/index.html &
       fi
       if [ -f /usr/X11R6/bin/fvwm ]; then
               exec fvwm
       else
               exec twm
       fi
fi

/etc/X11/xinitrc/Xclients

#!/bin/bash
# (c) 1999 Red Hat Software, Inc.

# check to see if the user has a preferred desktop
PREFERRED=
if [ -f /etc/sysconfig/desktop ]; then
    if [ -n "`grep -i GNOME /etc/sysconfig/desktop`" ]; then
	PREFERRED=gnome-session
    elif [ -n "`grep -i KDE /etc/sysconfig/desktop`" ]; then
	PREFERRED=startkde
    elif [ -n "`grep -i AnotherLevel /etc/sysconfig/desktop`" ]; then
	PREFERRED=AnotherLevel
    fi
fi

if [ -n "$PREFERRED" -a "$PREFERRED" != "AnotherLevel" ] && \
	which $PREFERRED >/dev/null 2>&1; then
    PREFERRED=`which $PREFERRED`
    exec $PREFERRED
fi

# now if we can reach here, either they want AnotherLevel or there was
# no desktop file present and the PREFERRED variable is not set.

if [ -z "$PREFERRED" ]; then
 
    GSESSION=gnome-session
    STARTKDE=startkde
 
    # by default, we run GNOME.
    if which $GSESSION >/dev/null 2>&1; then
	exec `which $GSESSION`
    fi

    # if GNOME isn't installed, try KDE.
    if which $STARTKDE >/dev/null 2>&1; then
	exec `which $STARTKDE`
    fi
fi

# Last, try AnotherLevel

# these files are left sitting around by TheNextLevel.
rm -f $HOME/Xrootenv.0
rm -f /tmp/fvwmrc* 2>/dev/null

# First thing - check the user preferences
if [ -f $HOME/.wm_style ] ; then
    WMSTYLE=`cat $HOME/.wm_style`
    case "$WMSTYLE" in 
	Afterstep | AfterStep)
	exec /usr/X11R6/bin/RunWM --AfterStep
	;;
	WindowMaker | Windowmaker | WMaker |  wmaker)
	exec /usr/X11R6/bin/RunWM --WindowMaker
	;;
	Fvwm95 | fvwm95)
	exec /usr/X11R6/bin/RunWM --Fvwm95
	;;
	Mwm | MWM | Lesstif)
	exec /usr/X11R6/bin/RunWM --FvwmMWM
	;;
    esac
fi

# Argh! Nothing good is isntalled. Fall back to fvwm2 (win95-style) or twm
/usr/X11R6/bin/RunWM --Fvwm95 || {
    # gosh, neither fvwm95 nor fvwm2 is available; 
    # fall back to failsafe settings
    xclock -geometry 100x100-5+5 &
    xterm -geometry 80x50-50+150 &
    if [ -f /usr/bin/netscape -a -f /usr/doc/HTML/index.html ]; then
	netscape /usr/doc/HTML/index.html &
    fi
    if [ -f /usr/X11R6/bin/fvwm ]; then
	exec fvwm
    else
	exec twm
    fi
}

/etc/X11/xinitrc/Xmodmap

keycode 22 = BackSpace