xref: /csrg-svn/usr.sbin/amd/config/os-type (revision 61786)
144631Smckusick#!/bin/sh
244631Smckusick#
344631Smckusick# Copyright (c) 1989 Jan-Simon Pendry
444631Smckusick# Copyright (c) 1989 Imperial College of Science, Technology & Medicine
561785Sbostic# Copyright (c) 1989, 1993
661785Sbostic#	The Regents of the University of California.  All rights reserved.
744631Smckusick#
844631Smckusick# This code is derived from software contributed to Berkeley by
944631Smckusick# Jan-Simon Pendry at Imperial College, London.
1044631Smckusick#
1148702Sbostic# %sccs.include.redist.sh%
1244631Smckusick#
13*61786Sbostic#	@(#)os-type	8.1 (Berkeley) 06/06/93
1444631Smckusick#
1553749Spendry# $Id: os-type,v 5.2.2.2 1992/05/31 16:45:46 jsp Exp $
1649685Spendry#
1744631Smckusick
1844631Smckusick#
1944631Smckusick# Take a pot-shot at your os type
2044631Smckusick#
2147534Spendryecho "#	... No OS= option specified; dynamically determining OS type" >&2
2244631Smckusick
2344631Smckusick#
2444631Smckusick# First try poking around in /etc/motd
2544631Smckusick#
2644631Smckusick
2744631Smckusickcase "`exec 2>/dev/null; head -2 /etc/motd`" in
2844631Smckusick*"Sun UNIX 4.2 Release 3."*)	OS=sos3;;
2944631Smckusick*"SunOS Release 4."*)		OS=sos4;;
3044631Smckusick*"HP-UX on the HP"*)		OS=hpux;;
3144631Smckusick*"Ultrix V2."*)			OS=u2_2;;
3249685Spendry*"Ultrix V3."*)			OS=u3_0;;
3344631Smckusick*"Ultrix-32 V3."*)		OS=u3_0;;
3447534Spendry*"Ultrix Worksystem V2."*)	OS=u3_0;;
3552452Spendry*"ULTRIX V4.2"*)		OS=u4_2;;
3647534Spendry*"ULTRIX V4."*)			OS=u4_0;;
3744631Smckusick*"HLH OTS Version 1."*)		OS=hlh42;;
3844631Smckusick*"RISC iX release 1."*)		OS=riscix;;
3944631Smckusick*"FPX 4."*)			OS=fpx4;;
4047534Spendry*"HCX/UX"*)			OS=hcx;;
4144631Smckusick*"4.4 BSD UNIX"*)		OS=bsd44;;
4247534Spendry*"4.3 BSD Reno UNIX"*)		OS=bsd44;;
4344631Smckusick*"4.3 BSD UNIX"*)		if [ -f /etc/minidisk ]; then
4444631Smckusick					OS=acis43
4544631Smckusick				elif [ -f /sbin/nfsiod ]; then
4644631Smckusick					OS=bsd44	# prototype
4744631Smckusick				else
4844631Smckusick					OS=xinu43
4944631Smckusick				fi;;
5044631Smckusick*"Alliant Concentrix"*)		OS=concentrix;;
5144631Smckusick*"Umax 4.3"*)			OS=umax43;;
5244631Smckusick*)
5344631Smckusick#
5444631Smckusick# Well, that didn't work so apply some heuristics
5544631Smckusick# to the filesystem name space...
5644631Smckusick#
5747534Spendry				echo "#	... inspecting File system ..." >&2
5847534Spendry				if [ -f /etc/comply ]; then
5947534Spendry					OS=utek
6053749Spendry				elif [ -d /usr/lib/methods -o -d /etc/methods ]; then
6153749Spendry					OS=aix3
6247534Spendry				elif [ -f /usr/bin/cat ]; then
6344631Smckusick					OS=sos4
6444631Smckusick				elif [ -f /etc/nd ]; then
6544631Smckusick					OS=sos3
6644631Smckusick				elif [ -f /etc/elcsd ]; then
6747534Spendry					echo "#	... Ultrix - assuming U4.0 ..." >&2
6847534Spendry					OS=u4_0
6944631Smckusick				elif [ -f /hp-ux ]; then
7044631Smckusick					OS=hpux
7144631Smckusick				elif [ -f /etc/ttylocal ]; then
7244631Smckusick					OS=xinu43
7344631Smckusick				elif [ -f /etc/minidisk ]; then
7444631Smckusick					OS=acis43
7544631Smckusick				elif [ -f /etc/toolboxdaemon ]; then
7644631Smckusick					OS=aux
7744631Smckusick				elif [ -f /sbin/nfsiod ]; then
7844631Smckusick					OS=bsd44
7944631Smckusick				elif [ -d /vrm ]; then
8044631Smckusick					OS=aix2
8144631Smckusick				elif [ -f /bin/pyr ] && /bin/pyr; then
8244631Smckusick					OS=pyrOSx
8347534Spendry				elif [ -d /NextApps ]; then
8447534Spendry					OS=next
8553749Spendry				elif [ -f /etc/gl/ucode ]; then
8653749Spendry					OS=irix3
8753749Spendry				elif [ -f /usr/gfx/ucode ]; then
8853749Spendry					OS=irix4
8952452Spendry				elif [ -f /stellix ]; then
9052452Spendry					OS=stellix
9144631Smckusick				else
9247534Spendry					case "`(sh ../config/arch)2>/dev/null`" in
9344631Smckusick					ibm032)    OS=acis43;;
9447534Spendry					aviion)    OS=dgux;;
9544631Smckusick					*)	   OS=unknown;;
9644631Smckusick					esac
9744631Smckusick				fi;;
9844631Smckusickesac
9944631Smckusick
10047534Spendryecho "#	... OS appears to be \"${OS}\"" >&2
10144631Smckusickecho "${OS}"
10244631Smckusickexit 0
103