-
Notifications
You must be signed in to change notification settings - Fork 0
/
func.sh
52 lines (49 loc) · 1.24 KB
/
func.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
#!/bin/bash
function getOSArch () {
case "$(uname -p)" in
x86_64)
ARCH=64
;;
i[3-6]86)
ARCH=32
;;
*)
ARCH=unsupported
;;
esac
echo $ARCH
}
function getOSName () {
if [ "$(uname)" == "Darwin" ]; then
OS="mac"
elif [ "$(expr substr $(uname) 1 10)" == "MINGW32_NT" ] || [ "$(expr substr $(uname) 1 10)" == "MINGW64_NT" ]; then
OS="winlinux"
elif [ -e /etc/debian_version ] || [ -e /etc/debian_release ]; then
if [ -e /etc/lsb-release ]; then
OS="ubuntu"
else
OS="debian"
fi
elif [ -e /etc/fedora-release ]; then
OS="fedora"
elif [ -e /etc/redhat-release ]; then
if [ -e /etc/oracle-release ]; then
OS="oracle"
else
OS="redhat"
fi
elif [ -e /etc/arch-release ]; then
OS="arch"
elif [ -e /etc/turbolinux-release ]; then
OS="turbo"
elif [ -e /etc/SuSE-release ]; then
OS="suse"
elif [ -e /etc/mandriva-release ]; then
OS="mandriva"
elif [ -e /etc/vine-release ]; then
OS="vine"
elif [ -e /etc/gentoo-release ]; then
OS="gentoo"
fi
echo $OS
}