grahampugh / erase-install

A script that automates downloading macOS installers, and optionally erasing or upgrading macOS in a single process. Watch the video!
https://grahamrpugh.com/2023/05/14/macaduk-presentation-eraseinstall.html
Apache License 2.0
848 stars 134 forks source link

[BUG] update flag not working correctly #532

Closed awjohnso closed 1 week ago

awjohnso commented 2 weeks ago

Describe the bug

Running /Library/Management/erase-install/erase-install.sh --os 14 --pkg --update to cache the installer pkg, works fine when there is no cached installer pre4sent.

However when there is an older cached installer it does not replace it.

To Reproduce /Library/Management/erase-install/erase-install.sh --os 14 --pkg --update after an older cached package is on the system. The command was run from the Terminal

Expected behavior Expected older OS package to be replaced with the latest one, in this case 14.7 to be replaced with 14.7.1.

Code/log output

/Library/Management/erase-install/erase-install.sh --os 14 --pkg --update
2024-11-07 11:42:23 | v36.0 | [log_rotate] Finished rotating logs in /Library/Management/erase-install/log

2024-11-07 11:42:23 | v36.0 | [erase-install] v36.0 script execution started: Thu Nov  7 11:42:23 EST 2024

2024-11-07 11:42:23 | v36.0 | [erase-install] Arguments provided: --os 14 --pkg --update
2024-11-07 11:42:23 | v36.0 | [set_localisations] Set language to en-US
2024-11-07 11:42:23 | v36.0 | [erase-install] System version: 14.7 (Build: 23H124)
2024-11-07 11:42:23 | v36.0 | [check_for_swiftdialog_app] swiftDialog v2.5.2.4777 is installed (/Library/Application Support/Dialog/Dialog.app)
2024-11-07 11:42:23 | v36.0 | [check_for_swiftdialog_app] Creating dialog log (/var/tmp/dialog.54c)...
2024-11-07 11:42:23 | v36.0 | [erase-install] Caffeinating this script (pid=59311)
2024-11-07 11:42:23 | v36.0 | [erase-install] Looking for existing installer app or pkg
2024-11-07 11:42:23 | v36.0 | [find_existing_installer] InstallAssistant package found at /Library/Management/erase-install/InstallAssistant-14.7-23H124.pkg.
2024-11-07 11:42:23 | v36.0 | [check_installer_pkg_is_valid] Checking validity of /Library/Management/erase-install/InstallAssistant-14.7-23H124.pkg.
2024-11-07 11:42:23 | v36.0 | [check_installer_pkg_is_valid] Installer: 23H124 >= System: 23H124 : valid build.
2024-11-07 11:42:23 | v36.0 | [erase-install] Checking for newer installer
2024-11-07 11:42:23 | v36.0 | [check_for_mist] mist-cli v2.1.1 is installed (/usr/local/bin/mist)
2024-11-07 11:42:23 | v36.0 | [check_newer_available] Restricting to selected OS '14'
┌──────────────────┐
│ INPUT VALIDATION │
└──────────────────┘
  ├─ List search string will be 'Sonoma'...
  ├─ Search only for latest (first) result will be 'true'...
  ├─ Include betas in search results will be 'false'...
  ├─ Only include compatible installers will be 'true'...
  ├─ Export path will be '/Library/Management/erase-install/mist-list.json'...
  ├─ Export path file extension is valid...
  ├─ Output type will be 'ascii'...
┌────────┐
│ SEARCH │
└────────┘
  ├─ Searching for macOS Installer versions...
  ├─ Exported list as JSON: '/Library/Management/erase-install/mist-list.json'
  └─ Found 1 macOS Installer(s) available for download

┌────────────┬──────────────┬─────────┬────────┬──────────┬────────────┬────────────┐
│ IDENTIFIER │ NAME         │ VERSION │ BUILD  │ SIZE     │ DATE       │ COMPATIBLE │
├────────────┼──────────────┼─────────┼────────┼──────────┼────────────┼────────────┤
│ 072-09041  │ macOS Sonoma │ 14.7.1  │ 23H222 │ 13.67 GB │ 2024-11-04 │ True       │
└────────────┴──────────────┴─────────┴────────┴──────────┴────────────┴────────────┘

Comparing latest build found (23H222) with cached pkg installer build (23H124)
2024-11-07 11:42:24 | v36.0 | [check_newer_available] No newer builds found
2024-11-07 11:42:24 | v36.0 | [erase-install] Running on architecture arm64
2024-11-07 11:42:24 | v36.0 | [erase-install] Sending quit message to dialog log (/var/tmp/dialog.54c)
2024-11-07 11:42:24 | v36.0 | [erase-install] Cleaning working directory '/Library/Management/erase-install/content'

2024-11-07 11:42:24 | v36.0 | [erase-install] terminating the process 'caffeinate' process

2024-11-07 11:42:24 | v36.0 | [finish] Script exit code: 0

Environment (please complete the following information):

Additional context Add any other context about the problem here.

grahampugh commented 1 week ago

This should be addressed in the latest push of 36.1 that I just made (https://github.com/grahampugh/erase-install/commit/7dae27fdb15391a908e5d8cab345d40cab4fce00).