-
Notifications
You must be signed in to change notification settings - Fork 0
/
host.sh
executable file
·94 lines (90 loc) · 2.62 KB
/
host.sh
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/sh
# This script guess's the architecture of the host.
unames=`uname -s`
if [ "$unames" = AIX ]; then
test -z "$vendor" && vendor=ibm
test -z "$os" && os=aix`uname -v`.`uname -r`
machine_type=`uname -m | sed "s/........\(..\)../\1/"`
# SP nodes
if [ $machine_type = 4C ]; then
test -z "$arch" && arch=power3
# 590's
elif [ $machine_type = 70 ]; then
test -z "$arch" && arch=power2
# 397's
elif [ $machine_type = 94 ]; then
test -z "$arch" && arch=power2
# 595's
elif [ $machine_type = 89 ]; then
test -z "$arch" && arch=power2
# 3CT's
elif [ $machine_type = 59 ]; then
test -z "$arch" && arch=power2
# 530's
elif [ $machine_type = 10 ]; then
test -z "$arch" && arch=power
# 540's
elif [ $machine_type = 14 ]; then
test -z "$arch" && arch=power
# 580's
elif [ $machine_type = 66 ]; then
test -z "$arch" && arch=power
# 550's
elif [ $machine_type = 1C ]; then
test -z "$arch" && arch=power
# default
else
test -z "$arch" && arch=power
fi
elif [ "$unames" = "ULTRIX-32" ]; then
test -z "$vendor" && vendor=dec
test -z "$os" && os=ultrix`uname -r`
test -z "$arch" && arch=mips
elif [ "$unames" = "HP-UX" ]; then
test -z "$vendor" && vendor=hp
test -z "$os" && os=hpux`uname -r`
elif [ "$unames" = "IRIX" ]; then
unamem=`uname -m`
test -z "$vendor" && vendor=sgi
test -z "$os" && os=irix`uname -r`
if [ "$unamem" = IP19 ]; then
test -z "$arch" && arch=mips2
elif [ "$unamem" = IP20 ]; then
test -z "$arch" && arch=mips2
elif [ "$unamem" = IP22 ]; then
test -z "$arch" && arch=mips2
elif [ "$unamem" = IP17 ]; then
test -z "$arch" && arch=mips2
else
test -z "$arch" && arch=mips
fi
elif [ "$unames" = "IRIX64" ]; then
unamem=`uname -m`
test -z "$vendor" && vendor=sgi
test -z "$os" && os=irix`uname -r`
if [ "$unamem" = IP21 ]; then
test -z "$arch" && arch=mips4
fi
elif [ "$unames" = "Linux" ]; then
test -z "$vendor" && vendor=generic
test -z "$os" && os=linux`uname -r`
test -z "$arch" && arch=`uname -m`
#
# linux patchlevels change faster than my underwear
#
ost=`echo $os | tr . -`
major=`echo $ost | sed 's/\([^-]*\)-\([^-]*\)-\([^-]*\)-*.*/\1/'`
minor=`echo $ost | sed 's/\([^-]*\)-\([^-]*\)-\([^-]*\)-*.*/\2/'`
patch=`echo $ost | sed 's/\([^-]*\)-\([^-]*\)-\([^-]*\)-*.*/\3/'`
os=$major.$minor
elif [ "$unames" = "OSF1" ]; then
test -z "$vendor" && vendor=dec
test -z "$os" && os=osf`uname -r`
test -z "$arch" && arch=`uname -m`
else
test -z "$os" && os=$unames
fi
if [ -z "$arch" ]; then arch=unknown; fi
if [ -z "$vendor" ]; then vendor=unknown; fi
if [ -z "$os" ]; then os=unknown; fi
echo $arch-$vendor-$os