Fix double compression whe finishing the OS image

Signed-off-by: Dongjin Kim <tobetter@gmail.com>
Change-Id: I9e81262917eccd1b796f84e8f327579afe7b7197
This commit is contained in:
Dongjin Kim
2021-03-03 19:15:43 +09:00
parent 7e75251bdd
commit 28f2a06f18

View File

@@ -342,17 +342,15 @@ do_finalize_image() {
if [ -f ${disk} ]; then
echo "I: finalizing OS image - '${osimage}'"
mv -f ${disk} ${osimage} || panic "failed to target image file"
if [ "x${COMPRESS}" = "xtrue" ]; then
echo "I: compressing OS image to ${osimage}"
xz ${osimage} || panic "failed to create compressed image file"
osimage=${osimage}.xz
fi
md5sum ${osimage} > ${osimage}.md5sum
if [ "x${COMPRESS}" = "xtrue" ]; then
echo "I: compressing OS image - '${osimage}'"
rm -f ${osimage}.xz
xz --verbose ${osimage} || panic "failed to create compressed image file"
md5sum ${osimage}.xz > ${osimage}.xz.md5sum
fi
xz ${osimage}
md5sum ${osimage}.xz > ${osimage}.xz.md5sum
sed -i -r "s/ .*\/(.+)/ \1/g" ${osimage}.md5sum ${osimage}.xz.md5sum
sed -i -r "s/ .*\/(.+)/ \1/g" ${osimage}*.md5sum
fi
}