Describe the bug
When the --os option is used, and a valid installer is already on the system, it will not be used and instead a new installer is downloaded. This happens because the build of the current system is compared to the build of the cached installer, instead of comparing the build of the latest available installer to the build of the cached installer.
To Reproduce
On a computer that is not yet on OS12, run sudo /Library/Management/erase-install/erase-install.sh --os=12 --update and it will download a new installer. Run it again and a new installer will be downloaded, instead of using the one that was just cached.
Expected behavior
A new installer should not be downloaded if the cached installer is valid.
Code/log output
[find_existing_installer] Installer sparse image found at /Library/Management/erase-install/Install_macOS_12.6-21G115.sparseimage.
[check_installer_is_valid] Checking validity of /Volumes/Install_macOS_12.6-21G115/Applications/Install macOS Monterey.app.
[check_installer_is_valid] Mounting /Volumes/Install_macOS_12.6-21G115/Applications/Install macOS Monterey.app/Contents/SharedSupport/SharedSupport.dmg
[check_installer_is_valid] Using Build value from com_apple_MobileAsset_MacSoftwareUpdate.xml
Volume Shared Support on disk8s2 force-unmounted
[compare_build_versions] Comparing (1) 18G103 with (2) 21G115
[check_installer_is_valid] Installer: 21G115 >= System: 18G103 : valid build.
[erase-install] Existing installer does not match requested version, so replacing...
Screenshots
Environment (please complete the following information):
erase-install version 26.2 or 27
Additional context
This bug does not exist when --build is used.
It looks like with --os, it cannot pass this line successfully elif [[ "$prechosen_os" != "" && "$os_matches" != "yes" ]]
I believe this may have been addressed in my latest commit. Please try the latest pre-release package for v27.0 or the latest script in the v27.0 branch.
Describe the bug When the --os option is used, and a valid installer is already on the system, it will not be used and instead a new installer is downloaded. This happens because the build of the current system is compared to the build of the cached installer, instead of comparing the build of the latest available installer to the build of the cached installer.
To Reproduce On a computer that is not yet on OS12, run
sudo /Library/Management/erase-install/erase-install.sh --os=12 --update
and it will download a new installer. Run it again and a new installer will be downloaded, instead of using the one that was just cached.Expected behavior A new installer should not be downloaded if the cached installer is valid.
Code/log output
Screenshots
Environment (please complete the following information):
Additional context This bug does not exist when --build is used. It looks like with --os, it cannot pass this line successfully
elif [[ "$prechosen_os" != "" && "$os_matches" != "yes" ]]