Skip to content

Commit 5e08da5

Browse files
committed
Implemented macos support
1 parent c4402eb commit 5e08da5

File tree

1 file changed

+39
-6
lines changed

1 file changed

+39
-6
lines changed

install.sh

+39-6
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,47 @@ By using this software you must agree all below terms:
1919
[?] If you agree, press [Enter] to procede:"
2020
read junk
2121

22-
# TODO: Implement non-APT environment installation
23-
if [ $(dpkg-query -W -f='${Status}' python3 > /dev/null 2>&1 | grep -c "ok installed") -eq 0 ]; then
24-
# Python3 not installed on the system, just install it!
25-
echo "[*] Installing python interpreter on the system..."
26-
apt update > /dev/null 2>&1;
27-
apt install python3 > /dev/null 2>&1;
22+
if [ "$(uname)" == "Darwin" ]; then
23+
install_python_mac()
24+
elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
25+
install_python_linux()
26+
else
27+
echo "[x] Only MacOS and Linux operating system are supported."
2828
fi
2929

30+
install_python_mac () {
31+
if ! command -v brew >/dev/null; then
32+
echo "[x] Brew package manager not installed."
33+
fi
34+
35+
if ! brew list -1 | grep -q "python@3"; then
36+
echo "[*] Installing python interpreter on the system..."
37+
if ! brew install -y "python3" > /dev/null 2>&1; then
38+
echo "[x] Cannot install python via brew."
39+
fi
40+
fi
41+
}
42+
43+
install_python_linux () {
44+
if command -v apt-get >/dev/null; then
45+
install_python_apt()
46+
elif command -v yum >/dev/null; then
47+
install_python_yum()
48+
else
49+
echo "[x] Neither apt not yum found as package manager."
50+
exit
51+
fi
52+
}
53+
54+
install_python_apt () {
55+
if [ $(dpkg-query -W -f='${Status}' python3 > /dev/null 2>&1 | grep -c "ok installed") -eq 0 ]; then
56+
# Python3 not installed on the system, just install it!
57+
echo "[*] Installing python interpreter on the system..."
58+
apt update > /dev/null 2>&1;
59+
apt install python3 > /dev/null 2>&1;
60+
fi
61+
}
62+
3063
# Install python requirements
3164
echo "[*] Installing python requirements..."
3265
pip3 install -r requirements.txt > /dev/null 2>&1;

0 commit comments

Comments
 (0)