From 37449d9738807162055a82d9dc2cd248475c03bc Mon Sep 17 00:00:00 2001 From: "Keven S. Lopes" <40838038+stephan-lopes@users.noreply.github.com> Date: Sun, 21 Jan 2024 17:16:36 -0300 Subject: [PATCH] =?UTF-8?q?hotfix/GADEV-72:=20cria=C3=A7=C3=A3o=20de=20arq?= =?UTF-8?q?uivos=20de=20utilit=C3=A1rios?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 utils.py diff --git a/utils.py b/utils.py new file mode 100644 index 0000000..f433d59 --- /dev/null +++ b/utils.py @@ -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.")