-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_platform.sh
More file actions
23 lines (23 loc) · 785 Bytes
/
_platform.sh
File metadata and controls
23 lines (23 loc) · 785 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
function check_os() {
# Credit to <https://gist.github.com/gmolveau/d0e3efc219c5bcc6ecc13a1405ac6c73>
echo "Checking Operating System..."
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
DISTRIB=$(awk -F'=' '/^ID=/ {print tolower($2)}' /etc/*-release 2>/dev/null)
if [[ ${DISTRIB} = "ubuntu"* ]]; then
if uname -a | grep -q '^linux.*microsoft'; then
echo "Ubuntu via WSL"
else
echo "Ubuntu"
fi
elif [[ ${DISTRIB} = "debian"* ]]; then
echo "Debian"
elif [[ ${DISTRIB} = "arch"* ]]; then
echo "Arch"
fi
elif [[ "$OSTYPE" == "darwin"* ]]; then
echo "macOS OSX"
else
echo "Error, unsupported operating system"
fi
echo ""
}