Created
December 3, 2020 05:41
-
-
Save nonaybay/91d7e49ec324ac7b83f83a1625cbbf17 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3.9 | |
import os | |
import sys | |
import time | |
def runhere(code): | |
time.sleep(.55) | |
os.system('clear') | |
time.sleep(.89) | |
print('\nEXECUTANDO {}\n'.format(code)) | |
os.system(code) | |
print('\nEXECUTADO\n') | |
time.sleep(.55) | |
fileREQ = 'requirements.txt' | |
fileINS = 'installed.txt' | |
fileAPP = 'main.py' | |
runhere('rm -rfv {} {} {} *.txt **/*'.format(fileREQ, fileINS, fileAPP)) | |
pathR = './requirements/' | |
lREQ = pathR + fileREQ | |
lINS = pathR + fileINS | |
runhere('mkdir ' + pathR) | |
runhere('touch ' + pathR + fileREQ) | |
runhere('touch ' + pathR + fileINS) | |
requirements = open(lREQ, 'w+') | |
requirements.write('''colored>=0 | |
pip>=0 | |
''') | |
requirements.close() | |
installed = open(lINS, 'w+') | |
installed.close() | |
runhere('python -m pip install --upgrade --force-reinstall -r {}'.format(lREQ)) | |
runhere('sudo python -m pip install --upgrade --force-reinstall -r {}'.format(lREQ)) | |
runhere('python -m pip freeze > {}'.format(lINS)) | |
os.system('clear') | |
application = open(fileAPP, 'w+') | |
application.write('''#!/usr/bin/python | |
import os | |
import time | |
import sys | |
import colored | |
from colored import fg, bg, attr | |
color = bg('#1c1c1e') + fg('#34c759') + attr('bold') + attr('underlined') | |
reset = attr('reset') | |
def run(code): | |
time.sleep(.5) | |
os.system('clear') | |
time.sleep(.89) | |
print('') | |
print(color + 'Executando: sudo ' + code + reset) | |
print('') | |
os.system('sudo ' + code) | |
print('') | |
print('EXECUTADO') | |
print('') | |
time.sleep(.5) | |
os.system('clear') | |
run('apt-get update') | |
run('apt-get install -y -f') | |
run('apt-get upgrade -y -f') | |
run('apt-get full-upgrade -y -f') | |
run('apt-get dist-upgrade -y -f') | |
run('apt-get autoremove -y') | |
run('apt-get clean -y') | |
label = fg('#30ba78') + bg('#000000') + attr('underlined') | |
text = fg('#FF6A52') + bg('#000000') + attr('bold') | |
print(color + 'INFORMAÇÕES DO SISTEMA:' + reset) | |
print('') | |
versao = os.popen('lsb_release -sr').read() | |
codenome = os.popen('lsb_release -sc').read() | |
distribuidor = os.popen('lsb_release -si').read() | |
print(label + 'Distribuidor:' + reset + ' ' + text + distribuidor + reset) | |
print(label + 'Versão:' + reset + ' ' + text + versao + reset) | |
print(label + 'Codinome:' + reset + ' ' + text + codenome + reset) | |
input(color + 'Enter para continuar.' + reset) | |
''') | |
application.close() | |
runhere('sudo chmod +x ' + fileAPP) | |
runhere('sudo mv {} /usr/bin/nnb_update'.format(fileAPP)) | |
runhere('rm -rfv requirements') | |
import colored | |
from colored import fg, bg, attr | |
color = bg('#1c1c1e') + fg('#34c759') + attr('bold') + attr('underlined') | |
reset = attr('reset') | |
rese2 = attr('blink') + attr('bold') | |
print(color + reset) | |
print(color + 'Para fazer as atualizações use o comando' + reset + rese2 + ' nnb_update' + reset) | |
print(color + reset) | |
input(color + rese2 + 'Enter para continuar' + reset) | |
runhere('sudo nnb_update') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment