Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hotfix/GADEV-72: criação de arquivos de utilitários #30

Merged
merged 1 commit into from
Jan 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from os import geteuid, system
import distro

def verificar_root():
if geteuid() != 0:
raise Exception("Este script requer privilégios de superusuário (root) para instalar ferramentas.")

def clear():
system('clear')

def check_distro():
distro_info = distro.name().lower().split()

if distro_info[0] in ['debian', 'ubuntu', 'kali']:

return {
'instalador': 'apt',
'argumento_do_instalador': '-y'
}

else:
raise Exception(f"Desculpe, este script suporta apenas instaladores de Debian, Ubuntu e Kali. Sua distribuição ({distro_info}) não é suportada.")