diff --git a/CHANGELOG.md b/CHANGELOG.md index 979acf3..aa6ac1f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ No date 14.12.2022 -- Better handling of replacing broken sparseimage files. If `--overwrite`, `--update`, or `--replace-invalid` are used and the version cannot be obtained from the sparseimage, the installer should be downloaded again. Note: I now recommend to always use `--move` if not using `--pkg` or `--fetch-full-installer`. +- Better handling of replacing broken sparseimage files. If `--overwrite`, `--update`, or `--replace-invalid` are used and the version cannot be obtained from the sparseimage, the installer should be downloaded again. This also fixes `--overwrite` where an existing sparseimage is present. - Add `--no-timeout` option which extends the timeout period to 24h. ## [27.1] diff --git a/erase-install.sh b/erase-install.sh index 5569ad4..4d42001 100755 --- a/erase-install.sh +++ b/erase-install.sh @@ -2256,11 +2256,7 @@ echo " [$script_name] Looking for existing installer app or pkg" find_existing_installer # Work through various options to decide whether to replace an existing installer -if [[ $overwrite == "yes" && -d "$working_macos_app" && ! $list ]]; then - # --overwrite option - overwrite_existing_installer - -elif [[ $overwrite == "yes" && -f "$working_installer_pkg" && ! $list ]]; then +if [[ $overwrite == "yes" && -f "$working_installer_pkg" && ! $list ]]; then # --overwrite option and --pkg option echo " [$script_name] Overwriting existing installer package" rm -f "$working_installer_pkg" @@ -2271,6 +2267,10 @@ elif [[ $overwrite == "yes" && -f "$working_installer_pkg" && ! $list ]]; then exit fi +elif [[ $overwrite == "yes" && ! $list ]]; then + # --overwrite option + overwrite_existing_installer + elif [[ $invalid_installer_found == "yes" ]]; then # --replace-invalid option: replace an existing installer if it is invalid if [[ ($pkg_installer && ! -f "$working_installer_pkg") && ($replace_invalid_installer == "yes" || $update_installer == "yes") ]]; then