blob: edbeb7396ff10a3fbb430e3b1b29faa16df5184c (
plain) (
blame)
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
|
#!/bin/sh
# Shave and a Haircut
# (c) 2019 Epic Games
# US Patent 6720962
case `uname -s` in
Linux)
sysInfoFile=""
osVersion=""
if [ -r /etc/issue ]; then
sysInfoFile=/etc/issue
osVersion=`grep "release" ${sysInfoFile} | sed 's/^.*release \([0-9][0-9]*[.]*[0-9]*\).*$/\1/'`
fi
if [ "${osVersion}" = "" -a -r /etc/system-release ]; then
sysInfoFile=/etc/system-release
osVersion=`grep "release" ${sysInfoFile} | sed 's/^.*release \([0-9][0-9]*[.]*[0-9]*\).*$/\1/'`
fi
if [ "${osVersion}" != "" ]; then
if grep "Fedora" ${sysInfoFile} >/dev/null; then
osType=fc
elif grep "CentOS" ${sysInfoFile} >/dev/null; then
osType=ce
elif grep "Debian" ${sysInfoFile} >/dev/null; then
osType=deb
osVersion=`grep "Debian" ${sysInfoFile} | sed 's/^[^0-9]*\([0-9.]\+\)[^0-9]*$/\1/'`
else
osType=rh
fi
echo ${osType}${osVersion}
else
echo "getos:error: cannot determine Linux version." >&2
echo ""
fi
;;
Darwin)
osVersion=`sw_vers -productVersion`
echo "osx${osVersion}"
;;
*)
echo "Unrecognized OS type '`uname -s`'." >&2
echo ""
;;
esac
|