#!/bin/sh
#
# |-----------------------------------------------------------|
# | Copyright (c) 1991, 1990 MIPS Computer Systems, Inc.      |
# | All Rights Reserved                                       |
# |-----------------------------------------------------------|
# |          Restricted Rights Legend                         |
# | Use, duplication, or disclosure by the Government is      |
# | subject to restrictions as set forth in                   |
# | subparagraph (c)(1)(ii) of the Rights in Technical        |
# | Data and Computer Software Clause of DFARS 252.227-7013.  |
# |         MIPS Computer Systems, Inc.                       |
# |         950 DeGuigne Avenue                               |
# |         Sunnyvale, California 94088-3650, USA             |
# |-----------------------------------------------------------|
#
# $Header: idfindsys,v 1.3.2.1 92/06/24 13:34:43 marker Exp $
# This is a shell script to be used to return system related
# information that might be needed by V.3 Install scripts that
# rebuild the kernel and/or install device drivers.
#
# SYNTAX:
#	idfindsys [ -b | -u | -s | -k ]
#
# where
#	-u	returns the proper unix.rxxxx_nnn file name
#	-s	returns the proper sysgen.rxxxx_nnn file name
#	-k	returns the proper kernel.rxxxx_nnn file name
#	-b	returns the bus type, either AT or VME
# only one option can be specified at a time.
#

#	MODIFICATION HISTORY
#	11/29/90	CChan	Initial Coding
#	12/09/90	TDhar	Add 6280 system
#	12/13/90	TDhar	Correct the machine type for m2000-8
#				and m2000-25

# Only one option is allowed
if [ $# = 0 -o $# -gt 1 ]
then
	echo "USAGE: idfindsys [ -b | -k | -s | -u ]"
	echo "one and only one option is expected"
	exit 1
fi

# Setup default values
flg=0

# Parse the command line
while getopts bksu option
do
	case "$option"
	in
		b) flg=1;;
		k) flg=2;;
		s) flg=3;;
		u) flg=4;;
		*) echo 'USAGE: idfindsys  [ -b | -k | -s | -u ]'
		   exit 1;;
	esac
done

# Do a uname -t to find the model number.
model=`uname -t`
case "$model"
in
	R*3*30) unix=unix.r3030_std
			sysgen=sysgen.r3030_std
			kernel=kernel.r3030_std
			bus=AT;;
	RC3240) unix=unix.r2400_std
			sysgen=sysgen.r2400_std
			kernel=kernel.r2400_std
			bus=AT;;
	m2000-6|m2000-8) unix=unix.r3200_ijc
			sysgen=sysgen.r3200_ijc
			kernel=kernel.r3200_ijc
			bus=VME;;
	m2000-*) unix=unix.rb3125_std
			sysgen=sysgen.rb3125_std
			kernel=kernel.rb3125_std
			bus=VME;;
	RC62*)  unix=unix.r6000_std
			sysgen=sysgen.r6000_std
			kernel=kernel.r6000_std
			bus=VME;;
	*) echo "idfindsys fatal error"
		exit 1;;
esac

# Return the desired information
case "$flg"
in
	1) echo $bus;;
	2) echo $kernel;;
	3) echo $sysgen;;
	4) echo $unix;;
	*) echo "idfindsys fatal error"
           echo 'USAGE: idfindsys  [ -b | -k | -s | -u ]'
	   exit 1;;
esac
exit

