#!/bin/sh ########################################################################### # # TOOL: sasmanager # # COMPONENT: arch_name # # VERSION: 02.00 # # LANGUAGE: /bin/sh (Bourne shell) # # SYSTEM: UNIX # # CREATION DATE: 29OCT93 # # CALLED BY: # quickinstall # sasmanager # setup_source # setup_dest # # CALLED: # check_remote # fmenu # # USAGE: arch_name [-host HOST] [-user USER] # # where: # -host HOST is the name of the remote host to check # -user USER is the login name to use on the remote host # # note: if -host and -user are not specified, arch_name # will return the architecture of the local host. # # DESCRIPTION: # # This script returns the architecture type of either a remote host # (if -host and -user are specified) or of the local host. If it # cannot determine the architecture type automatically, it will ask # the user to enter the type. # # logs are saved in .install/logs and .install/screens # # Environment variables: # level the level within the sasmanager system # screenfile the pathname of the screen logfile # logfile the pathname of the error message logfile # # # RETURNS: # # architecture name DGUX SUN4 SOL2 HPUX MABI # IABI AOSF AIXR CNVX # status environment variable set to: # 0 -- Successful completion # otherwise -- An error has occurred. Check log and screen for # further messages. # # REVISION HISTORY: # # ########################################################################### # # # ############################################################################# # A R C H _ N A M E -- return the architecture name for SAS installation # ############################################################################# ############################################################################# # # Initialize local variables to null # ############################################################################# host_name="" user_name="" local_or_remote="local" OS=UNKNOWN release=UNKNOWN hardware=UNKNOWN level="$level ";export level echo "${level}arch_name: entry" >>$logfile ############################################################################# # # Process Command Line Args # ############################################################################# while [ $# -ne 0 ] do opt=$1 case $opt in "-host" ) shift if [ $# -eq 0 ] ; then echo "Error: No arg specified with '$opt'" | tee -a $screenfile echo "${level}Error: No arg specified with '$opt'" >>$logfile echo "${level}arch_name: exit" >>$logfile exit 1 fi if [ "$1" != "\0" ] ; then host_name=$1 fi local_or_remote="remote" ;; "-user") shift if [ $# -eq 0 ] ; then echo "Error: No arg specified with '$opt'" | tee -a $screenfile echo "${level}Error: No arg specified with '$opt'" >>$logfile echo "${level}arch_name: exit" >>$logfile exit 1 fi if [ "$1" != "\0" ] ; then user_name=$1 fi ;; "-help" ) cat <<_MSG_END | tee -a $screenfile arch_name -host hostname -user username -help _MSG_END echo "${level}Warning: -help specified" >>$logfile echo "${level}arch_name: exit" >>$logfile exit 1 ;; esac shift done ############################################################################# # # Now start the real work of getting the name of the operating system. # Since this command must not fail, then alot of work is done to insure # that all possible errors from the user are trapped by the shell program. # This increases the complexity of the logic and the code size. # ############################################################################# ########################################################################## # See if uname is there # Now get the values from the remote host, via 'uname' # rc=1 if [ "$local_or_remote" = "remote" ] ; then host_parms="$host_name -n -l $user_name" remsh_cmd=`check_remote -host $host_name -user $user_name` rc=`$remsh_cmd $host_parms "/bin/sh -c \"\ if [ -f /bin/uname ] ; then echo 0 ; else echo 1 ; fi \""` if [ "$rc" -eq "0" ] ; then set `$remsh_cmd $host_parms "/bin/uname -s -r -m"` OS=$1 release=$2 hardware=$3 else rc=`$remsh_cmd $host_parms "/bin/sh -c \"\ if [ -f /usr/convex/arch ] ; then echo 0 ; else echo 1 ; fi \""` if [ "$rc" -eq "0" ] ; then OS="ConvexOS" fi fi ############################################################################# # Otherwise, get the local values, via 'uname' # elif [ -f "/bin/uname" ] ; then set `/bin/uname -s -r -m` OS=$1 release=$2 hardware=$3 else if [ -f /usr/convex/arch ] ;then OS="ConvexOS" fi fi ############################################################################# # Assign values to symbols based upon uname values. # Some hosts may need to make further calls to uname for more information, # and some hosts may not have a uname command. A table of uname values # for all host was used to construct the logic of these cases. # case $OS in "UNKNOWN" ) archname="UNKNOWN" ;; "HP-UX"|"HI-UX" ) archname="HPUX" ;; "SunOS" ) if [ `echo "$release" | awk '{print substr($1,1,1)}'` -eq "4" ]; then archname="SUN4" else if [ $hardware = "i86pc" ] ; then archname="IABI" else archname="SOL2" fi fi ;; "AIX" ) archname="AIXR" ;; "ConvexOS" ) archname="CNVX" ;; "dgux" ) archname="DGUX" ;; * ) case $hardware in "mips" ) archname="MABI" ;; "i386" ) archname="IABI" ;; "i486" ) archname="IABI" ;; "i586" ) archname="IABI" ;; "PENTIUM" ) archname="IABI" ;; "alpha" ) archname="AOSF" ;; * ) if [ $host_name ] ; then processor=`$remsh_cmd $host_parms "/bin/uname -p"` else processor=`/bin/uname -p` fi case "$processor" in "386/486/MC" ) archname="IABI" ;; "Pentium Pro(TM)-EISA/PCI" ) archname="IABI" ;; "r3000" ) archname="MABI" ;; "r4000" ) archname="MABI" ;; "R4000" ) archname="MABI" ;; "r4400" ) archname="MABI" ;; "mips" ) archname="MABI" ;; "sparc" ) archname="SOL2" ;; * ) archname="UNKNOWN" ;; esac ;; esac ;; esac echo $archname echo "${level}arch_name: exit" >>$logfile