Skip to content

Commit abdee51

Browse files
authored
Merge pull request #576 from jmt-lab/img2img-fix
feat(img2img): add new error when erofs code is called on non-erofs r…
2 parents f340cf3 + 383a944 commit abdee51

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

twoliter/embedded/img2img

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,12 @@ dd if="${OS_IMAGE}" of="${ROOT_IMAGE}" \
130130

131131
# For erofs, extract the root filesystem since we can't modify in-place.
132132
if [[ "${EROFS_ROOT_PARTITION}" == "yes" ]]; then
133+
# Validate that the root image is actually erofs
134+
filesystem_type="$(blkid -c /dev/null -o value -s TYPE "${ROOT_IMAGE}")"
135+
if [[ "${filesystem_type}" != "erofs" ]]; then
136+
echo "root partition is not erofs as expected, found: '${filesystem_type}'" >&2
137+
exit 1
138+
fi
133139
fsck.erofs --extract="${ROOT_MOUNT}" "${ROOT_IMAGE}"
134140
touch -r "${ROOT_IMAGE}" "${ROOT_MOUNT}"
135141
rm "${ROOT_IMAGE}"

0 commit comments

Comments
 (0)