kc9wwh / macOSUpgrade

Workflow for doing in-place upgrades.
Other
418 stars 103 forks source link

Free space check changes again in 10.13.4 #47

Closed njellis closed 6 years ago

njellis commented 6 years ago

First off, great work on this! It's much appreciated.

In my testing of your script, I've found that they have changed diskutil in 10.13.4 (currently beta) back to show "Free Space" instead of "Available Space" like in 10.12.0 - 10.13.3. I think the following changes to your free space check should resolve this (and has so far in my experience). This should give it a bit more future proofing, at least until they change it again...

##Check if free space > 15GB
osMinor=$( /usr/bin/sw_vers -productVersion )
if [[ $osMinor == 10.12.* ]] || [[ $osMinor > 10.12.* ]] && [[ $osMinor < 10.13.4 ]]; then
    freeSpace=$( /usr/sbin/diskutil info / | grep "Available Space" | awk '{print $6}' | cut -c 2- )
else
    freeSpace=$( /usr/sbin/diskutil info / | grep "Free Space" | awk '{print $6}' | cut -c 2- )
fi

Thanks!

Morcin commented 6 years ago

This will break a later part of the script that uses the osMinor variable:

Determine Program Argument

if [[ $osMinor -ge 11 ]]; then progArgument="osinstallersetupd" elif [[ $osMinor -eq 10 ]]; then progArgument="osinstallersetupplaind" fi

kc9wwh commented 6 years ago

All previous references to $osMinor were renamed to $osMajor and the below change was made to the free space check:

##Check if free space > 15GB
osMajor=$( /usr/bin/sw_vers -productVersion | awk -F. {'print $2'} )
osMinor=$( /usr/bin/sw_vers -productVersion | awk -F. {'print $3'} )
if [[ $osMajor -eq 12 ]] || [[ $osMajor -eq 13 && $osMinor -lt 4 ]]; then
    freeSpace=$( /usr/sbin/diskutil info / | grep "Available Space" | awk '{print $6}' | cut -c 2- )
else
    freeSpace=$( /usr/sbin/diskutil info / | grep "Free Space" | awk '{print $6}' | cut -c 2- )
fi

Initial testing was good, will do final testing before merge to master, but if you see an issue with it please reply.