bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: uname -p output on Itanium machine


From: Bob Proulx
Subject: Re: uname -p output on Itanium machine
Date: Wed, 19 May 2004 19:10:05 -0600
User-agent: Mutt/1.3.28i

Dianne Womelduff wrote:
> Hi Bob -
> 
> Thanks so much for the info.
> We are using it as a way to determine CAD software installations.
> Some vendors don't allow mutiple platform support in the same
> hierarchy.  We are trying to be consistant so our tool wrapper can
> find the right binaries depending on where the application is
> run. We decided to go with uname -rsp, since the uname man page on
> Solaris said not to use uname -m.
> Of course when I ran uname -p on a couple different Solaris and
> Linux boxed, it worked fine. Now we have some Itanium boxes and it
> doesn't return what we expected.
> 
> It seems that uname -m is really what we should use - and it's documented.
>
> Thanks again for the info.
> 
> Dianne

Because I am a pedantic sort of person I like to avoid uname with
options until I know the system supports that option.  The only output
that I can truly count on is 'uname' without args to get the system
name.  Then after getting the system name I can then count on certain
features being there on that system.  So after I know it is HP-UX or
Linux or whatever I can then use a different set of commands in each
case as appropriate.

At the bottom of this message is a small script that I wrote and am
using for the same purpose as you.  This is not a golden script by any
means.  Everyone will want something different.  You will undoubtedly
want things to be different than I.  But it works for me.  And perhaps
seeing how others do this might be helpful in some way.  I link this
to the program name that I want to run over NFS on a variety of
platforms.  The script selects the binary for that architecture and
runs it from a architecture specific subdirectory.

I don't have to support all architectures.  I only need this to work
for the small set of architectures that are in my lab.  In this case
only HP-UX and GNU/Linux on x86 and ia64.  On HP-UX I have to split
things between 10.20 binaries and 11.x binaries so I include the OS
version there.  But I avoid the extra part when I don't need it.  And
others would want a dash in there or an extra directory or other
things.  Feel free.

I wanted to say that I have seen people use config.guess in these
types of scripts but please don't.  On some systems config.guess can
tell what it needs just fine in an efficient way.  But on other
systems it compiles C programs on the fly and looks at data from the
compilation.  Compiling a program each and every time you execute a
command is a lot of overhead!

If the application has its own environment setting script to set up
the PATH for the architecture and such then I create a different
wrapper script for it.  That type of wrapper sources the application's
environment setting script and then passes control to the application.
Here is a rough pseudo code script representative of this.  Name it
the same as the real executable and locate it on PATH.

  #!/bin/sh
  PATH=$APP_ROOT/bin:$PATH
  . env.sh
  exec ${0##*/} "$@"

The above is nice because it keeps the user's environment mostly clean
of the env trash that the app wants.  A lot of CAD tools like to
really pollute the system with many environment variables.  Also any
changes made to the files on disk have immediate affect upon the next
execution of the command.

There are a lot of variations on the theme.  I hope this has been
useful.

Bob

#!/bin/sh

if [ -n "$PLATFORM_MACH_TYPE_OVERRIDE" ]; then
  mach=$PLATFORM_MACH_TYPE_OVERRIDE
  if [ -n "$PLATFORM_OSVER_TYPE_OVERRIDE" ]; then
    osver=$PLATFORM_OSVER_TYPE_OVERRIDE
  fi
else
  case "$(uname)" in
    Linux)
    case "$(uname -m)" in
      i?86) mach=i686 ;;
      ia64) mach=ia64 ;;
      *) mach=unsupported ;;
    esac
    ;;
    HP-UX)
    case "$(getconf CPU_VERSION)" in
      528) mach=hppa1.1 ;;
      532) mach=hppa2.0 ;;
      *) mach=unsupported ;;
    esac
    case "$(uname -r)" in
      ?.11.*) osver=hpux11.0 ;;
      ?.10.20) osver=hpux10.20 ;;
      *) osver=unsupported ;;
    esac
    ;;
  esac
fi

prog=${0##*/}
dir=${0%/*}

if [ ! -x $dir/$mach${osver+"$osver"}/$prog ];then
  echo "$prog: No executables for system." 1>&2
  echo "Looking for $dir/$mach${osver+"$osver"}/$prog" 1>&2
  exit 1
fi

exec $dir/$mach/${osver+"$osver"}/$prog ${1+"$@"}




reply via email to

[Prev in Thread] Current Thread [Next in Thread]