SUMMARY: XDM Installation

From: Massimo Mentrasti (max@ssi.it)
Date: Wed Mar 31 1993 - 18:15:13 CST


My original question:

> I am installing two Digital VXT2000 X-terminals that should display clients
> running on a SPARCserver 690 , SunOS 4.1.3 , Openwindow 3. I want to run
> olwm as window manager.
> I installed the X Display Manager (xdm) as explained on the xdm man pages but
> the Xsession shell script that SUN provides is the following:

#!/bin/sh
# @(#)Xsession 1.4 91/09/14
#
# Xsession
#
# This is the program that is run as the client
# for the display manager. This example is
# quite friendly as it attempts to run a per-user
# .xsession file instead of forcing a particular
# session layout
#
OPENWINHOME=${OPENWINHOME:-/usr/openwin}
LD_LIBRARY_PATH=$OPENWINHOME/lib
PATH=$OPENWINHOME/bin:$PATH
MANPATH=$OPENWINHOME/man:$MANPATH
export LD_LIBRARY_PATH PATH MANPATH

# try source .login/.profile
#
#case $SHELL in
#"/bin/csh")
# . $HOME/.login
# . $HOME/.cshrc
# ;;
#"/bin/ksh")
# . $HOME/.profile
# ;;
#esac

#
# Force server to change userid to $USER
#
$OPENWINHOME/bin/xhost +$USER@ > /dev/null 2>&1

case $# in
1)
        case $1 in
        failsafe)
                exec xterm -geometry 80x24-0-0 -ls
                ;;
        esac
esac

startup=$HOME/.xinitrc
resources=$HOME/.Xresources

if [ -f $startup ]; then
        exec /bin/sh $startup
else
        if [ -f $resources ]; then
                xrdb -load $resources
        fi
        twm &
        exec xterm -geometry 80x24+10+10 -ls
fi

> If xdm executes Xsession as shown before, the result is that .login and .cshrc
> are not executed; if xdm tries to execute ". $HOME/.login " and . "$HOME/.cshrc"
> obviously Xsession fails ( is it possible to execute ". .cshrc" in a sh instead
>of "source .cshrc" in a csh ???!!!) and so all the .login settings are lost.
> I must execute the users .login and .cshrc to make my x-applications working,
> what should I do ? Anybody could suggest me how should I customize the
> Xstartup, Xsession, Xreset, xdm-config and so on ?

SOLUTIONS:

1) rewrite Xsession as a csh script. A good example comes from Todd Pfaff:

#!/bin/csh
#
# xdm xsession script for OpenWindows
#
# Todd Pfaff

source .login

if($#argv == 1) then
  if($1 == failsafe) exec xterm -geometry 80x24-0-0 -ls
endif

set owinitrc=$HOME/.owinitrc
if ( ! -e $owinitrc ) then
  set owinitrc=/local/share/lib/.owinitrc
  if ( ! -e $owinitrc ) then
    set owinitrc=$OPENWINHOME/lib/Xinitrc
  endif
endif
if ( -f $owinitrc ) then
  if ( -x $owinitrc ) then
    exec $owinitrc
  else
    exec sh $owinitrc
  endif
else
  set resources=$HOME/.Xresources
  if ( ! -f $resources ) then
    set resources=$HOME/.Xdefaults
    if ( ! -f $resources ) then
      set resources=/local/share/lib/.Xdefaults
      if ( ! -f $resources ) then
        set resources=$OPENWINHOME/lib/Xdefaults
      endif
    endif
  endif
  if ( -f $resources ) then
    xrdb -load $resources
  endif
  twm &
  exec xterm -geometry 80x24+10+10 -ls
endif

Note that "source .cshrc" is done automaticly when -f is not supplied to
the header "#! /bin/csh" !!!

2) write a .profile for each user that sets the same environment that
   .login does.

3) an original solution is the following:

startup=$HOME/.xinitrc

if [ -f $startup ]; then
        cd /tmp
        rm -f -$$
        ln -s /bin/csh -$$
        exec -$$ $startup
        rm -f -$$
fi

Putting those lines in the Xsession ( bourne script ) gets it to read
also the .login because it exec's /bin/csh putting a name starting with '-'
into its argv[0] !!!! ( I didn't known that ! )

COMMENTS: these solutions work very well if you don't have any stty
command in your .login, otherwise you can get a "TCGETS" error and Xsession
exits without starting anything.

4) add this line to the Xsession provided by SUN:

eval `csh -c 'env' | sed -e 's/\([^=]*\)=\(.*\)/\1="\2"; export \1/'`

to cause the environment variables to be set from the user's .cshrc.
I didn't try this solution but it should work. Obviuosly the .login
settings are lost.

SOLUTION ADOPTED:

- moved all the initialization stuffs that are not specific to a terminal
  login from the .login to the .cshrc. (In the .login I leaved the tty settings)

- Modified the SUN Xsession as shown below:

#!/bin/sh
# @(#)Xsession

OPENWINHOME=${OPENWINHOME:-/usr/openwin}
LD_LIBRARY_PATH=$OPENWINHOME/lib:/usr/lib
PATH=$OPENWINHOME/bin:$PATH
MANPATH=$OPENWINHOME/share/man:/usr/man
export LD_LIBRARY_PATH PATH MANPATH

#
# Force server to change userid to $USER
#
$OPENWINHOME/bin/xhost +$USER@ > /dev/null 2>&1

case $# in
1)
        case $1 in
        failsafe)
                exec xterm -geometry 80x24+10+10 +ls
                ;;
        esac
esac

startup=$HOME/.xinitrc

if [ -f $startup ]; then
        exec /bin/sh $startup
else
        exec /bin/sh $OPENWINHOME/lib/Xinitrc
fi

Note that the .cshrc is read every time you run a cmdtool or a shelltool, so
the user's settings aren't lost.

Many thanks for their suggestions to the following people:

birger@vest.sdata.no (Birger A. Wathne)
rauls@usb.ve (LDC - Raul Silvera)
brian@arthur.melpar.esys.com (Brian Decker)
GLYNN PETER ROBINSON <GROBINSON@portia.umds.lon.ac.uk>
simon@lia.di.epfl.ch (Simon Leinen)
chris@invmms.worldbank.org (Chris Bulle)
Poul.Sorensen@nilu.no
tribble@mail.ast.cam.ac.uk (Peter C. Tribble)
Todd Pfaff <todd@flex.eng.mcmaster.ca>
sparc!shevett@erika.bighouse.unipress.com (Dave Shevett)
per@erix.ericsson.se (Per Hedeland)

===========================================================================
Massimo Mentrasti, Systems Administrator | e-mail: mentrasti@ssi.it
Space Software Italia | phone: +39 99 4701-430
Viale del Lavoro 101 | fax: +39 99 425044
I-74100 Taranto - Italy |
===========================================================================



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:07:39 CDT