Unmount the image before we convert to qcow2 to avoid corruption

sil2100/enable-universe-none
Pat Viafore 6 years ago
parent 9bf4c7cb52
commit 514a83b926
No known key found for this signature in database
GPG Key ID: 20C739856E05C9D1

@ -32,6 +32,9 @@ create_derivative "disk" "kvm" #sets ${derivative_img}
mount_disk_image ${derivative_img} ${mount_d} mount_disk_image ${derivative_img} ${mount_d}
# unmount disk image and remove created folders on exit # unmount disk image and remove created folders on exit
# even though we unmount manually before we convert to
# qcow2, we have this here just in case we error out before
# that step
cleanup_kvm() { cleanup_kvm() {
if [ -d "$mount_d" ]; then if [ -d "$mount_d" ]; then
umount_disk_image "$mount_d" umount_disk_image "$mount_d"
@ -61,4 +64,10 @@ env DEBIAN_FRONTEND=noninteractive chroot "${mount_d}" apt-get \
clean clean
create_manifest ${mount_d} livecd.ubuntu-cpc.disk-kvm.manifest create_manifest ${mount_d} livecd.ubuntu-cpc.disk-kvm.manifest
# unmount disk image to prevent corruption
# and remove it so the trap doesn't try to unmount it again
umount_disk_image ${mount_d}
rm -rf ${mount_d}
convert_to_qcow2 ${derivative_img} livecd.ubuntu-cpc.disk-kvm.img convert_to_qcow2 ${derivative_img} livecd.ubuntu-cpc.disk-kvm.img
Loading…
Cancel
Save