You could try this for an extension attribute:
#!/bin/bash
if [ -d "/Applications/Install macOS High Sierra.app" ]; then
appSize=$(du -ms "/Applications/Install macOS High Sierra.app" | awk '{print $1}' )
if [ "$appSize" -ge "4973" ]; then
echo "<result>Cached</result>"
else
echo "<result>Incomplete</result>"
fi
else
echo "<result>Uncached</result>"
fi
Adjust the filename and the application size accordingly.
@jstine Possibly easier would be to have the process that caches the app drop a breadcrumb file on successful download which you have an EA test for as an indicator the install can start.
And I take it you're not wanting to trigger the install as soon as the download completes?
@pcrandom Thank you, I'm going to give this a try.
Is that filesize in the EA in bytes or kb?
The installer I'm using is 5,214,297,228 bytes, or 5.21GB.
@jstine That size is in MB and is the size reported to me when I run du -ms on my copy of the 10.13.2 High Sierra installer. If you have a fully downloaded copy of whichever installer you're caching, run the command to see what size it comes out as in MB.
My installer shows a similar-sized 5,207,413,213 bytes (5.21 GB on disk) in Get Info, but 4973 is the number of 1048576-byte (1-Mbyte) blocks when I run the du -ms on it.