-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlynx_installer.py
More file actions
31 lines (27 loc) · 892 Bytes
/
lynx_installer.py
File metadata and controls
31 lines (27 loc) · 892 Bytes
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
import subprocess
import shutil
import sys
import os
def is_lynx_installed():
return shutil.which("lynx") is not None
def install_lynx():
try:
print("[+] Instalando o Lynx...")
subprocess.run(["sudo", "apt-get", "update"], check=True)
subprocess.run(["sudo", "apt-get", "install", "-y", "lynx"], check=True)
print("[+] Lynx instalado com sucesso.")
except subprocess.CalledProcessError:
print("[-] Erro ao tentar instalar o Lynx.")
sys.exit(1)
def main():
if is_lynx_installed():
print("[✓] Lynx já está instalado.")
else:
print("[!] Lynx não encontrado.")
install_lynx()
if __name__ == "__main__":
if os.geteuid() != 0:
print("Este script precisa ser executado como root ou com sudo.")
print("Exemplo: sudo python3 check_install_lynx.py")
sys.exit(1)
main()