Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solution for issue #12 #13

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions erase-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ show_help() {
exit
}

macos_vers() {
IFS='.' read -r major minor revision < <(sw_vers -productVersion)
}

find_existing_installer() {
installer_app=$( find "$installer_directory/"*macOS*.app -maxdepth 1 -type d -print -quit 2>/dev/null )
# Search for an existing download
Expand All @@ -83,11 +87,11 @@ find_existing_installer() {
echo " [find_existing_installer] Installer found at $installer_app."
# check installer validity
installer_version=$( /usr/bin/defaults read "$installer_app/Contents/Info.plist" DTPlatformVersion | sed 's|10\.||')
installed_version=$( /usr/bin/sw_vers | grep ProductVersion | awk '{ print $NF }' | sed 's|10\.||')
if [[ $installer_version -lt $installed_version ]]; then
echo " [find_existing_installer] 10.$installer_version < 10.$installed_version so not valid."
macos_vers
if [[ $installer_version -lt $macos_vers ]]; then
echo " [find_existing_installer] 10.$installer_version < 10.$macos_vers so not valid."
else
echo " [find_existing_installer] 10.$installer_version >= 10.$installed_version so valid."
echo " [find_existing_installer] 10.$installer_version >= 10.$macos_vers so valid."
installmacOSApp="$installer_app"
app_is_in_applications_folder="yes"
fi
Expand Down