Remove an excess cp of disk images.

save_image is used to copy kernel and ramdisks out of the image, which
we will sometimes want to keep the source, and sometimes not. However
for the main image itself, the temp copy is never kept, so use mv
  rather than cp and avoid the excess IO.

Change-Id: I5a9f0d69ffee3e6b872a8927537ac17f02f5aa4d
This commit is contained in:
Robert Collins 2014-03-25 14:16:06 +13:00 committed by Chris Jones
parent e5f120274b
commit dc93feee69
3 changed files with 12 additions and 8 deletions

View File

@ -187,5 +187,7 @@ unmount_image
if [ "$IS_RAMDISK" == "0" ]; then if [ "$IS_RAMDISK" == "0" ]; then
compress_and_save_image $IMAGE_NAME.$IMAGE_TYPE compress_and_save_image $IMAGE_NAME.$IMAGE_TYPE
else else
remove_image # This is a ramdisk build, we have already extracted the kernel and ramdisk
# by this point.
rm $TMP_IMAGE_PATH
fi fi

View File

@ -40,6 +40,14 @@ function mk_build_dir () {
export TMP_HOOKS_PATH=$TMP_BUILD_DIR/hooks 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 () { function save_image () {
# TODO: this really should rename the old file # TODO: this really should rename the old file
if [ -f $1 ] ; then if [ -f $1 ] ; then

View File

@ -106,13 +106,7 @@ function compress_and_save_image () {
rm $TMP_IMAGE_PATH rm $TMP_IMAGE_PATH
TMP_IMAGE_PATH=$1-new TMP_IMAGE_PATH=$1-new
save_image $1 finish_image $1
remove_image
}
function remove_image () {
echo "Removing $TMP_IMAGE_PATH"
rm $TMP_IMAGE_PATH
} }
function do_extra_package_install () { function do_extra_package_install () {