From fa22d97c9bd4d5de4b62e18bed3a975dcb2cd65a Mon Sep 17 00:00:00 2001 From: aysiu Date: Tue, 24 Mar 2020 18:57:01 -0700 Subject: [PATCH 1/6] 9GB sparse disk image to accommodate 10.15.4 Addresses this issue: https://github.com/munki/macadmin-scripts/issues/46 --- installinstallmacos.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installinstallmacos.py b/installinstallmacos.py index 5b63bbb..a9159fe 100755 --- a/installinstallmacos.py +++ b/installinstallmacos.py @@ -128,7 +128,7 @@ def get_default_catalog(): def make_sparse_image(volume_name, output_path): '''Make a sparse disk image we can install a product to''' - cmd = ['/usr/bin/hdiutil', 'create', '-size', '8g', '-fs', 'HFS+', + cmd = ['/usr/bin/hdiutil', 'create', '-size', '9g', '-fs', 'HFS+', '-volname', volume_name, '-type', 'SPARSE', '-plist', output_path] try: output = subprocess.check_output(cmd) From 06c8d371e636ee8864c8dacc1e3a8082121b1c35 Mon Sep 17 00:00:00 2001 From: Brian Call <6537446+call@users.noreply.github.com> Date: Mon, 30 Mar 2020 19:39:34 -0700 Subject: [PATCH 2/6] Remove errant whitespace --- installinstallmacos.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installinstallmacos.py b/installinstallmacos.py index a9159fe..536fcf0 100755 --- a/installinstallmacos.py +++ b/installinstallmacos.py @@ -490,7 +490,7 @@ def main(): if os.getuid() != 0: sys.exit('This command requires root (to install packages), so please ' 'run again with sudo or as root.') - + if args.catalogurl: su_catalog_url = args.catalogurl elif args.seedprogram: From d4860447b3f401ec8505c30641deb476a236dd3c Mon Sep 17 00:00:00 2001 From: Greg Neagle Date: Wed, 27 May 2020 11:07:29 -0700 Subject: [PATCH 3/6] Bump sparseimage size to 16g; eliminate extra whitespace --- installinstallmacos.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installinstallmacos.py b/installinstallmacos.py index 536fcf0..360ea48 100755 --- a/installinstallmacos.py +++ b/installinstallmacos.py @@ -128,7 +128,7 @@ def get_default_catalog(): def make_sparse_image(volume_name, output_path): '''Make a sparse disk image we can install a product to''' - cmd = ['/usr/bin/hdiutil', 'create', '-size', '9g', '-fs', 'HFS+', + cmd = ['/usr/bin/hdiutil', 'create', '-size', '16g', '-fs', 'HFS+', '-volname', volume_name, '-type', 'SPARSE', '-plist', output_path] try: output = subprocess.check_output(cmd) From e27cd94c071a529102c89302a1b53102ca014526 Mon Sep 17 00:00:00 2001 From: Greg Neagle Date: Wed, 27 May 2020 14:15:55 -0700 Subject: [PATCH 4/6] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 157199f..1975369 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,9 @@ Command '['/usr/sbin/installer', '-pkg', './content/downloads/07/20/091-95774/aw Product installation failed. ``` -Use a compatible Mac or select a different build compatible with your current hardware and try again. You may also have success running the script in a VM; the InstallationCheck script in versions of the macOS installer to date skips the checks (and returns success) when run on a VM. +Use a compatible Mac or select a different build compatible with your current hardware and try again. You may also have success running the script in a VM; the InstallationCheck script in versions of the macOS installer to date skips the checks (and returns success) when run on a VM. + +Catalina privacy protections might interfere with the operation of this tool if you run it from ~/Desktop, ~/Documents, ~/Downloads or other directories protected in Catalina. Consider using /Users/Shared (or subdirectory) as the "working space" for this tool. Graham Pugh has a fork with a lot more features and bells and whistles. Check it out if your needs aren't met by this tool. https://github.com/grahampugh/macadmin-scripts From 9f9ec905e807e73149ce78a08ab5a02786d25a4a Mon Sep 17 00:00:00 2001 From: Greg Neagle Date: Thu, 28 May 2020 07:56:51 -0700 Subject: [PATCH 5/6] Catch IOError exception when trying to read the SeedCatalogs.plist; print any errors around SeedCatalogs.plist access to stderr. --- installinstallmacos.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/installinstallmacos.py b/installinstallmacos.py index 360ea48..4964554 100755 --- a/installinstallmacos.py +++ b/installinstallmacos.py @@ -98,7 +98,8 @@ def get_seeding_program(sucatalog_url): if sucatalog_url == value: return key return '' - except (OSError, ExpatError, AttributeError, KeyError): + except (OSError, IOError, ExpatError, AttributeError, KeyError) as err: + print(err, file=sys.stderr) return '' @@ -107,7 +108,8 @@ def get_seed_catalog(seedname='DeveloperSeed'): try: seed_catalogs = read_plist(SEED_CATALOGS_PLIST) return seed_catalogs.get(seedname) - except (OSError, ExpatError, AttributeError, KeyError): + except (OSError, IOError, ExpatError, AttributeError, KeyError) as err: + print(err, file=sys.stderr) return '' @@ -116,7 +118,8 @@ def get_seeding_programs(): try: seed_catalogs = read_plist(SEED_CATALOGS_PLIST) return list(seed_catalogs.keys()) - except (OSError, ExpatError, AttributeError, KeyError): + except (OSError, IOError, ExpatError, AttributeError, KeyError) as err: + print(err, file=sys.stderr) return '' From 409ea6c9a958e2450625ebdf07945afb24ab0be0 Mon Sep 17 00:00:00 2001 From: Greg Neagle Date: Mon, 22 Jun 2020 16:25:01 -0700 Subject: [PATCH 6/6] Properly parse sucatalogs for Big Sur beta installer --- installinstallmacos.py | 54 ++++++++++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 21 deletions(-) diff --git a/installinstallmacos.py b/installinstallmacos.py index 4964554..47c4571 100755 --- a/installinstallmacos.py +++ b/installinstallmacos.py @@ -312,7 +312,7 @@ def get_server_metadata(catalog, product_key, workdir, ignore_cache=False): print('Could not replicate %s: %s' % (url, err), file=sys.stderr) return None except KeyError: - print('Malformed catalog.', file=sys.stderr) + #print('Malformed catalog.', file=sys.stderr) return None @@ -329,6 +329,10 @@ def parse_dist(filename): print('Error reading %s: %s' % (filename, err), file=sys.stderr) return dist_info + titles = dom.getElementsByTagName('title') + if titles: + dist_info['title_from_dist'] = titles[0].firstChild.wholeText + auxinfos = dom.getElementsByTagName('auxinfo') if not auxinfos: return dist_info @@ -392,8 +396,7 @@ def find_mac_os_installers(catalog): product = catalog['Products'][product_key] try: if product['ExtendedMetaInfo'][ - 'InstallAssistantPackageIdentifiers'][ - 'OSInstall'] == 'com.apple.mpkg.OSInstall': + 'InstallAssistantPackageIdentifiers']: mac_os_installer_products.append(product_key) except KeyError: continue @@ -409,21 +412,30 @@ def os_installer_product_info(catalog, workdir, ignore_cache=False): filename = get_server_metadata(catalog, product_key, workdir) if filename: product_info[product_key] = parse_server_metadata(filename) - product = catalog['Products'][product_key] - product_info[product_key]['PostDate'] = product['PostDate'] - distributions = product['Distributions'] - dist_url = distributions.get('English') or distributions.get('en') - try: - dist_path = replicate_url( - dist_url, root_dir=workdir, ignore_cache=ignore_cache) - except ReplicationError as err: - print('Could not replicate %s: %s' % (dist_url, err), - file=sys.stderr) - else: - dist_info = parse_dist(dist_path) - product_info[product_key]['DistributionPath'] = dist_path - product_info[product_key].update(dist_info) + else: + print('No server metadata for %s' % product_key) + product_info[product_key]['title'] = None + product_info[product_key]['version'] = None + product = catalog['Products'][product_key] + product_info[product_key]['PostDate'] = product['PostDate'] + distributions = product['Distributions'] + dist_url = distributions.get('English') or distributions.get('en') + try: + dist_path = replicate_url( + dist_url, root_dir=workdir, ignore_cache=ignore_cache) + except ReplicationError as err: + print('Could not replicate %s: %s' % (dist_url, err), + file=sys.stderr) + else: + dist_info = parse_dist(dist_path) + product_info[product_key]['DistributionPath'] = dist_path + product_info[product_key].update(dist_info) + if not product_info[product_key]['title']: + product_info[product_key]['title'] = dist_info.get('title_from_dist') + if not product_info[product_key]['version']: + product_info[product_key]['version'] = dist_info.get('VERSION') + return product_info @@ -523,14 +535,14 @@ def main(): exit(-1) # display a menu of choices (some seed catalogs have multiple installers) - print('%2s %12s %10s %8s %11s %s' + print('%2s %14s %10s %8s %11s %s' % ('#', 'ProductID', 'Version', 'Build', 'Post Date', 'Title')) for index, product_id in enumerate(product_info): - print('%2s %12s %10s %8s %11s %s' % ( + print('%2s %14s %10s %8s %11s %s' % ( index + 1, product_id, - product_info[product_id]['version'], - product_info[product_id]['BUILD'], + product_info[product_id].get('version', 'UNKNOWN'), + product_info[product_id].get('BUILD', 'UNKNOWN'), product_info[product_id]['PostDate'].strftime('%Y-%m-%d'), product_info[product_id]['title'] ))