diff --git a/build_image b/build_image index 971f0a1555..d2f91b40e3 100755 --- a/build_image +++ b/build_image @@ -760,6 +760,10 @@ rm -f "${ROOT_FS_IMG}" "${STATEFUL_FS_IMG}" "${OUTPUT_DIR}/vmlinuz.image" \ "${ESP_FS_IMG}" "${OEM_FS_IMG}" "${OUTPUT_DIR}/vmlinuz_hd.vblock" rmdir "${ROOT_FS_DIR}" "${STATEFUL_FS_DIR}" "${OEM_FS_DIR}" "${ESP_FS_DIR}" +# Create a 'latest' link +rm -f ${FLAGS_output_root}/${FLAGS_board}/latest +ln -s $(basename ${OUTPUT_DIR}) ${FLAGS_output_root}/${FLAGS_board}/latest + echo "Done. Image created in ${OUTPUT_DIR}" echo "Chromium OS image created as ${PRISTINE_IMAGE_NAME}" if [ "${FLAGS_withdev}" -eq "${FLAGS_TRUE}" ]; then diff --git a/get_latest_image.sh b/get_latest_image.sh index 020cadf9dc..f8ed1e5f86 100755 --- a/get_latest_image.sh +++ b/get_latest_image.sh @@ -30,7 +30,11 @@ IMAGES_DIR="${DEFAULT_BUILD_ROOT}/images/${FLAGS_board}" # If there are no images, return nothing [ -d $IMAGES_DIR ] || exit 0 -# Default to the most recent image -DEFAULT_FROM="${IMAGES_DIR}/`ls -t $IMAGES_DIR | head -1`" +# Use latest link if it exists, otherwise most recently changed dir +if [ -L ${IMAGES_DIR}/latest ] ; then + DEFAULT_FROM="${IMAGES_DIR}/`readlink ${IMAGES_DIR}/latest`" +else + DEFAULT_FROM="${IMAGES_DIR}/`ls -t $IMAGES_DIR | head -1`" +fi echo $DEFAULT_FROM