'--model' option can now be given multiple times

This commit is contained in:
Timothy Sutton 2013-09-24 20:12:19 -04:00
parent ca5d10895d
commit 845a8d72c3

View file

@ -109,8 +109,10 @@ def main():
scriptdir = os.path.abspath(os.path.dirname(sys.argv[0])) scriptdir = os.path.abspath(os.path.dirname(sys.argv[0]))
o = optparse.OptionParser() o = optparse.OptionParser()
o.add_option('-m', '--model', help="System model identifier to use \ o.add_option('-m', '--model', action="append",
(otherwise this machine's model is used).") help="System model identifier to use (otherwise this machine's \
model is used). This can be specified multiple times to download \
multiple models in a single run.")
o.add_option('-i', '--install', action="store_true", o.add_option('-i', '--install', action="store_true",
help="After the installer is downloaded, perform the install automatically. \ help="After the installer is downloaded, perform the install automatically. \
Can be used on Windows only.") Can be used on Windows only.")
@ -148,11 +150,15 @@ when running the installer out of 'system32'." % output_dir)
if opts.install: if opts.install:
status("Ignoring '--model' when '--install' is used. The Boot Camp " status("Ignoring '--model' when '--install' is used. The Boot Camp "
"installer won't allow other models to be installed, anyway.") "installer won't allow other models to be installed, anyway.")
model = opts.model models = opts.model
else: else:
model = getMachineModel() models = [getMachineModel()]
status("Using Mac model '%s'." % model) if len(models) > 1:
status("Using Mac models: %s." % ', '.join(models))
else:
status("Using Mac model: %s." % ', '.join(models))
for model in models:
sucatalog_url = SUCATALOG_URL sucatalog_url = SUCATALOG_URL
# check if we defined anything in brigadier.plist # check if we defined anything in brigadier.plist
config_plist = None config_plist = None
@ -290,7 +296,6 @@ when running the installer out of 'system32'." % output_dir)
subprocess.call(['cmd', '/c', 'rmdir', '/q', '/s', arc_workdir]) subprocess.call(['cmd', '/c', 'rmdir', '/q', '/s', arc_workdir])
elif platform.system() == 'Darwin': elif platform.system() == 'Darwin':
status("Expanding flat package...") status("Expanding flat package...")
subprocess.call(['/usr/sbin/pkgutil', '--expand', pkg_dl_path, subprocess.call(['/usr/sbin/pkgutil', '--expand', pkg_dl_path,