Skip to content

Commit 010c242

Browse files
committed
fix(installer-factory): say when the output disk is full
grub-mkrescue on a full disk ends in xorriso : FAILURE : Image size 228248s exceeds free space on media 130750s which reads like something about the ISO, and names neither the disk nor the directory it ran out on. /output is a bind mount of the caller's output/, so it is their machine that is full - ~255 MB free for a ~470 MB ISO, in the run this comes from. The ISO directory is measured against df on /output before the ISO is built, with a tenth of it as headroom for what grub adds. Not run: this needs a factory image, like the other changes here. Signed-off-by: Simon Walz <contact@simonwalz.de>
1 parent 42875ed commit 010c242

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

‎installer-factory/create_iso.sh‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,19 @@ if [[ -f "${CONFIG_PATH}" ]]; then
5959
fi
6060
fi
6161

62+
# The ISO is written into /output, which is the caller's disk. When that disk is
63+
# full, xorriso reports it as "Image size ... exceeds free space on media",
64+
# which reads like a property of the ISO rather than of the machine it is being
65+
# written on. Say what it is, before the ISO is built and not after.
66+
needed_kb="$(du -sk "${ISO_DIR}" | cut -f1)"
67+
read -r _ _ _ free_kb _ < <(df -Pk "${OUTPUT_DIR}" | tail -n 1)
68+
if ((free_kb < needed_kb + needed_kb / 10)); then
69+
echo "Not enough free space for ${INSTALLER}:" \
70+
"the ISO needs about $((needed_kb / 1024)) MB," \
71+
"$((free_kb / 1024)) MB are free." >&2
72+
exit 1
73+
fi
74+
6275
step "Building the bootable ISO"
6376
grub-mkrescue \
6477
-o "${INSTALLER}" \

0 commit comments

Comments
 (0)