Pre-download a large file before MSC is opened...?

106 views
Skip to first unread message

jo...@slash32.co.uk

unread,
May 5, 2016, 9:08:37 AM5/5/16
to munki-dev
I've been thinking about using installcheck_script to pre-download a large payload - given such will run in the background, before the user sees MSC.

For a client, we're going to enable 10.11.x for self-upgrade via MSC. The .dmg (uncompressed) is around 6GB from createOSXinstallpkg. However, without scanning MSC code, given it is the installcheck_script MSC will not yet care about free disk space etc.

Not sure the logic is sound. As I've never thought about this before, unsure if the whole concept is defunct... It might just be too much effort to save the end-user sitting at the MSC download screen. (Our next thought is how to make the 'hanging' on the pre/post-install scripts of the createOSXinstallpkg created payload itself.)

I've knocked together (moments ago and probably fails syntax...!):

#!/bin/bash

#
# Other fun things here which pre-determine this device needs to install 10.11.x
# If this machine doesn't the script will have exited by now.
#

dmgsha256=""
dmgcachefile="/Library/Managed Installs/Cache/file.dmg"
dmgmsuloc=""
speedtestloc=""

# We should probably check free disk space first, before trying to ram in 6GB.

diskutilfreediskline="$(diskutil info / | grep "Free Space")"
if [[ "$(echo "$diskutilfreediskline" |awk '{print $5}')" == "GB" ]] && [[ "$(echo "$diskutilfreediskline" |awk '{print $4}')" -gt "10" ]]; then
#echo "/ looks like it has at least 10GB of free space."
#echo "TODO: Take care of TB measurement?"
if [[ "$(shasum -a 256 "$dmgcachefile" |awk '{print $1}')" != "$dmgsha256" ]]; then
#echo "SHA256 doesnt match, so file is wrong in some way - size; corrupt; doesnt exist etc."
#echo "Lets run a speed test, as user could be outside of the client office, and 6GB could take awhile."
curlspeedtest="$(curl -w '%{speed_download}\n' -o /dev/null -s "$speedtestloc")"
curlspeedtest_bps="$(echo $curlspeedtest | awk '{print $1}' | sed 's/\..*//')"
if [[ "$(($curlspeedtest_bps / 125000))" -gt "100" ]]; then
#echo "$curlspeedtest_bps looks over 100Mbits. Fast enough to reasonably download 6GB."
curl -C - -o "$dmgcachefile" "$dmgmsuloc"
chown
chmod
#echo "Looks like we've pre-loaded the .dmg, exit telling MSC it can install."
#echo "TODO: Cater for loss of process; internet connections and cURL timeouts, needing us to loop - or give up."
exit 1
fi
fi
fi

(I know the code is just plain awful. This is POC.)

Gregory Neagle

unread,
May 5, 2016, 10:11:52 AM5/5/16
to munk...@googlegroups.com
On May 5, 2016, at 4:20 AM, jo...@slash32.co.uk wrote:

I've been thinking about using installcheck_script to pre-download a large payload - given such will run in the background, before the user sees MSC.

Not always...

--
Find related discussion groups here:
https://github.com/munki/munki/wiki/Discussion-Group
---
You received this message because you are subscribed to the Google Groups "munki-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to munki-dev+...@googlegroups.com.
To post to this group, send email to munk...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mr. Alan Siu

unread,
May 5, 2016, 11:28:35 AM5/5/16
to munk...@googlegroups.com
This might not be the ideal solution, but could you create a .pkg with the installer as a payload, make that .pkg an unattended install, and then have another item require the .pkg that is not an unattended install that essentially runs the createOSXinstallPkg-created installer that was previously distributed?


Alan Siu
Client Systems Analyst
St. Ignatius College Preparatory

Ray Kerce

unread,
May 25, 2016, 9:00:53 AM5/25/16
to munki-dev
We made a payload free package available that has managedsoftwareupdate do a onetime check to an El Capitan Upgrade Manifest. Once its complete We open Managed Software Center and the user clicks update. It logs the user out and installs 10.11.  
Reply all
Reply to author
Forward
0 new messages