mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-06-20 14:10:51 +10:00
Fix screen clear erroring in RecoveryOS
This commit is contained in:
@@ -57,6 +57,9 @@ class OpenCoreLegacyPatcher():
|
|||||||
self.constants.custom_cpu_model_value = custom_cpu_model_value.split("%00")[0]
|
self.constants.custom_cpu_model_value = custom_cpu_model_value.split("%00")[0]
|
||||||
|
|
||||||
# Check if running in RecoveryOS
|
# Check if running in RecoveryOS
|
||||||
|
self.check_recovery()
|
||||||
|
|
||||||
|
def check_recovery(self):
|
||||||
root_partition_info = plistlib.loads(subprocess.run("diskutil info -plist /".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode())
|
root_partition_info = plistlib.loads(subprocess.run("diskutil info -plist /".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode())
|
||||||
if root_partition_info["VolumeName"] == "macOS Base System" and \
|
if root_partition_info["VolumeName"] == "macOS Base System" and \
|
||||||
root_partition_info["FilesystemType"] == "apfs" and \
|
root_partition_info["FilesystemType"] == "apfs" and \
|
||||||
|
|||||||
+11
-3
@@ -3,8 +3,8 @@ from __future__ import print_function
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import math as m
|
import math as m
|
||||||
|
import plistlib
|
||||||
from Resources import Constants
|
import subprocess
|
||||||
|
|
||||||
def header(lines):
|
def header(lines):
|
||||||
lines = [i for i in lines if i is not None]
|
lines = [i for i in lines if i is not None]
|
||||||
@@ -15,10 +15,18 @@ def header(lines):
|
|||||||
print("#" + " " * left_side + line.strip() + " " * (total_length - len("#" + " " * left_side + line.strip()) - 1) + "#")
|
print("#" + " " * left_side + line.strip() + " " * (total_length - len("#" + " " * left_side + line.strip()) - 1) + "#")
|
||||||
print("#" * total_length)
|
print("#" * total_length)
|
||||||
|
|
||||||
|
def check_recovery():
|
||||||
|
root_partition_info = plistlib.loads(subprocess.run("diskutil info -plist /".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode())
|
||||||
|
if root_partition_info["VolumeName"] == "macOS Base System" and \
|
||||||
|
root_partition_info["FilesystemType"] == "apfs" and \
|
||||||
|
root_partition_info["BusProtocol"] == "Disk Image":
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
def cls():
|
def cls():
|
||||||
# RecoveryOS doesn't support terminal clearing
|
# RecoveryOS doesn't support terminal clearing
|
||||||
if Constants.Constants().recovery_status == False:
|
if check_recovery() == False:
|
||||||
os.system('cls' if os.name == 'nt' else 'clear')
|
os.system('cls' if os.name == 'nt' else 'clear')
|
||||||
else:
|
else:
|
||||||
# Default terminal window is 24 lines tall
|
# Default terminal window is 24 lines tall
|
||||||
|
|||||||
Reference in New Issue
Block a user