-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdiscover_os
executable file
·39 lines (34 loc) · 1.46 KB
/
discover_os
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
#! /bin/bash
function discover_os() {
platform=unknown
arch=$(uname -m)
if [[ "$OSTYPE" == "linux-gnu" ]]; then
echo -e "We are on\033[1;34m LINUX \033[0m, with architecture \033[1;34m$arch\033[0m"
platform=linux
elif [[ "$OSTYPE" == "linux" ]]; then
echo -e "We are on\033[1;34m LINUX \033[0m, with architecture \033[1;34m$arch\033[0m"
platform=linux
elif [[ "$OSTYPE" == "darwin"* ]]; then
echo -e "We are on\033[1;34m MAC OSX \033[0m, with architecture \033[1;34m$arch\033[0m"
platform=osx
elif [[ "$OSTYPE" == "cygwin" ]]; then
echo -e "We are on\033[1;34m CYGWIN \033[0m, with architecture \033[1;34m$arch\033[0m"
platform=cygwin
elif [[ "$OSTYPE" == "msys" ]]; then
echo -e "We are on\033[1;34m Microsoft Window \033[0m, with architecture \033[1;34m$arch\033[0m"
echo "This platform is not supported"
exit 1
elif [[ "$OSTYPE" == "win32" ]]; then
echo -e "We are on\033[1;34m Microsoft Window \033[0m, with architecture \033[1;34m$arch\033[0m"
echo "This platform is not supported"
exit 1
elif [[ "$OSTYPE" == "freebsd"* ]]; then
echo -e "We are on\033[1;34m FREEBSD \033[0m, with architecture \033[1;34m$arch\033[0m"
echo "This platform is not supported"
exit 1
else
echo -e "We are on an\033[1;34m unknown OS \033[0m, with architecture \033[1;34m$arch\033[0m"
echo "This platform is not supported"
exit 1
fi
}