home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume21 / amd / part02 / os-type < prev    next >
Encoding:
Text File  |  1990-04-10  |  2.7 KB  |  94 lines

  1. #!/bin/sh
  2. #
  3. # $Id: os-type,v 5.1.1.2 90/01/11 17:16:09 jsp Exp Locker: jsp $
  4. #
  5. # Copyright (c) 1989 Jan-Simon Pendry
  6. # Copyright (c) 1989 Imperial College of Science, Technology & Medicine
  7. # Copyright (c) 1989 The Regents of the University of California.
  8. # All rights reserved.
  9. #
  10. # This code is derived from software contributed to Berkeley by
  11. # Jan-Simon Pendry at Imperial College, London.
  12. #
  13. # Redistribution and use in source and binary forms are permitted
  14. # provided that the above copyright notice and this paragraph are
  15. # duplicated in all such forms and that any documentation,
  16. # advertising materials, and other materials related to such
  17. # distribution and use acknowledge that the software was developed
  18. # by Imperial College of Science, Technology and Medicine, London, UK.
  19. # The names of the College and University may not be used to endorse
  20. # or promote products derived from this software without specific
  21. # prior written permission.
  22. # THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  23. # IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  24. # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  25. #
  26. #    %W% (Berkeley) %G%
  27. #
  28.  
  29. #
  30. # Take a pot-shot at your os type
  31. #
  32. echo "    ... No OS= option specified; dynamically determining OS type" >&2
  33.  
  34. #
  35. # First try poking around in /etc/motd
  36. #
  37.  
  38. case "`exec 2>/dev/null; head -2 /etc/motd`" in
  39. *"Sun UNIX 4.2 Release 3."*)    OS=sos3;;
  40. *"SunOS Release 4."*)        OS=sos4;;
  41. *"HP-UX on the HP"*)        OS=hpux;;
  42. *"Ultrix V2."*)            OS=u2_2;;
  43. *"Ultrix-32 V3."*)        OS=u3_0;;
  44. *"Ultrix Worksystem V2.0"*)    OS=u3_0;;
  45. *"HLH OTS Version 1."*)        OS=hlh42;;
  46. *"RISC iX release 1."*)        OS=riscix;;
  47. *"4.4 BSD UNIX"*)        OS=bsd44;;
  48. *"4.3 BSD UNIX"*)        if [ -f /etc/minidisk ]; then
  49.                     OS=acis43
  50.                 elif [ -f /sbin/nfsiod ]; then
  51.                     OS=bsd44    # prototype
  52.                 else
  53.                     OS=xinu43
  54.                 fi;;
  55. *"Alliant Concentrix"*)        OS=concentrix;;
  56. *"Umax 4.3"*)            OS=umax43;;
  57. *)
  58. #
  59. # Well, that didn't work so apply some heuristics
  60. # to the filesystem name space...
  61. #
  62.                 echo "    ... inspecting File system ..." >&2
  63.                 if [ -f /usr/bin/cat ]; then
  64.                     OS=sos4
  65.                 elif [ -f /etc/nd ]; then
  66.                     OS=sos3
  67.                 elif [ -f /etc/elcsd ]; then
  68.                     echo "    ... Ultrix - assuming U3.0 ..." >&2
  69.                     OS=u3_0
  70.                 elif [ -f /hp-ux ]; then
  71.                     OS=hpux
  72.                 elif [ -f /etc/ttylocal ]; then
  73.                     OS=xinu43
  74.                 elif [ -f /etc/minidisk ]; then
  75.                     OS=acis43
  76.                 elif [ -f /etc/toolboxdaemon ]; then
  77.                     OS=aux
  78.                 elif [ -f /sbin/nfsiod ]; then
  79.                     OS=bsd44
  80.                 elif [ -d /vrm ]; then
  81.                     OS=aix2
  82.                 else
  83.                     case "`(sh arch)2>/dev/null`" in
  84.                     powernode) OS=utx32;;
  85.                     ibm032)    OS=acis43;;
  86.                     *)       OS=unknown;;
  87.                     esac
  88.                 fi;;
  89. esac
  90.  
  91. echo "    ... OS appears to be \"${OS}\"" >&2
  92. echo "${OS}"
  93. exit 0
  94.