install-image confidently proceeds with installation if the image successfully downloads. This leads to an edge scenario where the system has enough space to download the image but not to install it. Naturally, the installation fails when the system runs out of space, so the script cleans up its temporary directory (/var/tmp/install-image.$$), discarding throwing the image away in the process. The user has to redownload the image from scratch.
Since it's not feasible to find out the decompressed size of a SquashFS image, we can probably assume something like 2× the size of the image is necessary for installation and make the script check for that amount of space.