Добавил проверку

This commit is contained in:
Aren Elchinyan 2023-10-22 15:27:02 +03:00 committed by GitHub
parent e7255ee14d
commit 67d90b8d94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 2 deletions

View File

@ -2,6 +2,7 @@ import os
import shutil
import subprocess
import time
import platform
from multiprocessing import Pool
@ -93,6 +94,17 @@ def check_limine():
os.chdir("..")
def check_os():
current_os = platform.system().lower()
if current_os == 'linux':
dist = platform.linux_distribution()[0].lower()
if dist == 'ubuntu' or dist == 'debian':
return 1
return 0
def check_tools():
required_tools = ["gcc", "g++", "xorriso", "make", "mtools", "curl"]
missing_tools = []
@ -102,7 +114,9 @@ def check_tools():
missing_tools.append(tool)
if len(missing_tools) > 0:
subprocess.run(["sudo", "apt", "install"] + missing_tools)
if check_os():
subprocess.run(["sudo", "apt", "install"] + missing_tools)
return
subprocess.run(["sudo", "pacman", "-S"] + missing_tools)
@ -165,4 +179,4 @@ if __name__ == "__main__":
create_iso("bmosp")
create_hdd("bmosp")
print(f"Не забудьте сохранить изменения! Номер сборки: {major}.{minor}.{build}")
print(f"Не забудьте сохранить изменения! Номер сборки: {major}.{minor}.{build}")