mirror of
https://github.com/corpnewt/gibMacOS.git
synced 2025-01-06 18:37:36 +01:00
Add support for BaseSystem.dmg - default to OC
This commit is contained in:
parent
b4f353ebf0
commit
3e49ef255a
@ -42,7 +42,8 @@ class WinUSB:
|
|||||||
self.z_path32 = os.path.join(os.environ['SYSTEMDRIVE'] + "\\", "Program Files (x86)", "7-Zip", "7z.exe")
|
self.z_path32 = os.path.join(os.environ['SYSTEMDRIVE'] + "\\", "Program Files (x86)", "7-Zip", "7z.exe")
|
||||||
self.recovery_suffixes = (
|
self.recovery_suffixes = (
|
||||||
"recoveryhdupdate.pkg",
|
"recoveryhdupdate.pkg",
|
||||||
"recoveryhdmetadmg.pkg"
|
"recoveryhdmetadmg.pkg",
|
||||||
|
"basesystem.dmg"
|
||||||
)
|
)
|
||||||
self.dd_bootsector = True
|
self.dd_bootsector = True
|
||||||
self.boot0 = "boot0af"
|
self.boot0 = "boot0af"
|
||||||
@ -322,7 +323,7 @@ class WinUSB:
|
|||||||
print("M. Main Menu")
|
print("M. Main Menu")
|
||||||
print("Q. Quit")
|
print("Q. Quit")
|
||||||
print("")
|
print("")
|
||||||
menu = self.u.grab("Please paste the recovery update pkg path to extract: ")
|
menu = self.u.grab("Please paste the recovery update pkg/dmg path to extract: ")
|
||||||
if menu.lower() == "q":
|
if menu.lower() == "q":
|
||||||
self.u.custom_quit()
|
self.u.custom_quit()
|
||||||
if menu.lower() == "m":
|
if menu.lower() == "m":
|
||||||
@ -358,32 +359,34 @@ class WinUSB:
|
|||||||
temp = tempfile.mkdtemp()
|
temp = tempfile.mkdtemp()
|
||||||
cwd = os.getcwd()
|
cwd = os.getcwd()
|
||||||
os.chdir(temp)
|
os.chdir(temp)
|
||||||
# Extract in sections and remove any files we run into
|
print("Located {}...".format(os.path.basename(path)))
|
||||||
print("Extracting Recovery dmg...")
|
if not path.lower().endswith(".dmg"):
|
||||||
out = self.r.run({"args":[self.z_path, "e", "-txar", path, "*.dmg"]})
|
# Extract in sections and remove any files we run into
|
||||||
if out[2] != 0:
|
print("Extracting Recovery dmg...")
|
||||||
shutil.rmtree(temp,ignore_errors=True)
|
out = self.r.run({"args":[self.z_path, "e", "-txar", path, "*.dmg"]})
|
||||||
print("An error occurred extracting: {}".format(out[2]))
|
if out[2] != 0:
|
||||||
print("")
|
shutil.rmtree(temp,ignore_errors=True)
|
||||||
self.u.grab("Press [enter] to return...")
|
print("An error occurred extracting: {}".format(out[2]))
|
||||||
return
|
print("")
|
||||||
print("Extracting BaseSystem.dmg...")
|
self.u.grab("Press [enter] to return...")
|
||||||
# No files to delete here - let's extract the next part
|
return
|
||||||
out = self.r.run({"args":[self.z_path, "e", "*.dmg", "*/Base*.dmg"]})
|
print("Extracting BaseSystem.dmg...")
|
||||||
if out[2] != 0:
|
# No files to delete here - let's extract the next part
|
||||||
shutil.rmtree(temp,ignore_errors=True)
|
out = self.r.run({"args":[self.z_path, "e", "*.dmg", "*/Base*.dmg"]})
|
||||||
print("An error occurred extracting: {}".format(out[2]))
|
if out[2] != 0:
|
||||||
print("")
|
shutil.rmtree(temp,ignore_errors=True)
|
||||||
self.u.grab("Press [enter] to return...")
|
print("An error occurred extracting: {}".format(out[2]))
|
||||||
return
|
print("")
|
||||||
# If we got here - we should delete everything in the temp folder except
|
self.u.grab("Press [enter] to return...")
|
||||||
# for a .dmg that starts with Base
|
return
|
||||||
del_list = [x for x in os.listdir(temp) if not (x.lower().startswith("base") and x.lower().endswith(".dmg"))]
|
# If we got here - we should delete everything in the temp folder except
|
||||||
for d in del_list:
|
# for a .dmg that starts with Base
|
||||||
os.remove(os.path.join(temp, d))
|
del_list = [x for x in os.listdir(temp) if not (x.lower().startswith("base") and x.lower().endswith(".dmg"))]
|
||||||
|
for d in del_list:
|
||||||
|
os.remove(os.path.join(temp, d))
|
||||||
# Onto the last command
|
# Onto the last command
|
||||||
print("Extracting hfs...")
|
print("Extracting hfs...")
|
||||||
out = self.r.run({"args":[self.z_path, "e", "-tdmg", "Base*.dmg", "*.hfs"]})
|
out = self.r.run({"args":[self.z_path, "e", "-tdmg", path if path.lower().endswith(".dmg") else "Base*.dmg", "*.hfs"]})
|
||||||
if out[2] != 0:
|
if out[2] != 0:
|
||||||
shutil.rmtree(temp,ignore_errors=True)
|
shutil.rmtree(temp,ignore_errors=True)
|
||||||
print("An error occurred extracting: {}".format(out[2]))
|
print("An error occurred extracting: {}".format(out[2]))
|
||||||
@ -790,7 +793,7 @@ class WinUSB:
|
|||||||
print("Usage: [drive number][option (only one allowed)] r[Clover revision (optional)]\n (eg. 1B r5092)")
|
print("Usage: [drive number][option (only one allowed)] r[Clover revision (optional)]\n (eg. 1B r5092)")
|
||||||
print(" Options are as follows with precedence B > E > U > G:")
|
print(" Options are as follows with precedence B > E > U > G:")
|
||||||
print(" B = Only install the boot manager to the drive's first partition.")
|
print(" B = Only install the boot manager to the drive's first partition.")
|
||||||
print(" O = Use OpenCore instead of Clover.")
|
print(" C = Use Clover instead of OpenCore.")
|
||||||
print(" E = Sets the type of the drive's first partition to EFI.")
|
print(" E = Sets the type of the drive's first partition to EFI.")
|
||||||
print(" U = Similar to E, but sets the type to Basic Data (useful for editing).")
|
print(" U = Similar to E, but sets the type to Basic Data (useful for editing).")
|
||||||
print(" G = Format as GPT (default is MBR).")
|
print(" G = Format as GPT (default is MBR).")
|
||||||
@ -806,12 +809,15 @@ class WinUSB:
|
|||||||
self.show_all_disks ^= True
|
self.show_all_disks ^= True
|
||||||
self.main()
|
self.main()
|
||||||
return
|
return
|
||||||
only_boot = use_oc = set_efi = unset_efi = use_gpt = False
|
only_boot = set_efi = unset_efi = use_gpt = False
|
||||||
|
use_oc = True
|
||||||
if "b" in menu.lower():
|
if "b" in menu.lower():
|
||||||
only_boot = True
|
only_boot = True
|
||||||
menu = menu.lower().replace("b","")
|
menu = menu.lower().replace("b","")
|
||||||
if "o" in menu.lower():
|
if "c" in menu.lower():
|
||||||
use_oc = True
|
use_oc = False
|
||||||
|
menu = menu.lower().replace("c","")
|
||||||
|
if "o" in menu.lower(): # Remove legacy "o" value
|
||||||
menu = menu.lower().replace("o","")
|
menu = menu.lower().replace("o","")
|
||||||
if "e" in menu.lower():
|
if "e" in menu.lower():
|
||||||
set_efi = True
|
set_efi = True
|
||||||
|
Loading…
Reference in New Issue
Block a user