Rename old image file instead of rewrite it
If we have the old image file with same name as new image file we shouldn't rewrite it, just need to rename old. Uses date number in old image name. Fixes TODO in lib/common-functions Change-Id: Ica58a0f4435217912bddf950322299d2ed2889f3
This commit is contained in:
parent
50cb019a25
commit
b740c50c76
@ -43,6 +43,12 @@ function mk_build_dir () {
|
||||
}
|
||||
|
||||
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
|
||||
cleanup_dirs
|
||||
# All done!
|
||||
@ -51,10 +57,10 @@ function finish_image () {
|
||||
}
|
||||
|
||||
function save_image () {
|
||||
# TODO: this really should rename the old file
|
||||
if [ -f $1 ] ; then
|
||||
echo "Old Image file Found REMOVING"
|
||||
rm -f $1
|
||||
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
|
||||
|
||||
cp $TMP_IMAGE_PATH $1
|
||||
|
Loading…
Reference in New Issue
Block a user