改进depcheck

This commit is contained in:
pointer-to-bios 2024-04-04 20:55:46 +08:00
parent 0b8d6db7b7
commit 88acd1900f
1 changed files with 18 additions and 12 deletions

View File

@ -49,14 +49,16 @@ for mod in kernel_modules:
print(" " + color['lpink'] + f"{mod}" + color['reset'] + " exists.") print(" " + color['lpink'] + f"{mod}" + color['reset'] + " exists.")
else: else:
print(" " + color['lred'] + f"{mod}" + color['reset'] + " not found.") print(" " + color['lred'] + f"{mod}" + color['reset'] + " not found.")
print("Kernel module " + print(
"Kernel module " +
color['lred'] + f"{mod}" + color['reset'] + " is not installed.") color['lred'] + f"{mod}" + color['reset'] + " is not installed.")
exit(-1) exit(-1)
# 检查软件依赖 # 检查软件依赖
pathsenv = os.environ.get("PATH").split(":") pathsenv = os.environ.get("PATH").split(":")
for software, progs in softwares.items(): for software, progs in softwares.items():
print("Checking " + color['lcyan'] + print(
"Checking " + color['lcyan'] +
f"{software}" + color['reset'] + " ...") f"{software}" + color['reset'] + " ...")
for program in progs: for program in progs:
exists = False exists = False
@ -65,15 +67,19 @@ for software, progs in softwares.items():
exists = True exists = True
break break
if exists: if exists:
print(" " + color['lyellow'] + print(
" " + color['lyellow'] +
f"{program}" + color['reset'] + " existed.") f"{program}" + color['reset'] + " existed.")
else: else:
print(" " + color['lred'] + print(
" " + color['lred'] +
f"{program}" + color['reset'] + " not found.") f"{program}" + color['reset'] + " not found.")
print("Software " + color['lred'] + f"{software}" + print(
"Software " + color['lred'] + f"{software}" +
color['reset'] + " is not installed or completed.") color['reset'] + " is not installed or completed.")
exit(-2) exit(-2)
print("All dependencies are " + print(
"All dependencies are " +
color['lgreen'] + "satisfied." + color['reset']) color['lgreen'] + "satisfied." + color['reset'])