diff --git a/erase-install.sh b/erase-install.sh index 756e3fa..e1efc40 100755 --- a/erase-install.sh +++ b/erase-install.sh @@ -40,7 +40,7 @@ script_name="erase-install" pkg_label="com.github.grahampugh.erase-install" # Version of this script -version="28.0b2" +version="28.0" # Directory in which to place the macOS installer. Overridden with --path installer_directory="/Applications" diff --git a/pkg/erase-install/build-info.plist b/pkg/erase-install/build-info.plist index 44b93a5..9913194 100644 --- a/pkg/erase-install/build-info.plist +++ b/pkg/erase-install/build-info.plist @@ -17,6 +17,6 @@ suppress_bundle_relocation version - 28.0b2 + 28.0 diff --git a/tests/update-comparison-test.sh b/tests/update-comparison-test.sh deleted file mode 100755 index b0ed1f2..0000000 --- a/tests/update-comparison-test.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash - -# test script for validating the version comparison logic in erase-install.sh - -check_newer_available() { - # Download installinstallmacos.py - # get_installinstallmacos - # run installinstallmacos.py with list and then interrogate the plist - # [[ ! -f "$python_path" ]] && python_path=$(which python) - # "$python_path" "$workdir/installinstallmacos.py" --list --workdir="$workdir" > /dev/null - # i=0 - newer_build_found="no" - # while available_build=$( /usr/libexec/PlistBuddy -c "Print :result:$i:build" "$workdir/softwareupdate.plist" 2>/dev/null); do - available_build_darwin=${available_build:0:2} - installer_build_darwin=${installer_build:0:2} - available_build_letter=${available_build:2:1} - installer_build_letter=${installer_build:2:1} - available_build_minor=${available_build:3} - installer_build_minor=${installer_build:3} - available_build_minor_no=${available_build_minor//[!0-9]/} - installer_build_minor_no=${installer_build_minor//[!0-9]/} - available_build_minor_beta=${available_build_minor//[0-9]/} - installer_build_minor_beta=${installer_build_minor//[0-9]/} - echo " [check_newer_available] Checking available: $available_build vs. installer: $installer_build" - echo " [check_newer_available] Checking darwin: $available_build_darwin vs. installer: $installer_build_darwin" - echo " [check_newer_available] Checking letter: $available_build_letter vs. installer: $installer_build_letter" - echo " [check_newer_available] Checking minor: $available_build_minor vs. installer: $installer_build_minor" - if [[ $available_build_darwin -gt $installer_build_darwin ]]; then - echo " [check_newer_available] $available_build > $installer_build" - newer_build_found="yes" - # break - elif [[ $available_build_letter > $installer_build_letter && $available_build_darwin -eq $installer_build_darwin ]]; then - echo " [check_newer_available] $available_build > $installer_build" - newer_build_found="yes" - # break - elif [[ ! $available_build_minor_beta && $installer_build_minor_beta && $available_build_letter == "$installer_build_letter" && $available_build_darwin -eq $installer_build_darwin ]]; then - echo " [check_newer_available] $available_build > $installer_build (production > beta)" - newer_build_found="yes" - # break - elif [[ ! $available_build_minor_beta && ! $installer_build_minor_beta && $available_build_minor_no -lt 1000 && $installer_build_minor_no -lt 1000 && $available_build_minor_no -gt $installer_build_minor_no && $available_build_letter == "$installer_build_letter" && $available_build_darwin -eq $installer_build_darwin ]]; then - echo " [check_newer_available] $available_build > $installer_build" - newer_build_found="yes" - # break - elif [[ ! $available_build_minor_beta && ! $installer_build_minor_beta && $available_build_minor_no -ge 1000 && $installer_build_minor_no -ge 1000 && $available_build_minor_no -gt $installer_build_minor_no && $available_build_letter == "$installer_build_letter" && $available_build_darwin -eq $installer_build_darwin ]]; then - echo " [check_newer_available] $available_build > $installer_build (both betas)" - newer_build_found="yes" - # break - elif [[ $available_build_minor_beta && $installer_build_minor_beta && $available_build_minor_no -ge 1000 && $installer_build_minor_no -ge 1000 && $available_build_minor_no -gt $installer_build_minor_no && $available_build_letter == "$installer_build_letter" && $available_build_darwin -eq $installer_build_darwin ]]; then - echo " [check_newer_available] $available_build > $installer_build (both betas)" - newer_build_found="yes" - fi - # i=$((i+1)) - # done - [[ $newer_build_found != "yes" ]] && echo " [check_newer_available] No newer builds found" -} - -echo " [check_newer_available] Parameter 1: installer" -echo " [check_newer_available] Parameter 2: system" - -available_build=$1 -installer_build=$2 - -check_newer_available diff --git a/tests/version-comparison-test.sh b/tests/version-comparison-test.sh deleted file mode 100755 index c79dab1..0000000 --- a/tests/version-comparison-test.sh +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/bash - -# test script for validating the version comparison logic in erase-install.sh - -check_installer_is_valid() { - # echo " [check_installer_is_valid] Checking validity of $installer_app." - # check installer validity: - # The Build version in the app Info.plist is often older than the advertised build, - # so it's not a great check for validity - # check if running --erase, where we might be using the same build. - # The actual build number is found in the SharedSupport.dmg in com_apple_MobileAsset_MacSoftwareUpdate.xml (Big Sur and greater). - # This is new from Big Sur, so we include a fallback to the Info.plist file just in case. - - # first ensure that some earlier instance is not still mounted as it might interfere with the check - # [[ -d "/Volumes/Shared Support" ]] && diskutil unmount force "/Volumes/Shared Support" - # # now attempt to mount - # if hdiutil attach -quiet -noverify "$installer_app/Contents/SharedSupport/SharedSupport.dmg" ; then - # build_xml="/Volumes/Shared Support/com_apple_MobileAsset_MacSoftwareUpdate/com_apple_MobileAsset_MacSoftwareUpdate.xml" - # if [[ -f "$build_xml" ]]; then - # echo " [check_installer_is_valid] Using Build value from com_apple_MobileAsset_MacSoftwareUpdate.xml" - # installer_build=$(/usr/libexec/PlistBuddy -c "Print :Assets:0:Build" "$build_xml") - # sleep 1 - # diskutil unmount force "/Volumes/Shared Support" - # fi - # else - # # if that fails, fallback to the method for 10.15 or less, which is less accurate - # echo " [check_installer_is_valid] Using DTSDKBuild value from Info.plist" - # installer_build=$( /usr/bin/defaults read "$installer_app/Contents/Info.plist" DTSDKBuild ) - # fi - - # system_build=$( /usr/bin/sw_vers -buildVersion ) - - # we need to break the build into component parts to fully compare versions - installer_darwin_version=${installer_build:0:2} - system_darwin_version=${system_build:0:2} - installer_build_letter=${installer_build:2:1} - system_build_letter=${system_build:2:1} - installer_build_version=${installer_build:3} - system_build_version=${system_build:3} - - # 1. Darwin version is older in the installer than on the system - if [[ $installer_darwin_version -lt $system_darwin_version ]]; then - invalid_installer_found="yes" - # 2. Darwin version matches but build letter (minor version) is older in the installer than on the system - elif [[ $installer_darwin_version -eq $system_darwin_version && $installer_build_letter < $system_build_letter ]]; then - invalid_installer_found="yes" - # 3. Darwin version and build letter (minor version) matches but the first three build version numbers are older in the installer than on the system - elif [[ $installer_darwin_version -eq $system_darwin_version && $installer_build_letter == "$system_build_letter" && ${installer_build_version:3} -lt ${system_build_version:3} ]]; then - warning_issued="yes" - elif [[ $installer_darwin_version -eq $system_darwin_version && $installer_build_letter == "$system_build_letter" && ${installer_build_version:3} -eq ${system_build_version:3} ]]; then - installer_build_minor=${installer_build:5:2} - system_build_minor=${system_build:5:2} - # 4. Darwin version, build letter (minor version) and first three build version numbers match, but the fourth build version number is older in the installer than on the system - if [[ ${installer_build_minor//[!0-9]/} -lt ${system_build_minor//[!0-9]/} ]]; then - warning_issued="yes" - # 5. Darwin version, build letter (minor version) and build version numbers match, but beta release letter is older in the installer than on the system (unlikely to ever happen, but just in case) - elif [[ ${installer_build_minor//[!0-9]/} -eq ${system_build_minor//[!0-9]/} && ${installer_build_minor//[0-9]/} < ${system_build_minor//[0-9]/} ]]; then - warning_issued="yes" - fi - fi - - if [[ "$invalid_installer_found" == "yes" ]]; then - echo " [check_installer_is_valid] Installer: $installer_build < System: $system_build : invalid build." - elif [[ "$warning_issued" == "yes" ]]; then - echo " [check_installer_is_valid] Installer: $installer_build < System: $system_build : build might work but if it fails, please obtain a newer installer." - else - echo " [check_installer_is_valid] Installer: $installer_build > System: $system_build : valid build." - fi - - install_macos_app="$installer_app" -} - -echo " [check_installer_is_valid] Parameter 1: installer" -echo " [check_installer_is_valid] Parameter 2: system" - -installer_build=$1 -system_build=$2 - -check_installer_is_valid