-
Notifications
You must be signed in to change notification settings - Fork 2
/
installer.py
executable file
·77 lines (52 loc) · 2.04 KB
/
installer.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
#!/usr/bin/python3
"""
Copyright [2020-2021] [M.Amin Azimi .K (amzy-0)]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
__authors__ = ['M.Amin Azimi .K(amzy-0)', 'https://github.com/amzy-0/pck3r/graphs/contributors']
from libs import stuff
from os import system as syscall
# install dependancies
###############################################################################
# preinstall requirements
if syscall('sudo -p "[sudo]🔑" apt install python3-pip ; sudo mkdir -p /opt/pck3r/')!=0:
quit()
###############################################################################
syscall('pip install -r requirements.txt')
from progress.bar import Bar
import time
make_link = 'sudo ln -s /opt/pck3r/main.py /bin/pck3r'
# Progress bar widget
# Function responsible for the updation
# of the progress bar value
with Bar('INSTALLING', fill='\U0001F709', max=100) as bar:
# 20% PROGRESS
syscall('sudo unlink /bin/pck3r > /dev/null 2>&1')
bar.next(20)
# 40% PROGRESS
time.sleep(1)
syscall('sudo cp -rf . /opt/pck3r > /dev/null 2>&1')
bar.next(20)
# 50% PROGRESS
time.sleep(1)
syscall(make_link)
bar.next(10)
# 60% PROGRESS
time.sleep(1)
if (syscall('sudo ls -l /bin/pck3r > /dev/null 2>&1')) == 0:
pass
else:
syscall('%s%sNO LINK ! (/bin/pck3r)%s' % (stuff.sysERR(), stuff.RED, stuff.NRM))
time.sleep(1)
bar.next(10)
# 100% PROGRESS
bar.next(40)
print('\n%s\bLink created and installed successfuly' % (stuff.sysOk()))