installer.py: resolve IA install error

This commit is contained in:
Mykola Grymalyuk
2021-12-21 12:33:10 -07:00
parent 79cd9c76f8
commit a8f56c1ec8
2 changed files with 22 additions and 4 deletions

View File

@@ -1107,6 +1107,8 @@ B. Exit
def download_install_assistant(self, link):
installer.download_install_assistant(self.constants.payload_path, link)
installer.install_macOS_installer(self.constants.payload_path)
input("Press any key to continue...")
# To avoid selecting the wrong installer by mistake, let user select the correct one
self.find_local_installer()

View File

@@ -53,11 +53,27 @@ def create_installer(installer_path, volume_name):
return False
def download_install_assistant(download_path, ia_link):
# Downloads and unpackages InstallAssistant.pkg into /Applications
# Downloads InstallAssistant.pkg
utilities.download_file(ia_link, (Path(download_path) / Path("InstallAssistant.pkg")))
print("- Installing InstallAssistant.pkg to /Applications/")
utilities.elevated(["installer", "-pkg", (Path(download_path) / Path("InstallAssistant.pkg")), "-target", "/Applications"])
input("- Press ENTER to continue: ")
def install_macOS_installer(download_path):
args = [
"osascript",
"-e",
f'''do shell script "installer -pkg {Path(download_path)}/InstallAssistant.pkg -target /"'''
' with prompt "OpenCore Legacy Patcher needs administrator privileges to add InstallAssistant."'
" with administrator privileges"
" without altering line endings",
]
result = subprocess.run(args,stdout=subprocess.PIPE, stderr=subprocess.PIPE)
if result.returncode == 0:
print("- InstallAssistant installed")
return True
else:
print("- Failed to install InstallAssistant")
print(f" Error Code: {result.returncode}")
return False
def list_downloadable_macOS_installers(download_path, catalog):
avalible_apps = {}