home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / c / cops_104.zip / cops_104 / platform < prev    next >
Text File  |  1992-03-10  |  2KB  |  100 lines

  1. #!/bin/sh
  2. #
  3. # platx
  4. #   Attemps, in vain, to determine the platform -- great if we could get
  5. # hardware and software (OS) base.  First shot at this -- wanted to do this
  6. # for a while, then re-stolen from Todd Merriman's "platform".
  7. #
  8. # *might* work on Xenix/386, CTIX, 386/ix, DG/UX, SunOS, DYNIX, eta10's,
  9. # ibm risc boxes, pyramids, decstations, etc.  Uses the arch, file, and
  10. # uname commands to try to figure things out.  Vaxen and such will
  11. # definitely not work.
  12. #
  13.  
  14. if test -s "/bin/arch" ; then
  15.     # this gives strange results on some machines...
  16.     # /bin/arch -k
  17.     /bin/arch
  18.     exit 0
  19.     fi
  20.  
  21. if test -s "/bin/uname" ; then
  22.     type=`uname -m`
  23.         # Convergent S640
  24.     if test "$type" = "miti2" ; then
  25.     echo "CTIX"; exit 0
  26.     fi
  27.         # Sequent Interactive 386/ix and DYNIX
  28.     if test "$type" = "i386" ; then
  29.         if test "`uname -v`" = "DYNIX" ; then 
  30.         echo "DYNIX"
  31.         exit 0
  32.         else 
  33.         echo "386_ix"
  34.         exit 0
  35.         fi
  36.     fi
  37.         # DG/UX 88000
  38.     if test "$type" = "AViiON" ; then 
  39.     echo "DG_UX"; exit 0;
  40.     fi
  41.         # IBM's RISC/AIX
  42.     if test "$type" = "AIX" ; then 
  43.          echo "aix"; exit 0;
  44.     fi
  45.         # SCO Xenix
  46.     if test "$type" = "3" ; then 
  47.        echo "Xenix_386"; exit 0;
  48.     fi
  49. #     else    { print "$type???\n"; exit 0;}
  50.     fi
  51.  
  52. # locations of "file" executable?
  53. dirs="/bin /usr/bin"
  54. typical_executable="/bin/ls"
  55. for dir in $dirs ; do
  56.      if test -r "$dir/file" ; then
  57.          output=`$dir/file $typical_executable`
  58.       type=`echo $output | awk '{print $2}'`
  59.          if test "$type" = "mipsel" ; then
  60.          echo "DECstation"; exit 0
  61.          fi
  62.          if test "$type" = "90x" ; then 
  63.          echo "dec"; exit 0
  64.          fi
  65.          if test "$type" = "SYMMETRY" ; then 
  66.          echo "Sequent_Symmetry" ; exit 0
  67.          fi
  68.      fi
  69.      done
  70.  
  71. # also stolen from the net...
  72. #
  73. # rt_bsd:    4.3 BSD on RT
  74. # aix_22:    AIX 2.* on RT
  75. # aix_11: AIX 1.1 or AIX 1.2 on PS/2
  76. # aix_31: AIX 3.1 on RISC 6000
  77.  
  78. if test -f "/unix" ; then
  79.      if test -d "/vrm" ; then
  80.          # echo "aix_22"
  81.          echo "aix"
  82.         exit 1;
  83.      else
  84.          if test -d "/etc/security" ; then
  85.              # echo "aix_31" ; exit 1;
  86.              echo "aix" ; exit 1;
  87.          else
  88.              # echo "aix_11" ; exit 1;
  89.              echo "aix" ; exit 1;
  90.              fi
  91.          fi
  92.     fi
  93.  
  94. # apollo stuff; thanks to the apollo mailing list!
  95. if test -d /sys/node_data ; then
  96.     echo "apollo" ; exit 1
  97.     fi
  98.  
  99. exit 1;
  100.