Here's my summary in regard to having a simple standard .login for users
that is smart enough to detect the current frame buffer (graphics card).
I got 19 replies, many of which were quite useful.
First, a brief Recap of the problem.
Second, The Solution I settled on.
Third, Summarize general suggestions.
Finally, Credits and thanks.
As I said in the original query, I supply a standard .cshrc and .login
file for my users. I have to make sure these standard starup files are
sufficient for everyone if I want to inforce the policy that users have
to use the files I give them. The policy goes on to say that people can
write their own if they want, but if they do... they have to support the
scripts, not me. Most people happily opt to use my files. One user
complained that my .login wasn't smart enough to start openwin correctly
depending on whether he logged into a 24-bit graphics workstation or a
regular 8-bit graphics workstation. I had to find a simple enhancement
to make my standard .login smart enough to do this. I keep the latest
version of the Data Services Supported .cshrc and .login in a known
location where users can get a copy at will.
Roger Salisbury had what I thought was the most elegant solution. Here is
a short script, which uses his general suggestion, and which you can run to
test out the solution. Pieces of this script, as specified in the in-line
document lines, are added to the .login file. If you want to try it,
cut-n-paste the script (all 11 lines), as is, into a new file, in your home
directory. Then, login to different machines (preferably with different
frame buffers) and source it to see how it says it will start up openwindows.
---- start script ---- cut here ---
#Test for starting openwindows based on local frame buffer
setenv $OPENWINHOME "$OPENWINHOME"
#---This If-Then-Else clause dropped in above $mychoice switch ---
if ( -e /dev/fbs/cgtwelve0 || -e /dev/fbs/cgfourteen0 || -e /dev/fbs/tcx0 ) then
setenv OPENWIN "openwin -noauth -dev /dev/fb defdepth 24"
setenv OPENWIN "openwin -noauth"
#--- This line (without echo, of course) replaces old openwin startup line ---
---- end script ---- cut here ---
As you can see, it simply looks to see if certain 24-bit devices are present.
If not then it defaults 8-bit. Two caveats. One, as new tech frame buffers
find there way on-site I'll have to add (modestly) to the "if" clause. Two,
this test only works on Solaris boxes, not SunOS machines. SunOS doesn't put
it's graphic devices in /dev/fbs, but instead in /dev, and unfortunately I
find all possible frame buffer devices there, regardless of the actual
hardware. Potentially, SunOS admins can extract the needed information with
something like "devinfo | grep cg" or "dmesg |grep cg" but it's a lot messier
and problematic, and since I'm mostly converted to Solaris and the only 24bit
machines are already converted to Solaris, the point is mute, the code works
perfectly for me, as-is. This solution requires a very minimal modification
to Sun's standard .login file and no other modifications anywhere else.
Summary of Suggestions:
A number of people suggested I use "uname" to get the OS. This kind missed
the point since I was less concerned with the OS and more concerned with
the presence of a 24-bit frame buffer. I only wanted to know the OS if
the query command was OS specific. Some people said to hardcode the
option by machinename, ei "if (`hostname` == "hal" ) then 24bit", etc...
that sort of thing, but that's just way too hard to maintain. Some
people said "Write a script". Thanks for the advice! ;-) Some people
suggested I put a special file in a standard local partition on every
machine, and either read the file or test for the presence of the file
to determine the frame buffer type of that machine. This would work and
is a clever idea but this would require quite a bit a maintenance when you
think about it. I would have to remember to add this file to every new
machine I bring on line. I have enough details to remember everytime I
bring up a new machine. Testing for the presence of the device is a similar
idea but I don't have to remember to do anything. Solaris puts the device
(file) there automatically. One person supplied a C program which works on
SunOS that simply tries to open various graphics devices. When it finds
the one that opens it reports back the correct frame buffer. This is clever
and can be easily written and adapted to run on Solaris, but... you have
to remember to make this program accessable to all machines, old and new,
which can become a maintenance issue again. One suggestion was to modify
the openwin script itself. I definately don't want to be changing the
openwin script on all of my machine because then Sun won't want to support
me and my script just like I don't want to support my users and their
scripts. Pretty much suggestions fell under one of the above forms, with
the exception of those which were unintelligable altogether, and a few who
said "Hey! I wish I could set a policy like that! I hafta debug everyone
else's crappy code!" You have my sympathies. Elegant standardization is
a huge time saver!
Thanks to all of the following Sun Managers, even if I didn't use your
suggestions or they seemed like jibberish. I really appreciate the
thought and effort.
--- firstname.lastname@example.org (Gregory M Polanski) email@example.com (Mike Garcia) Kevin Inscoe (CRC-LSG x2082) <firstname.lastname@example.org> email@example.com (Dave McFerren) firstname.lastname@example.org (Dave England) email@example.com (William T. Reckas) Thomas Bruckbauer <Thomas.Bruckbauer@pet.mpin-koeln.mpg.de> firstname.lastname@example.org (Michael Sullivan) Geoff Mellor <email@example.com> Anders Hammarquist <firstname.lastname@example.org> email@example.com (Martin Achilli) firstname.lastname@example.org (Jack Reiner) Richard Pieri <email@example.com> Todd Pfaff <firstname.lastname@example.org> Robert Hill <email@example.com> firstname.lastname@example.org (Robert J. Cronin) email@example.com (Perry Hutchison) Mark S. Anderson" <firstname.lastname@example.org> Roger Salisbury <email@example.com> Kudos to Roger. I basically used his solution. His reply was brief and concise: if ( -e /dev/fbs/cg[whatever flavor]) openwin -dev /dev/fbs/cg[whatever] else ...........
Many thanks. Regards, -drp
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | _/ _/ _/_/_/_/ _/_/_/ _/_/_/_/ | Dan Penrod - Unix Administrator | | _/ _/ _/ _/ _/ | USGS Center for Coastal Geology | | _/ _/ _/_/_/_/ _/ _/_/ _/_/_/_/ | St. Petersburg, FL 33701 | | _/ _/ _/ _/ _/ _/ | (813)893-3100 ext.3043 | |_/_/_/_/ _/_/_/_/ _/_/_/_/ _/_/_/_/ | firstname.lastname@example.org | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:10:51 CDT