Skip to content

Commit

Permalink
Fix Ventura download and add to v0.10.5
Browse files Browse the repository at this point in the history
* Grub Assistant (#31)

* Grub Assistant

* Update grub-args.py

Signed-off-by: Dominic Truesdale <9935599+DomTrues@users.noreply.github.com>

---------

Signed-off-by: Dominic Truesdale <9935599+DomTrues@users.noreply.github.com>

* Fix Ventura BaseSystem download

* Update changelog

---------

Signed-off-by: Dominic Truesdale <9935599+DomTrues@users.noreply.github.com>
Co-authored-by: Dominic Truesdale <9935599+DomTrues@users.noreply.github.com>
  • Loading branch information
Coopydood and DomTrues authored Dec 3, 2023
1 parent 9b3557d commit 0c72882
Show file tree
Hide file tree
Showing 5 changed files with 266 additions and 3 deletions.
1 change: 1 addition & 0 deletions docs/changelogs/v0-10-5.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ This update includes the following features / fixes / changes:
- BaseSystem attachment state is now honoured when converting to XML
- Added support for disk types to XML converter
- XML converter blob-based array initialisation can now be force-disabled with ``--no-blobs``
- Fixed an issue where selecting macOS Ventura would download macOS Sonoma
- Fixed AutoPilot crash on completion screen if logging was disabled
- Fixed extreme value handling for existing hard disk paths in AutoPilot
- Fixed the displayed domain name on XML import success screen
Expand Down
2 changes: 1 addition & 1 deletion scripts/dlosx-arg.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ def main():
{"name": "Catalina (10.15)", "b": "Mac-00BE6ED71E35EB86", "m": "00000000000000000", "short": "catalina"},
{"name": "Big Sur (11.7)", "b": "Mac-2BD1B31983FE1663", "m": "00000000000000000", "short": "big-sur"},
{"name": "Monterey (12.6)", "b": "Mac-B809C3757DA9BB8D", "m": "00000000000000000", "os_type": "latest", "short": "monterey"},
{"name": "Ventura (13)", "b": "Mac-7BA5B2D9E42DDD94", "m": "00000000000000000", "os_type": "latest", "short": "ventura"},
{"name": "Ventura (13)", "b": "Mac-4B682C642B45593E", "m": "00000000000000000", "os_type": "latest", "short": "ventura"},
{"name": "Sonoma (14) ", "b": "Mac-A61BADE1FDAD7B05", "m": "00000000000000000", "short": "sonoma"}
]

Expand Down
2 changes: 1 addition & 1 deletion scripts/dlosx.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ def main():
{"name": "Catalina (10.15)", "b": "Mac-00BE6ED71E35EB86", "m": "00000000000000000", "short": "catalina"},
{"name": "Big Sur (11.7)", "b": "Mac-2BD1B31983FE1663", "m": "00000000000000000", "short": "big-sur"},
{"name": "Monterey (12.6)", "b": "Mac-B809C3757DA9BB8D", "m": "00000000000000000", "os_type": "latest", "short": "monterey"},
{"name": "Ventura (13)", "b": "Mac-7BA5B2D9E42DDD94", "m": "00000000000000000", "os_type": "latest", "short": "ventura"},
{"name": "Ventura (13)", "b": "Mac-4B682C642B45593E", "m": "00000000000000000", "os_type": "latest", "short": "ventura"},
{"name": "Sonoma (14) ", "b": "Mac-A61BADE1FDAD7B05", "m": "00000000000000000", "short": "sonoma"}
]

Expand Down
258 changes: 258 additions & 0 deletions scripts/domtrues/grub-args.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,258 @@
#!/usr/bin/env python3
# pylint: disable=C0301,C0116,C0103,R0903

# Vendor : DomTrues
# Provisioned by : Coopydood

# Import Required Modules
import os
import time
from datetime import datetime
import subprocess
import re
# import json
# import sys
import argparse
import platform

version = open("./.version")
version = version.read()

enableLog = True

parser = argparse.ArgumentParser("autopilot")
parser.add_argument("--disable-logging", dest="disableLog", help="Disables the logfile",action="store_true")
parser.add_argument("-m","--mount", dest="mount", help="Immediately mount detected OC image",action="store_true")
parser.add_argument("-u","--unmount", dest="unmount", help="Immediately unmount detected OC image",action="store_true")
parser.add_argument("-q","--quiet", dest="quiet", help="Don't print any verbose information",action="store_true")

args = parser.parse_args()

global logTime
logTime = str(datetime.today().strftime('%d-%m-%Y_%H-%M-%S'))

if args.disableLog == True:
enableLog = False

if enableLog == True: # LOG SUPPORT
if not os.path.exists("./logs"):
os.system("mkdir ./logs")

logTime = str(datetime.today().strftime('%d-%m-%Y_%H-%M-%S'))
os.system("echo ULTMOS DTGE LOG "+str(datetime.today().strftime('%d-%m-%Y %H:%M:%S'))+" > ./logs/DTGE_RUN_"+logTime+".log")
os.system("echo ──────────────────────────────────────────────────────────────"+" >> ./logs/DTGE_RUN_"+logTime+".log")

def cpydLog(logStatus,logMsg,*args):
logFile = open("./logs/DTGE_RUN_"+logTime+".log","a")
#if logStatus == "ok": logStatus = "[ ✔ ]"
#if logStatus == "info": logStatus = "[ ✦ ]"
#if logStatus == "warn": logStatus = "[ ⚠ ]"
#if logStatus == "error": logStatus = "[ ✖ ]"
#if logStatus == "fatal": logStatus = "[ ☠ ]"
#if logStatus == "wait": logStatus = "[ ➜ ]"

if logStatus == "ok": logStatus = "[ OK ]"
if logStatus == "info": logStatus = "[ INFO ]"
if logStatus == "warn": logStatus = "[ WARN ]"
if logStatus == "error": logStatus = "[ ERROR ]"
if logStatus == "fatal": logStatus = "[ FATAL ]"
if logStatus == "wait": logStatus = "[ WAIT ]"
entryTime = str(datetime.today().strftime('%H:%M:%S.%f'))
entryTime = entryTime[:-3]
entryLine = ("["+entryTime+"]"+str(logStatus)+": "+str(logMsg)+"\n")
logFile.write(entryLine)
logFile.close()
else:
def cpydLog(logStatus,logMsg,*args):
None

script = "grub-args.py"
scriptName = "Grub Editor"
scriptID = "DTGE"
scriptVendor = "DomTrues"

cpydLog("info",("ULTMOS v"+version))
cpydLog("info",(" "))
cpydLog("info",("Name : "+scriptName))
cpydLog("info",("File : "+script))
cpydLog("info",("Identifier : "+scriptID))
cpydLog("info",("Vendor : "+scriptVendor))
cpydLog("info",(" "))
cpydLog("info",("Logging to ./logs/DTGE_RUN_"+logTime+".log"))


# Right, so we want to be able to check for existing boot arguments, and add other arguments at the user's discretion.
# We also want to check for what platform the user is on in order to add
# intel_iommu=on | amd_iommu=on
# iommu=pt
# pcie_acs_override=downstream,multifunction
# video=efifb:off
# vfio-pci.ids=xxxx:xxxx

# Declare method of clearing the screen the Coopydoopydoo way.
def clear():
os.system("clear")
spaces = ""
i = 0
terminal_size = os.get_terminal_size()
while i < terminal_size.lines:
spaces = spaces + "\n"
i += 1
print(spaces)

# Declare method of "Press enter to continue", like pause on Windows...
def pause():
input(" Press [ENTER] to continue...")

# Script Variables
detectchoice = 0
cpu_vendor = ""
cpu_model = ""
cpu_iommu = "intel_iommu=on"
iommu = "iommu=pt"
pcie_acs = "pcie_acs_override=downstream,multifunction"
video_efifb = "video=efifb:off"
vfio_stub = []
vfio_stub_str = ""

# Target GRUB file.
targetfile = "./grub"

# Get CPU Vendor Information
clear()
cpydLog("wait", "Getting CPU information...")
print(" Getting CPU information...")
try:
import cpuinfo
cpu_vendor = cpuinfo.get_cpu_info()['vendor_id_raw']
cpu_model = cpuinfo.get_cpu_info()['brand_raw']
except:
# If the user does not have py-cpuinfo installed, or if some other error occurs, the script will die, throwing the following error message.
print(" I was unable to gather CPU information. Do you have py-cpuinfo installed?\n")
cpydLog("fatal", "User either does not have py-cpuinfo installed, or hit CTRL-C.")
exit()

# Intel CPU
if (cpu_vendor == "GenuineIntel"):
cpydLog("info", "User is running on an Intel CPU.")
cpu_iommu = "intel_iommu=on"
# AMD CPU
elif (cpu_vendor == "AuthenticAMD"):
cpydLog("info", "User is running on an AMD CPU.")
cpu_iommu = "amd_iommu=on"
# Unsupported CPU
else:
cpydLog("fatal", "User is running on an unsupported CPU.")
print(" Your CPU is unsupported, sorry. :(")
pause()
exit()

# VFIO IDs
def vfio():
clear()
global vfio_stub
global vfio_stub_str
os.system("./scripts/vfio-ids.py")
print("\n If you wish to stub any PCI devices, input them one at a time here.")
print(" If you are done, or wish to skip this process entirely, type \"done\".\n")
print(" Current VFIO Configuration Selected: " + vfio_stub_str + "\n")
cpydLog("wait", "Awaiting user input on VFIO IDs...")
user_input = input("xxxx:xxxx> ")
if (user_input == "done"):
cpydLog("info", "User has concluded VFIO ID selection.")
if (len(vfio_stub) == 0):
vfio_stub = ""
else:
vfio_stub = vfio_stub_str
menu()
return
else:
stub_matches = re.findall("[0-9A-Fa-f]{4}:[0-9A-Fa-f]{4}", user_input)
if (len(stub_matches) <= 0 or len(stub_matches) > 1):
cpydLog("error", "User put in an invalid VFIO ID.")
vfio()
return
vfio_stub.append(str(user_input))
cpydLog("info", "User has added " + user_input + " to their VFIO stubs.")
vfio_stub_str = "vfio-pci.ids=" + (",".join(vfio_stub))
cpydLog("info", "The overall argument is currently " + vfio_stub_str)
vfio()
return


# Main Menu
def menu():
global detectchoice
global vfio_stub
os.system("grep GRUB_CMDLINE_LINUX_DEFAULT /etc/default/grub")
grubargs = os.popen('grep GRUB_CMDLINE_LINUX_DEFAULT /etc/default/grub').read()
grubargs = grubargs[28:(len(grubargs) - 2)]
clear()
print(" Welcome to \033[95mGrub Editor\033[0m")
print(" Created by \033[1mDomTrues\033[0m\n")
print(" CPU Model: \033[37m" + cpu_model + "\033[0m")
print("\n Optimal Boot Flags Based on Your System:")
print(" \033[37m" + cpu_iommu + " " + iommu + " " + video_efifb + " " + vfio_stub + "\033[0m\n")
print(" Current Boot Arguments:")

print(" \033[37m" + grubargs + "\033[0m\n")
print(" ⚠ \033[93mRequires superuser privileges.\033[0m\n")
print(" Select an option to continue.\n")
print(" 1. Add All Relevant Parameters ⚠\n")
print(" 2. Enable IOMMU ⚠\n")
print(" 3. PCIE ACS Patch (kernel support required) ⚠\n")
print(" 4. Video EFIFB Off ⚠\n")

if (vfio_stub != ""):
print(" 5. PCI Stubs ⚠\n")

print(" B. Back")
print(" M. Main Menu")
print(" Q. Quit\n")

cpydLog("wait", "Awaiting user input on main menu...")

detectchoice = input("\033[1mSelect> \033[0m")
if (detectchoice == "1"):
os.system('sudo sed -i \'s/^GRUB_CMDLINE_LINUX_DEFAULT="/&' + cpu_iommu + " " + iommu + " " + video_efifb + ' /\' /etc/default/grub')
if (vfio_stub != ""):
os.system('sudo sed -i \'s/^GRUB_CMDLINE_LINUX_DEFAULT="/&' + vfio_stub + ' /\' /etc/default/grub')
os.system("sudo grub-mkconfig -o /boot/grub/grub.cfg")
os.system("sudo grub-mkconfig -o /boot/grub/grub.cfg")
cpydLog("info", "User has added all recommended boot arguments.")
if (detectchoice == "2"):
os.system('sudo sed -i \'s/^GRUB_CMDLINE_LINUX_DEFAULT="/&' + cpu_iommu + " " + iommu + ' /\' /etc/default/grub')
os.system("sudo grub-mkconfig -o /boot/grub/grub.cfg")
os.system("sudo grub-mkconfig -o /boot/grub/grub.cfg")
cpydLog("info", "User has added base IOMMU boot arguments.")
if (detectchoice == "3"):
os.system('sudo sed -i \'s/^GRUB_CMDLINE_LINUX_DEFAULT="/&' + pcie_acs + ' /\' /etc/default/grub')
os.system("sudo grub-mkconfig -o /boot/grub/grub.cfg")
os.system("sudo grub-mkconfig -o /boot/grub/grub.cfg")
cpydLog("info", "User has added the PCIE ACS patch boot argument.")
if (detectchoice == "4"):
os.system('sudo sed -i \'s/^GRUB_CMDLINE_LINUX_DEFAULT="/&' + video_efifb + ' /\' /etc/default/grub')
os.system("sudo grub-mkconfig -o /boot/grub/grub.cfg")
os.system("sudo grub-mkconfig -o /boot/grub/grub.cfg")
cpydLog("info", "User has added the Video EFIFB Off boot argument.")
if (detectchoice == "5" and vfio_stub != ""):
os.system('sudo sed -i \'s/^GRUB_CMDLINE_LINUX_DEFAULT="/&' + vfio_stub + ' /\' /etc/default/grub')
os.system("sudo grub-mkconfig -o /boot/grub/grub.cfg")
os.system("sudo grub-mkconfig -o /boot/grub/grub.cfg")
cpydLog("info", "User has added VFIO PCI stubbing to the boot arguments.")
if (detectchoice == "B"):
clear()
cpydLog("info", "User has returned to VFIO menu.")
vfio_stub = []
vfio()
if (detectchoice == "Q"):
clear()
cpydLog("info", "User has exited the script.")
exit()
if (detectchoice == "M"):
clear()
cpydLog("info", "User has returned to ULTMOS extras menu.")
os.system("./scripts/extras.py")
menu()

vfio()
6 changes: 5 additions & 1 deletion scripts/extras.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def startup():
print(color.END+" 4. VFIO-PCI tools...")
print(color.END+" 5. OpenCore configuration assistant...")
print(color.END+" 6. Boot Argument Editor...")
print(color.END+" 7. Grub Argument Editor...")
print(color.RED+" R. Restore tools...")
print(color.END+" I. Report an issue...")
print(color.END+" B. Back...")
Expand All @@ -82,6 +83,7 @@ def startup():
print(color.END+" 4. VFIO-PCI tools...")
print(color.END+" 5. OpenCore configuration assistant...")
print(color.END+" 6. Boot Argument Editor...")
print(color.END+" 7. Grub Argument Editor...")
print(color.RED+" R. Restore tools...")
print(color.END+" I. Report an issue...")
print(color.END+" B. Back...")
Expand Down Expand Up @@ -143,6 +145,8 @@ def clear(): print("\n" * 150)
os.system('./scripts/domtrues/nbdassistant.py')
elif detectChoice == "6":
os.system('./scripts/extras/boot-args.py')
elif detectChoice == "7":
os.system('./scripts/domtrues/grub-args.py')

elif detectChoice == "i" or detectChoice == "I":

Expand All @@ -160,4 +164,4 @@ def clear(): print("\n" * 150)
elif detectChoice == "b" or detectChoice == "B":
os.system('./main.py')
elif detectChoice == "q" or detectChoice == "Q":
exit
exit

0 comments on commit 0c72882

Please sign in to comment.