From eaa686e0453f455b054f75edbc2aed9bd7029660 Mon Sep 17 00:00:00 2001 From: Mykola Grymalyuk Date: Sat, 16 Oct 2021 21:51:55 -0600 Subject: [PATCH] Add saftey check for Vault configurations --- resources/build.py | 11 +++++++++-- resources/utilities.py | 8 ++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/resources/build.py b/resources/build.py index 39a54c776..ca8d5ab3b 100644 --- a/resources/build.py +++ b/resources/build.py @@ -1002,8 +1002,15 @@ class BuildOpenCore: def sign_files(self): if self.constants.vault is True: - print("- Vaulting EFI") - subprocess.run([str(self.constants.vault_path), f"{self.constants.oc_folder}/"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + if utilities.check_command_line_tools() is True: + # sign.command checks for the existance of '/usr/bin/strings' however does not verify whether it's executable + # sign.command will continue to run and create an unbootable OpenCore.efi due to the missing strings binary + # macOS has dummy binaries that just reroute to the actual binaries after you install Xcode's Command Line Tools + print("- Vaulting EFI") + subprocess.run([str(self.constants.vault_path), f"{self.constants.oc_folder}/"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + else: + print("- Missing Command Line tools, skipping Vault for saftey reasons") + print("- Install via 'xcode-select --install' and rerun OCLP if you wish to vault this config") def build_opencore(self): self.build_efi() diff --git a/resources/utilities.py b/resources/utilities.py index 2f8e8d7d9..6d1d4b2ea 100644 --- a/resources/utilities.py +++ b/resources/utilities.py @@ -238,6 +238,14 @@ def cls(): else: print("\u001Bc") +def check_command_line_tools(): + # Determine whether Command Line Tools exist + # xcode-select -p + xcode_select = subprocess.run("xcode-select -p".split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + if xcode_select.returncode == 0: + return True + else: + return False def get_nvram(variable: str, uuid: str = None, *, decode: bool = False): # TODO: Properly fix for El Capitan, which does not print the XML representation even though we say to