kc9wwh / macOSUpgrade

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

Disk Space Pre-Check Unable to Handle Large Drives #30

Closed kc9wwh closed 7 years ago

kc9wwh commented 7 years ago

Pulling from: https://www.jamf.com/jamf-nation/discussions/23551/macos-10-12-4-upgrade-via-self-service-fails#responseChild148831

Need to adjust how free space is checked to ensure drives with 1TB or larger do not fail check.

Lines 107-121

##Check if free space > 15GB
osMinor=$( /usr/bin/sw_vers -productVersion | awk -F. {'print $2'} )
if [[ $osMinor -ge 12 ]]; 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

if [[ ${freeSpace%.*} -ge 15000000000 ]]; then
    spaceStatus="OK"
    /bin/echo "Disk Check: OK - ${freeSpace%.*} Bytes Free Space Detected"
else
    spaceStatus="ERROR"
    /bin/echo "Disk Check: ERROR - ${freeSpace%.*} Bytes Free Space Detected"
fi
kc9wwh commented 7 years ago

Added in v2.2