Telling csh about multiple, machine-dependent libraries
Sun NCAA
matthew at sunpix.UUCP
Sat Nov 19 02:01:50 AEST 1988
In article <173 at heart-of-gold>, jc at heart-of-gold (John M Chambers) writes:
> Here's one that someone has gotta have solved already:
>
> We have NFS-mounted filesystems on a lot of different kinds of machines,
> and of course there is a problem with trying to execute binary files on
> the wrong machine. It's pretty easy to build the binaries, of course;
> I just set up a heirarchy:
> ~foo/src contains generic source.
> ~foo/sun2 contains a Makefile and binaries for a Sun2
> ~foo/sun3 contains a Makefile and binaries for a Sun3
> ~foo/vax contains a Makefile and binaries for a VAX
> ~foo/x286 contains a Makefile and binaries for a 80286/Xenix
> ~foo/x386 contains a Makefile and binaries for a 80386/Xenix
> and so on. Source files are linked from src as necessary.
>
> Now, when I log in, I'd like to include the right directory in my search
> path. My latest (failed) attempt in cshrc looks like:
>
> | set mtype = bin
> | if (`sun2`) set mtype = sun2
> | if (`sun3`) set mtype = sun3
> | if (`sun4`) set mtype = sun4
> | set path=(. ~/{$mtype,sh,csh,awk} /bin /usr/{ucb,etc,local,local/{$mtype,sh},bin,lib,dos,hosts,games,demo,NeWS/{bin,demo}} /etc)
>
Close, but not quite right. We have to do build for not just different
machines, but different OS also.
What you need to do is use the `arch` command to differenciet(sp?) between
the different machine types. IE:
set mtype = `arch`
is what you are looking for. We also use a shell script to determine the OS
level also. Here it is:
#! /bin/csh -f
# Prints "os3", "os4", or "os_unknown"
# Set rel_str to the string following "Release" in /vmunix
#/*note: following two line are actually one. broken here due to length > 80 */
set rel_str = `strings /vmunix | grep Release |
awk '{ for (i=0; i<NF; i++) if ($i == "Release"){ i++; print $i; exit; } }'`
if ($rel_str:r == 3 || $rel_str == Sys4-3.2) then
echo "os3"
else if ($rel_str:r == 4) then
echo "os4"
else
echo "os_unknown"
endif
This way we can create directories for 'sun3-os3', 'sun3-os4', 'sun4-os3',
and 'sun4-os4' with a simple:
set PATH = $PATH ~/`arch`-`os`
Hope this helps.
--
Matthew Lee Stier (919) 469-8300|
Sun Microsystems --- RTP, NC 27560| "Wisconsin Escapee"
uucp: {sun, rti}!sunpix!matthew |
More information about the Comp.unix.questions
mailing list