[comp.windows.x] xdm problem w/.profile&.login

dsr@mir.mitre.org (Douglas S. Rand) (01/04/91)

How can one get xdm to read the appropriate .login or .profile file for a 
user it is starting up?  Kind of a pain since you really don't want to
set PATH over and over again in the .cshrc file.

Is there something I'm missing here?

Also,  if one wants to run xdm by default, where is the best place to 
start it up?  (rc.local?  ttytab?)

-- 
Douglas S. Rand 
Internet:   <dsrand@mitre.org>
Snail:	    MITRE, Burlington Road, Bedford, MA 
Disclaimer: MITRE might agree with me - then again...
Amateur Radio: KC1KJ

brian@ima.isc.com (Brian Holt Hawthorne) (01/10/91)

In article <127530@linus.mitre.org>, dsr@mir.mitre.org (Douglas S. Rand) writes:
> How can one get xdm to read the appropriate .login or .profile file for a 
> user it is starting up?  Kind of a pain since you really don't want to
> set PATH over and over again in the .cshrc file.

Change your .xsession file to begin with 
#!/bin/csh
and then have the first line be source .login.

My .xsession looks like this (for ksh):

#!/bin/ksh
. $HOME/.kshrc

xset b 100 400 150 m 3 

etc...

gdmr@lfcs.edinburgh.ac.UK (George Ross) (01/10/91)

In article <127530@linus.mitre.org> Douglas S. Rand writes:
> How can one get xdm to read the appropriate .login or .profile file for a 
> user it is starting up?  Kind of a pain since you really don't want to
> set PATH over and over again in the .cshrc file.
> 

Sourcing the user's login file is fine if everyone uses the same shell.  It doesn't
work very well when there are several different shells in use (we have tcsh and
bash, to name but two).

The solution I adopted was to exec the user's favourite shell as a login shell
before running the Xsession script.  That way everything gets set up as though
the user had logged on via login rather than xdm.  The sequence goes like this:

	1) xdm execs a shell-chooser program as its "session script"
	2) The shell-chooser execs the user's favourite shell as a login 
	    shell, passing it a script which asks it to exec the "real" Xsession.
	3) The "real" Xsession does all the usual things: loading resources,
	    starting clients and the user's favourite window manager.

In fact, the "real" Xsession script is nothing more than a wrapper which sets up
one or two variables, then execs a common session script (which is also run by
people starting X interactively, so we always see the same environment however
we get into X).  A touch convoluted, but it seems to have the right effect.  If
anyone wants to see the nitty gritty, drop me a line and I'll shar up a copy.

Incidentally, stage 2 relies on the sh- and csh-syntax for the exec command being
the same.  It wouldn't work for any really wierd shell.
-- 
George D M Ross, Department of Computer Science, University of Edinburgh
031-650 5147 or 031-667 1081    gdmr@uk.ac.ed.cs (or cs.ed.ac.uk if you prefer)

evans@decvax.DEC.COM (Marc Evans) (01/12/91)

In article <127530@linus.mitre.org>, dsr@mir.mitre.org (Douglas S. Rand) writes:
|> How can one get xdm to read the appropriate .login or .profile file for a 
|> user it is starting up?  Kind of a pain since you really don't want to
|> set PATH over and over again in the .cshrc file.

Usually, this is left up the the individual to place in their ~/.xsession. The
reason is because different people use different shells, and handling this in
a central location is actually more work than to have each user add something
like 'source ~/.login' on the second line of their ~/.xsession (#!/bin/{shell}
is usually the first line).

|> Also,  if one wants to run xdm by default, where is the best place to 
|> start it up?  (rc.local?  ttytab?)

This depends on the type of OS you are dealing with. For example, under OSF/1
you would make an entry in /etc/inittab, whereas under Ultrix, the easiest way
to do this is in /etc/ttys, while other systems use /etc/rc.local. In any event,
do whatever seems the most natural for your OS.

- Marc
-- 
===========================================================================
Marc Evans - WB1GRH - evans@decvax.DEC.COM  | Synergytics     (603)635-8876
      Unix and X Software Contractor        | 21 Hinds Ln, Pelham, NH 03076
===========================================================================