prune_images: keep newer-than-latest builds

This may include recent failures or builds derrived from latest, such as
those made by image_set_group.
This commit is contained in:
Michael Marineau 2015-11-24 13:31:08 -08:00
parent f0be34f4dd
commit 9a138677a8

View File

@ -44,9 +44,13 @@ for board_path in "${board_paths[@]}"; do
continue
fi
if [[ ${FLAGS_keep_latest} -eq ${FLAGS_TRUE} &&
"${board_path}/latest" -ef "${image_path}" ]]; then
continue
if [[ ${FLAGS_keep_latest} -eq ${FLAGS_TRUE} ]]; then
# keep anything that is or newer than the latest
if [[ "${board_path}/latest" -ef "${image_path}" || \
"${board_path}/latest/version.txt" -ot \
"${image_path}/version.txt" ]]; then
continue
fi
fi
# best effort attempt to clean up old mounts