[comp.unix.ultrix] Determining machine architecture and ULTRIX version

davidk@pvi.UUCP (David Kirkpatrick) (10/24/89)

Are there any reliable methods for determining the architecture of a 
machine running ULTRIX from a bourne shell script?  I am looking for
something similar to SUN's "arch" command, which returns a string 
containing "sun3", "sun4", etc.. depending on the machine.  

In a similar vein, I would also like to determine the version of ULTRIX 
that is running, and the version of DECWindows (or UWS) programmatically,
(bourne shell script).  

I have tried things like the following:

   strings /vmunix |grep Ultrix        which yields the following line:
 
    Ultrix Worksystem V2.0 (Rev. 7) System #1: Tue Mar 21 20:01:54 MST 1989

Unfortunately, this only tells me the version of Workstation software 
(DECwindows), and not the version of ULTRIX.

Any help on either or both of the questions would be greatly appreciated.  
Please send replies to:

David Kirkpatrick

...{ncar, boulder}!pvi!davidk        
(303) 530-9000  x-435

avolio@decuac.dec.com (Frederick M. Avolio) (10/24/89)

You can use the command "machine".

Returns "mips" or "vax".

Fred

karish@forel.stanford.edu (Chuck Karish) (10/24/89)

In article <253@pvi.UUCP> davidk@.com() wrote:
>Are there any reliable methods for determining the architecture of a 
>machine running ULTRIX from a bourne shell script?

>In a similar vein, I would also like to determine the version of ULTRIX 
>that is running, and the version of DECWindows (or UWS) programmatically,
>(bourne shell script).  

The uname() system call returns a structure that contains information
that will be useful to you.  Write a little C program that calls
uname() and prints out the data, or wait until DEC ships the POSIX
1003.2 uname utility.  Uname comes from System V, so a shell script
that calls it is already portable to much of the UNIX world.  

	Chuck Karish		karish@mindcraft.com
	(415) 493-9000		karish@forel.stanford.edu

jg@max.crl.dec.com (Jim Gettys) (10/24/89)

/bin/machine will do what you want; it returns either "vax" or "mips".

Note that VAX Ultrix 3.0 lacks the command; 3.1 added it.

As to what Ultrix version is running, that is a different question.

		- Jim Gettys

collins@grumpy.cs.unm.edu (Bill Collins) (10/25/89)

In article <2785@decuac.DEC.COM> avolio@decuac.dec.com writes:
>You can use the command "machine".
>
>Returns "mips" or "vax".
>

Ok, I run machine on a DECstation and get:
mips
This is, I guess, another way of saying decstaion.

Now, on a vax it gives:
machine:  Command not found.
Ok, I get it, "Command not found." is another way of saying VAX. :-)

Oh, thats ok, the sun has them in command form.
% sun
returns true.
% vax
returns false.
% mips
returns:
mips: Command not found.

Gee, I wish it were somewhat standard.  I end up using the /usr/lib/cpp and
feeding it a list of defines(vax, mips, sun, ibm, etc) to do this.  And with
a little tweaking, you can get it to return some sort of message like:

% whatami
Says mips, Its little endian, Probably a DECstation.
%
				
				Bill
				collins@turing.cs.unm.edu
			collins@unmvax.unm.edu
			gatech!unmvax!collins

-------------------
Have you been bussed today?

alan@shodha.dec.com ( Alan's Home for Wayward Notes File.) (10/25/89)

In article <435@unmvax.unm.edu>, collins@grumpy.cs.unm.edu (Bill Collins) writes:
> In article <2785@decuac.DEC.COM> avolio@decuac.dec.com writes:
> >You can use the command "machine".
> >
> >Returns "mips" or "vax".
> >
> 
> Ok, I run machine on a DECstation and get:
> mips
> This is, I guess, another way of saying decstaion.
> 
> Now, on a vax it gives:
> machine:  Command not found.

	/bin/machine for the VAX isn't there in V3.0 or V3.1.  If
	you want to create one use:

	#!/bin/sh
	echo vax
	exit 0

	It's safest to use something like (for csh):

	set machine = "vax"
	if ( -x /bin/machine ) then
		set machine = `/bin/machine`
	endif

> 				Bill
> 				collins@turing.cs.unm.edu
-- 
Alan Rollow				alan@nabeth.enet.dec.com

ram@psalm8.ZK3.DEC.COM (Ram Rao) (10/25/89)

> In a similar vein, I would also like to determine the version of ULTRIX 
> that is running, and the version of DECWindows (or UWS) programmatically,
> (bourne shell script).  
> 
> I have tried things like the following:
> 
>    strings /vmunix |grep Ultrix        which yields the following line:
>  
>     Ultrix Worksystem V2.0 (Rev. 7) System #1: Tue Mar 21 20:01:54 MST 1989
> 
> Unfortunately, this only tells me the version of Workstation software 
> (DECwindows), and not the version of ULTRIX.

You bring up a valid concern.  It is not easy for an ULTRIX customer
today to figure out what version of the basesystem is running on a
workstation.  This concern will likely be addressed in an upcoming
release.  In the interim, here is how I map UWS (ULTRIX workstation
software) versions to ULTRIX base-system versions:

	UWS Version	Inferred ULTRIX version
	~~~~~~~~~~~	~~~~~~~~~~~~~~~~~~~~~~~
	    1.1			2.2
	    1.2			2.3
	    2.0			3.0
	    2.1			3.1

While I believe the above to be accurate, any errors are mine and
not my employer's.  (standard disclaimer)

Ram Rao
ULTRIX Engineering
Digital Equipment Corporation

collins@grumpy.cs.unm.edu (Bill Collins) (10/26/89)

In article <1054@crltrx.crl.dec.com> jg@max.crl.dec.com (Jim Gettys) writes:
>Note that VAX Ultrix 3.0 lacks the command; 3.1 added it.
Hmm, can't seem to find it.  We run Ultrix 3.[10] and UWS 2.[01].  Perhaps
it is in a subset which I have not loaded or in one of those unsupported
subsets?

			Bill
			collins@unmvax.unm.edu
			gatech!unmvax!collins

-------------------
Have you been bussed today?

alan@shodha.dec.com ( Alan's Home for Wayward Notes File.) (10/26/89)

In article <439@unmvax.unm.edu>, collins@grumpy.cs.unm.edu (Bill Collins) writes:
> In article <1054@crltrx.crl.dec.com> jg@max.crl.dec.com (Jim Gettys) writes:
> >Note that VAX Ultrix 3.0 lacks the command; 3.1 added it.

	I think it was intended it be in V3.1, but didn't
	make it for some reason.

> Hmm, can't seem to find it.  We run Ultrix 3.[10] and UWS 2.[01].  Perhaps
> it is in a subset which I have not loaded or in one of those unsupported
> subsets?

	Nope.  It isn't there.  Unless Jim has a different version
	of V3.1 than the rest of us.
> 
> 			Bill
> 			gatech!unmvax!collins
> 

-- 
Alan Rollow				alan@nabeth.enet.dec.com

jg@max.crl.dec.com (Jim Gettys) (10/28/89)

Well, /bin/machine exists on our Vaxen, which are running 3.1.  Of course,
I have no (easy) way to know if it it would be on a standard distribution.
Its date is May 17, where as other things in /bin are May 2.  If it
isn't on the kit, then
my apologies.