forked from BobSteagall/gcc-builder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsystem-type.sh
executable file
·81 lines (49 loc) · 1.63 KB
/
system-type.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
#!/bin/sh
PATH=/bin:/usr/bin:/sbin:/usr/sbin
export PATH
platform_os=`uname`
if [ "$platform_os" = "Linux" ]; then
platform_arch=`uname -p`
platform_dist=`lsb_release -si | cut -d ' ' -f 1`
platform_vnum=`lsb_release -sr | cut -d '.' -f 1`
platform_mvnum=`lsb_release -sr | cut -d '.' -f 2`
if [ -f /etc/centos-release ] ; then
platform_desc='centos'
elif [ -n "`echo $platform_dist | grep -i CentOS`" ] ; then
platform_desc='centos'
elif [ -f /etc/redhat-release ] ; then
platform_desc='rhel'
elif [ -n "`echo $platform_dist | grep -i RedHatEnterprise`" ] ; then
platform_desc='rhel'
elif [ "$platform_dist" = "Ubuntu" ]; then
platform_desc='ubuntu'
else
platform_desc=`echo $platform_dist | cut -f1`
fi
elif [ "$platform_os" = "FreeBSD" ]; then
platform_arch='amd64'
platform_dist=$platform_os
platform_desc='bsd'
platform_vnum=`uname -r | cut -d '.' -f 1`
platform_mvnum=`lsb_release -sr | cut -d '.' -f 2`
else
platform_arch='unknown'
platform_dist='unknown'
platform_desc='unknown'
platform_vnum='0.0'
fi
if [ -n "$platform_mvnum" ]; then
platform_vnum="$platform_vnum.$platform_mvnum"
fi
if [ $# -eq 0 ]; then
echo $platform_dist-$platform_vnum
elif [ $1 = "--full" ] || [ $1 = "-f" ]; then
echo $platform_os \
$platform_dist-$platform_vnum \
$platform_dist $platform_vnum \
$platform_arch \
$platform_desc-$platform_vnum
elif [ $1 = "--tag" ] || [ $1 = "-t" ]; then
echo $platform_desc-$platform_vnum
fi
exit 0