src/preload.sh: Estimate container size by reading gzip sizes
src/preload.sh: Estimate container size by reading gzip sizes

As the uncompressed image layer size cannot be obtained through the
docker registry (because the layers' identity encoding is a tarball),
and the registry exposes no methods to otherwise do so, we needed to
come up with a way to estimate the full container size.

This calculates the container size by fetching each layers' blob's last
4 bytes, which are the ISIZE field of the gzip stream, denoting the
uncompressed size of the stream, and adds up all layer sizes.

NOTE: This method is not reliable for containers with image layers
that are 4GB or larger in size, as the gzip ISIZE field is a uint32,
and the uncompressed size is thus storead as `mod 2^32`, which in turn
will result in the size of a 4GB layer being calculated as being zero.

Change-Type: minor

resin-io/resin-preload-image-script,resin-io/resin-preload-image-script