Merge "Rename old image file instead of rewrite it"

This commit is contained in:
Jenkins 2014-06-12 22:19:15 +00:00 committed by Gerrit Code Review
commit fa9a561819

View File

@ -43,6 +43,12 @@ function mk_build_dir () {
} }
function finish_image () { function finish_image () {
if [ -f $1 ]; then
old_image="${1%.*}"-$(date +%Y.%m.%d-%H.%M.%S).${1##*.}
echo "Old image is found. Renaming it to $old_image"
mv "$1" "$old_image"
fi
mv $TMP_IMAGE_PATH $1 mv $TMP_IMAGE_PATH $1
cleanup_dirs cleanup_dirs
# All done! # All done!
@ -51,10 +57,10 @@ function finish_image () {
} }
function save_image () { function save_image () {
# TODO: this really should rename the old file
if [ -f $1 ] ; then if [ -f $1 ] ; then
echo "Old Image file Found REMOVING" old_image="${1%.*}"-$(date +%Y.%m.%d-%H.%M.%S).${1##*.}
rm -f $1 echo "Old image is found. Renaming it to $old_image"
mv "$1" "$old_image"
fi fi
cp $TMP_IMAGE_PATH $1 cp $TMP_IMAGE_PATH $1