Enable fetch-macOS-v2.py to run in unattended mode (via shortnames)
This commit is contained in:
parent
a9ef589cc2
commit
9e23a98894
2 changed files with 28 additions and 13 deletions
3
Makefile
3
Makefile
|
@ -1,3 +1,4 @@
|
||||||
|
# export SHORTNAME=monterey
|
||||||
DISK_SIZE := 128G
|
DISK_SIZE := 128G
|
||||||
|
|
||||||
all: BaseSystem.img mac_hdd_ng.img
|
all: BaseSystem.img mac_hdd_ng.img
|
||||||
|
@ -6,7 +7,7 @@ BaseSystem.img: BaseSystem.dmg
|
||||||
qemu-img convert BaseSystem.dmg -O raw BaseSystem.img
|
qemu-img convert BaseSystem.dmg -O raw BaseSystem.img
|
||||||
|
|
||||||
BaseSystem.dmg:
|
BaseSystem.dmg:
|
||||||
./fetch-macOS-v2.py
|
./fetch-macOS-v2.py --short=$(SHORTNAME)
|
||||||
|
|
||||||
mac_hdd_ng.img:
|
mac_hdd_ng.img:
|
||||||
qemu-img create -f qcow2 mac_hdd_ng.img ${DISK_SIZE}
|
qemu-img create -f qcow2 mac_hdd_ng.img ${DISK_SIZE}
|
||||||
|
|
|
@ -433,6 +433,8 @@ def main():
|
||||||
parser.add_argument('-os', '--os-type', type=str, default='default', choices=['default', 'latest'],
|
parser.add_argument('-os', '--os-type', type=str, default='default', choices=['default', 'latest'],
|
||||||
help='use specified os type, defaults to default ' + MLB_ZERO)
|
help='use specified os type, defaults to default ' + MLB_ZERO)
|
||||||
parser.add_argument('-diag', '--diagnostics', action='store_true', help='download diagnostics image')
|
parser.add_argument('-diag', '--diagnostics', action='store_true', help='download diagnostics image')
|
||||||
|
parser.add_argument('-s', '--shortname', type=str, default='',
|
||||||
|
help='available options: high-sierra, mojave, catalina, big-sur, monterey')
|
||||||
parser.add_argument('-v', '--verbose', action='store_true', help='print debug information')
|
parser.add_argument('-v', '--verbose', action='store_true', help='print debug information')
|
||||||
parser.add_argument('-db', '--board-db', type=str, default=os.path.join(SELF_DIR, 'boards.json'),
|
parser.add_argument('-db', '--board-db', type=str, default=os.path.join(SELF_DIR, 'boards.json'),
|
||||||
help='use custom board list for checking, defaults to boards.json')
|
help='use custom board list for checking, defaults to boards.json')
|
||||||
|
@ -458,17 +460,19 @@ def main():
|
||||||
# No action specified, so present a download menu instead
|
# No action specified, so present a download menu instead
|
||||||
# https://github.com/acidanthera/OpenCorePkg/blob/master/Utilities/macrecovery/boards.json
|
# https://github.com/acidanthera/OpenCorePkg/blob/master/Utilities/macrecovery/boards.json
|
||||||
products = [
|
products = [
|
||||||
{"name": "High Sierra (10.13)", "b": "Mac-7BA5B2D9E42DDD94", "m": "00000000000J80300"},
|
{"name": "High Sierra (10.13)", "b": "Mac-7BA5B2D9E42DDD94", "m": "00000000000J80300", "short": "high-sierra"},
|
||||||
{"name": "Mojave (10.14)", "b": "Mac-7BA5B2DFE22DDD8C", "m": "00000000000KXPG00"},
|
{"name": "Mojave (10.14)", "b": "Mac-7BA5B2DFE22DDD8C", "m": "00000000000KXPG00", "short": "mojave"},
|
||||||
{"name": "Catalina (10.15)", "b": "Mac-00BE6ED71E35EB86", "m": "00000000000000000"},
|
{"name": "Catalina (10.15)", "b": "Mac-00BE6ED71E35EB86", "m": "00000000000000000", "short": "catalina"},
|
||||||
{"name": "Big Sur (11.6) - RECOMMENDED", "b": "Mac-2BD1B31983FE1663", "m": "00000000000000000"},
|
{"name": "Big Sur (11.6) - RECOMMENDED", "b": "Mac-2BD1B31983FE1663", "m": "00000000000000000", "short": "big-sur"},
|
||||||
{"name": "Monterey (latest)", "b": "Mac-7BA5B2D9E42DDD94", "m": "00000000000000000", "os_type": "latest"}
|
{"name": "Monterey (latest)", "b": "Mac-7BA5B2D9E42DDD94", "m": "00000000000000000", "os_type": "latest", "short": "monterey"}
|
||||||
]
|
]
|
||||||
|
|
||||||
for index, product in enumerate(products):
|
for index, product in enumerate(products):
|
||||||
name = product["name"]
|
name = product["name"]
|
||||||
print('%s. %12s' % (index + 1, name))
|
print('%s. %12s' % (index + 1, name))
|
||||||
|
|
||||||
|
# test locally using args.shortname = 'mojave'
|
||||||
|
if not args.shortname or args.shortname == '':
|
||||||
answer = input('\nChoose a product to download (1-%s): ' % len(products))
|
answer = input('\nChoose a product to download (1-%s): ' % len(products))
|
||||||
try:
|
try:
|
||||||
index = int(answer) - 1
|
index = int(answer) - 1
|
||||||
|
@ -476,9 +480,19 @@ def main():
|
||||||
raise ValueError
|
raise ValueError
|
||||||
except (ValueError, IndexError):
|
except (ValueError, IndexError):
|
||||||
pass
|
pass
|
||||||
|
else:
|
||||||
|
index = 0
|
||||||
|
for product in products:
|
||||||
|
if args.shortname == product['short']:
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
index = index+1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# action
|
# action
|
||||||
product = products[index]
|
product = products[index]
|
||||||
|
print(product['name'])
|
||||||
try:
|
try:
|
||||||
os_type = product["os_type"]
|
os_type = product["os_type"]
|
||||||
except:
|
except:
|
||||||
|
|
Loading…
Reference in a new issue