diff --git a/bin/disk-image-create b/bin/disk-image-create index 43686a4b..666788c1 100755 --- a/bin/disk-image-create +++ b/bin/disk-image-create @@ -187,5 +187,7 @@ unmount_image if [ "$IS_RAMDISK" == "0" ]; then compress_and_save_image $IMAGE_NAME.$IMAGE_TYPE else - remove_image + # This is a ramdisk build, we have already extracted the kernel and ramdisk + # by this point. + rm $TMP_IMAGE_PATH fi diff --git a/lib/common-functions b/lib/common-functions index 21b7f9c5..632b7901 100644 --- a/lib/common-functions +++ b/lib/common-functions @@ -40,6 +40,14 @@ function mk_build_dir () { export TMP_HOOKS_PATH=$TMP_BUILD_DIR/hooks } +function finish_image () { + mv $TMP_IMAGE_PATH $1 + cleanup_dirs + # All done! + trap EXIT + echo "Image file $1 created..." +} + function save_image () { # TODO: this really should rename the old file if [ -f $1 ] ; then diff --git a/lib/img-functions b/lib/img-functions index c1cf17a3..09ae0040 100644 --- a/lib/img-functions +++ b/lib/img-functions @@ -106,13 +106,7 @@ function compress_and_save_image () { rm $TMP_IMAGE_PATH TMP_IMAGE_PATH=$1-new - save_image $1 - remove_image -} - -function remove_image () { - echo "Removing $TMP_IMAGE_PATH" - rm $TMP_IMAGE_PATH + finish_image $1 } function do_extra_package_install () {