File: detect.sh

package info (click to toggle)
quakespasm 0.93.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 4,672 kB
  • sloc: ansic: 52,034; sh: 306; makefile: 263
file content (62 lines) | stat: -rwxr-xr-x 811 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#! /bin/sh

# script from loki_setup tools

DetectARCH()
{
	status=1
	case `uname -m` in
	    amd64 | x86_64)
		echo "x86_64"
		status=0;;
	    i?86 | i86*)
		echo "x86"
		status=0;;
	    90*/*)
		echo "hppa"
		status=0;;
	    *)
		case `uname -s` in
		    IRIX*)
			echo "mips"
			status=0;;
		    AIX*)
			echo "ppc"
			status=0;;
		    *)
			arch=`uname -p 2> /dev/null || uname -m`
			if test "$arch" = powerpc; then
				echo "ppc"
			else
				echo $arch
			fi
			status=0;;
		esac
	esac
	return $status
}

DetectOS()
{
	os=`uname -s`
	if test "$os" = "OpenUNIX"; then
		echo SCO_SV
	else
		echo $os
	fi
	return 0
}

if test "$1" = "os"; then
	result=`DetectOS`
elif test "$1" = "arch"; then
	result=`DetectARCH`
else
	result="OS: `DetectOS`, Arch: `DetectARCH`"
fi

status="$?"
echo $result

exit $status