#!/bin/sh # (C) 2010 by the Board of Trustees of the Leland Stanford, Jr., University # All Rights Reserved # Produced by Andrew Hanushevsky for Stanford University under contract # DE-AC03-76-SFO0515 with the Deprtment of Energy # Establish things we will look for # AFSFS=/usr/afsws/bin/fs UNAME=/bin/uname UNAMF=/usr/bin/uname VERBOSE=0 ############################################################################## # s u b r o u t i n e s # ############################################################################## Debug () { if test $VERBOSE -eq 1; then /bin/echo $1 fi } FileThere () { Debug "Checking file $2 ..." if test -${1} $2; then return 0 fi return 1 } ############################################################################## # m a i n p r o g r a m # ############################################################################## # Get the uname characteristics # if FileThere x $UNAME; then OSNAME=`$UNAME` RLNAME=`$UNAME -r` MTNAME=`$UNAME -m` elif FileThere x $UNAMF; then OSNAME=`$UNAMF` RLNAME=`$UNAMF -r` MTNAME=`$UNAMF -m` fi # Compute the basic release number # RELNUM=`echo $RLNAME | /usr/bin/awk -F\. '{print $1$2}'` if [ x$DEST_SYSNAME != x ] ; then SYSNAME=$DEST_SYSNAME elif FileThere x $AFSFS; then # If the AFS fs command exists, then this becomes the system name SYSNAME=`$AFSFS sysname | /usr/bin/awk -F\' '{print $2}'` if [ $SYSNAME = i386_rhel40 ]; then if [ "x$MTNAME" = "xx86_64" ]; then SYSNAME=amd64_linux26 else SYSNAME=i386_linux26 fi fi elif [ $OSNAME = SunOS ]; then if [ $MTNAME = i86pc ]; then SYSNAME=sunx86 else case $RLNAME in 5.9) RFX=59 ;; 5.10) RFX=510 ;; 5.11) RFX=511 ;; esac SYSNAME=sun4x_$RFX fi elif [ $OSNAME = Linux ]; then case $RLNAME in 2.4*) RFX=24 ;; 2.6*) RFX=26 ;; 2.7*) RFX=27 ;; 3.1*) RFX=31 ;; esac PFX=i386 case $MTNAME in i*) PFX=i386 ;; x86_64) PFX=amd64 ;; esac SYSNAME=${PFX}_linux$RFX elif [ $OSNAME = FreeBSD ]; then case $RLNAME in 4.2*) RFX=42 ;; 4.3*) RFX=43 ;; 4.4*) RFX=44 ;; esac SYSNAME=FreeBSD$RFX elif [ $OSNAME = Darwin ]; then case $RLNAME in 8*) RFX=80 ;; 9*) RFX=90 ;; 10*) RFX=100 ;; esac case $MTNAME in ppc*) PFX=ppc ;; i386*) PFX=X86 ;; esac SYSNAME=${PFX}_darwin_$RFX elif [ $OSNAME = AIX ]; then case $RLNAME in 2) RFX=42 ;; 3) RFX=43 ;; 4) RFX=44 ;; esac SYSNAME=rs_aix$RFX else SYSNAME=misc fi if FileThere d ../obj/$SYSNAME; then : else /bin/mkdir -p ../obj/$SYSNAME fi if FileThere d ../bin/$SYSNAME; then : else /bin/mkdir -p ../bin/$SYSNAME fi if [ x$1 = x-r ]; then echo $RELNUM else echo $SYSNAME fi