mirror of
https://github.com/grahampugh/macadmin-scripts.git
synced 2025-12-18 02:06:26 +00:00
Added --displayonly and --build arguments
This commit is contained in:
parent
b77c891090
commit
08be237453
@ -329,6 +329,7 @@ def replicate_product(catalog, product_id, workdir, ignore_cache=False):
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
'''Do the main thing here'''
|
'''Do the main thing here'''
|
||||||
|
|
||||||
if os.getuid() != 0:
|
if os.getuid() != 0:
|
||||||
sys.exit('This command requires root (to install packages), so please '
|
sys.exit('This command requires root (to install packages), so please '
|
||||||
'run again with sudo or as root.')
|
'run again with sudo or as root.')
|
||||||
@ -347,6 +348,12 @@ def main():
|
|||||||
'the Install macOS app at the root.')
|
'the Install macOS app at the root.')
|
||||||
parser.add_argument('--ignore-cache', action='store_true',
|
parser.add_argument('--ignore-cache', action='store_true',
|
||||||
help='Ignore any previously cached files.')
|
help='Ignore any previously cached files.')
|
||||||
|
parser.add_argument('--build', metavar='build_version',
|
||||||
|
default='',
|
||||||
|
help='Specify a specific build to search for and '
|
||||||
|
'download.')
|
||||||
|
parser.add_argument('--displayonly', action='store_true',
|
||||||
|
help='Output the available updates and quit.')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
# download sucatalog and look for products that are for macOS installers
|
# download sucatalog and look for products that are for macOS installers
|
||||||
@ -360,6 +367,8 @@ def main():
|
|||||||
'No macOS installer products found in the sucatalog.')
|
'No macOS installer products found in the sucatalog.')
|
||||||
exit(-1)
|
exit(-1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# display a menu of choices (some seed catalogs have multiple installers)
|
# display a menu of choices (some seed catalogs have multiple installers)
|
||||||
print '%2s %12s %10s %8s %s' % ('#', 'ProductID', 'Version',
|
print '%2s %12s %10s %8s %s' % ('#', 'ProductID', 'Version',
|
||||||
'Build', 'Title')
|
'Build', 'Title')
|
||||||
@ -370,6 +379,18 @@ def main():
|
|||||||
product_info[product_id]['BUILD'],
|
product_info[product_id]['BUILD'],
|
||||||
product_info[product_id]['title'])
|
product_info[product_id]['title'])
|
||||||
|
|
||||||
|
# Quit now if displaynonly argument supplied
|
||||||
|
if args.displayonly:
|
||||||
|
exit(0)
|
||||||
|
|
||||||
|
# check for specified build if argument supplied
|
||||||
|
if args.build:
|
||||||
|
for index, product_id in enumerate(product_info):
|
||||||
|
if args.build == product_info[product_id]['BUILD']:
|
||||||
|
answer = index+1
|
||||||
|
print '# %s chosen.' % answer
|
||||||
|
|
||||||
|
if not answer:
|
||||||
answer = raw_input(
|
answer = raw_input(
|
||||||
'\nChoose a product to download (1-%s): ' % len(product_info))
|
'\nChoose a product to download (1-%s): ' % len(product_info))
|
||||||
try:
|
try:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user