mirror of https://github.com/kholia/OSX-KVM.git
fetch-macOS-v2.py will automatically set the CPU type in each shell script, and xml libvirt config (with the string 'libvirt' in its file name)
This commit is contained in:
parent
16eb2b142e
commit
1e12026c2e
|
@ -17,6 +17,7 @@ pylint -> Your code has been rated at -0.08/10 ;(
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import binascii
|
import binascii
|
||||||
|
import glob
|
||||||
import hashlib
|
import hashlib
|
||||||
import json
|
import json
|
||||||
import linecache
|
import linecache
|
||||||
|
@ -469,6 +470,31 @@ def action_guess(args):
|
||||||
print(f'UNKNOWN: Failed to determine supported models for MLB {mlb}!')
|
print(f'UNKNOWN: Failed to determine supported models for MLB {mlb}!')
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def update_cpu(inputfile,product):
|
||||||
|
""" set the cpu type in the chosen file for Sonoma """
|
||||||
|
ocscript = inputfile
|
||||||
|
if product == 'sonoma':
|
||||||
|
newtype = "Haswell-noTSX"
|
||||||
|
oldtype = "Penryn"
|
||||||
|
else:
|
||||||
|
newtype = "Penryn"
|
||||||
|
oldtype = "Haswell-noTSX"
|
||||||
|
f = open(ocscript,'r')
|
||||||
|
filedata = f.read()
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
newdata = filedata.replace(oldtype,newtype)
|
||||||
|
|
||||||
|
f = open(ocscript,'w')
|
||||||
|
f.write(newdata)
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
def update_scripts(product):
|
||||||
|
""" update the cpu type in supporting scripts for Sonoma """
|
||||||
|
for bash_script in glob.iglob('**/*.sh', recursive=True):
|
||||||
|
update_cpu(bash_script,product)
|
||||||
|
for libvirt_config in glob.iglob('**/*libvirt*.xml', recursive=True):
|
||||||
|
update_cpu(libvirt_config,product)
|
||||||
|
|
||||||
# https://stackoverflow.com/questions/2280334/shortest-way-of-creating-an-object-with-arbitrary-attributes-in-python
|
# https://stackoverflow.com/questions/2280334/shortest-way-of-creating-an-object-with-arbitrary-attributes-in-python
|
||||||
class gdata:
|
class gdata:
|
||||||
|
@ -558,7 +584,17 @@ def main():
|
||||||
os_type = "default"
|
os_type = "default"
|
||||||
args = gdata(mlb = product["m"], board_id = product["b"], diagnostics =
|
args = gdata(mlb = product["m"], board_id = product["b"], diagnostics =
|
||||||
False, os_type = os_type, verbose=False, basename="", outdir=".")
|
False, os_type = os_type, verbose=False, basename="", outdir=".")
|
||||||
action_download(args)
|
update_scripts(product['short'])
|
||||||
|
# if product['short'] == 'sonoma':
|
||||||
|
# with open("OpenCore-Boot.sh", "w") as OCScript:
|
||||||
|
# scriptdata = OCScript.read()
|
||||||
|
# scriptdata = scriptdata.replace('Penryn', 'Haswell-noTSX')
|
||||||
|
# with open('OpenCore-Boot.sh', 'w') as OCScript:
|
||||||
|
# OCScript.write(scriptdata)
|
||||||
|
# else:
|
||||||
|
# with open("Output.txt", "w") as text_file:
|
||||||
|
# text_file.write('DERP')
|
||||||
|
#action_download(args)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
Loading…
Reference in New Issue