@@ -19,14 +19,47 @@ By using this software you must agree all below terms:
19
19
[?] If you agree, press [Enter] to procede:"
20
20
read junk
21
21
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. "
28
28
fi
29
29
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
+
30
63
# Install python requirements
31
64
echo " [*] Installing python requirements..."
32
65
pip3 install -r requirements.txt > /dev/null 2>&1 ;
0 commit comments