Posted on 01-25-2018 11:16 AM
Hello,
Does anyone know if there is anyway to create an EA or Smart Group based on the size of an Application. For our MacOS High Sierra upgrade, I'm caching the installer in Applications/, and am scoping a script to run the installer on machines who have the application Application/Install MacOS High Sierra.app, but I want to make sure that the full installer was downloaded so that Jamf doesn't automatically try to kick off an install on an installer that was only partially downloaded.
Any ideas?
Posted on 01-25-2018 11:35 AM
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.
Posted on 01-25-2018 11:54 AM
@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?
Posted on 01-25-2018 12:00 PM
@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.
Posted on 01-25-2018 12:05 PM
@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.