-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall_basics.py
78 lines (58 loc) · 2.01 KB
/
install_basics.py
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
'''
This script begins by first checking the distribution that the user has and will install the following commands/libraries:
git
python3
Assumes user is running as root and has apt-get installed
'''
import general_use
import dependencies
import subprocess
distro = general_use.check_distribution()
pack_man = general_use.package_tool(distro)
def install_python(pack_man):
'''
This function installs or updates Python 3 depending on whether it is already on the system or not
'''
print ('Installing/Updating Python 3...')
p_rc = dependencies.commandline_install(pack_man, "python3")
if p_rc != 0:
print ('INSTALLATION FAILED: Could not install Python 3')
print ("ERROR CODE:", p_rc)
else:
print ('INSTALLATION SUCCESSFUL: Python 3 successfully installed')
def update_git(pack_man):
'''
This function installs or updates git depending on whether it is already on the system or not
'''
print('Installing git...')
g_rc = dependencies.commandline_install(pack_man, "git")
if g_rc != 0:
print ("INSTALLATION FAILED: Could not install git. This is needed to install some of the tools")
print ("ERROR CODE:", g_rc)
else:
print ("INSTALLATION SUCCESSFUL: Git successfully installed")
def install_curl(pack_man):
'''
This function installs curl
'''
print ('Installing curl...')
c_rc = dependencies.commandline_install(pack_man, 'curl')
if c_rc != 0:
print ('INSTALLATION FAILED: Could not install curl. This is needed to install some of the tools')
print ('ERROR CODE:', c_rc)
else:
print ('INSTALLATION SUCCESSFUL: curl successfully installed')
def install_pip(pack_man):
'''
This function installs pip3
'''
pip_rc = dependencies.commandline_install(pack_man, 'python3-pip')
if pip_rc != 0:
print ('INSTALLATION FAILED: Failed to install pip. This is needed to install some dependencies for tools')
print ('ERROR CODE:', pip_rc)
else:
print ('INSTALLATION COMPLETE: Successfully installed pip')
install_python(pack_man)
update_git(pack_man)
install_curl(pack_man)
install_pip(pack_man)