Ensure boot.efi is copied to root in TUI

This commit is contained in:
Mykola Grymalyuk
2021-12-08 09:16:28 -07:00
parent e30f8be03d
commit f75f1aa87a

View File

@@ -5,6 +5,7 @@
import plistlib import plistlib
import subprocess import subprocess
import shutil import shutil
import os
from pathlib import Path from pathlib import Path
from resources import utilities, constants from resources import utilities, constants
from data import os_data from data import os_data
@@ -168,9 +169,13 @@ Please build OpenCore first!"""
if (mount_path / Path("System")).exists(): if (mount_path / Path("System")).exists():
print("- Removing preexisting System folder") print("- Removing preexisting System folder")
shutil.rmtree(mount_path / Path("System"), onerror=rmtree_handler) shutil.rmtree(mount_path / Path("System"), onerror=rmtree_handler)
if (mount_path / Path("boot.efi")).exists():
print("- Removing preexisting boot.efi")
os.remove(mount_path / Path("boot.efi"))
print("- Copying OpenCore onto EFI partition") print("- Copying OpenCore onto EFI partition")
shutil.copytree(self.constants.opencore_release_folder / Path("EFI/OC"), mount_path / Path("EFI/OC")) shutil.copytree(self.constants.opencore_release_folder / Path("EFI/OC"), mount_path / Path("EFI/OC"))
shutil.copytree(self.constants.opencore_release_folder / Path("System"), mount_path / Path("System")) shutil.copytree(self.constants.opencore_release_folder / Path("System"), mount_path / Path("System"))
shutil.copy(self.constants.opencore_release_folder / Path("boot.efi"), mount_path / Path("boot.efi"))
if self.constants.boot_efi is True: if self.constants.boot_efi is True:
print("- Converting Bootstrap to BOOTx64.efi") print("- Converting Bootstrap to BOOTx64.efi")
if (mount_path / Path("EFI/BOOT")).exists(): if (mount_path / Path("EFI/BOOT")).exists():