My original message asked if anyone had a good way to set up
different user environments, since the shell scripts which I had written to
start various bits of software in a friendly manner did not pass back
environmental variable settings to the calling shell.
Up until now, all users of a particular software package had to
include the relevent paths and environment settings in their personal .cshrc
files. If any changes are needed, all users have to make the changes.
From the vast number of replies I recieved, I have devised the
following method of having central setup scripts, which can be easily
changed if, for instance, a software package is moved to a new location.
1) Each user is given a standard .cshrc file
This is the difficult bit if users are already on the system.
Copying their old .cshrc to a backup version before-hand and telling
them about the new system should suffice though.
The standard .cshrc will look something like this:
#################################################################
# #
# Default .cshrc file - Dave, March 1991 #
# #
#################################################################
#-----------------------------------------
# Setup default and custom environment(s)
#-----------------------------------------
setenv ADD_SOFTWARE "napier generis" # Add packages here
source /usr/local/csh/setup # DO NOT ALTER OR ELSE!
2) This standard file sources a setup script which I have written.
This script must be stored in a globally accessable dir. We have
symbolic links on each fileserver to link /usr/local to its actual
mount point.
This setup script is shown below:
#!/bin/csh
###########################################################################
# #
# Shell script to source default system resource file for all users, #
# examine supplied package names, and execute appropriate setup files. #
# This program should be 'sourced' from users .cshrc files #
# #
# Dave - 8/3/91 #
# #
###########################################################################
source /usr/local/lib/setup/system
foreach package ($ADD_SOFTWARE)
if -e /usr/local/lib/setup/$package then
source /usr/local/lib/setup/$package
else
echo "setup: /usr/local/lib/setup/"$package "file not found\!"
endif
end
unset package
This script basicaly sources a standard system wide .cshrc file,
which sets up things that we feel everyone should have; such as
alias rm rm -i.
It then examines the ADD_SOFTWARE environmental variable which was
set up in the standard .cshrc file which was given to each user in
1) above. For each package listed in this variable, it sources a
shell script of the same name.
3) If a user objects to any of the default settings which the setup
program sources, they can always override them by placing their own
entries at the end of the standard .cshrc eg:
unalias rm
or
set my_path = (~/bin ~/project)
set path = ($my_path $path)
In summary the sequence of actions is:
user types passwd
my provided .cshrc is executed for users login shell
/usr/local/csh/setup is sourced
source call to /usr/local/lib/setup/system
source call(s) to any scripts listed in ADD_SOFTWARE
user sets own variables at end of .cshrc
shell starts
The only real problem I can see with this system is that if the
fileserver on which we have mounted /usr/local (via the links) goes
down, then the setup information will not be available to anyone who
logs in. However, since all our software is on the same fileserver,
there won't be much that users can run anyway!
Hope this helps some of the people who has similar problems.
David Pentland - Napier Polytechnic, Edinburgh.
This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:06:12 CDT