/
thoth.sh
45 lines (39 loc) · 992 Bytes
/
thoth.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
#!/bin/bash
echo "[info] running preflight checks!"
os_detect() {
arch=$(uname -m)
echo "${arch}"
case "${arch}" in
x86_64)
echo "amd64"
;;
arm64)
echo "arm64"
;;
aarch64)
echo "arm64"
;;
*)
echo "unknow arch"
;;
esac
# Platform Detection
# ref: https://stackoverflow.com/questions/394230/how-to-detect-the-os-from-a-bash-script
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
echo "On linux"
elif [[ "$OSTYPE" == "darwin"* ]]; then
echo "On macOS"
elif [[ "$OSTYPE" == "cygwin" ]]; then
echo "A computer is like air conditioning – it becomes useless when you open..."
elif [[ "$OSTYPE" == "msys" ]]; then
echo "A computer is like air conditioning – it becomes useless when you open..."
elif [[ "$OSTYPE" == "win32" ]]; then
echo "A computer is like air conditioning – it becomes useless when you open..."
elif [[ "$OSTYPE" == "freebsd"* ]]; then
echo "On freebsd"
else
echo "Not supported OS?"
fi
# TDL: distro detection
}
os_detect