From 5a720fa766c5fb9ac9886e8551a961eb8764428c Mon Sep 17 00:00:00 2001 From: Jochen Topf Date: Mon, 7 Mar 2022 16:05:45 +0100 Subject: [PATCH] Do not create temporary planet file when update was not complete When the update of the planet file was not complete (when pyosmium-up-to-date returns 1), the resulting planet is nevertheless usable, so we can keep it instead of creating a temporary one. This way we use less disk space because there is one fewer copy of the planet around. --- cookbooks/planet/templates/default/planet-update-file.erb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cookbooks/planet/templates/default/planet-update-file.erb b/cookbooks/planet/templates/default/planet-update-file.erb index 16c7fed17..73a778bba 100644 --- a/cookbooks/planet/templates/default/planet-update-file.erb +++ b/cookbooks/planet/templates/default/planet-update-file.erb @@ -10,16 +10,15 @@ PLANETDIR="/var/lib/planet" PLANETPREV="${PLANETDIR}/planet-previous.${SUFFIX}" PLANETCURR="${PLANETDIR}/planet.${SUFFIX}" PLANETNEW="${PLANETDIR}/planet-new.${SUFFIX}" -PLANETTMP="${PLANETDIR}/planet-tmp.${SUFFIX}" pyosmium-up-to-date -vvv -o "$PLANETNEW" "$PLANETCURR" retval=$? while [ $retval -eq 1 ]; do - mv "$PLANETNEW" "$PLANETTMP" - pyosmium-up-to-date -vvv -o "$PLANETNEW" "$PLANETTMP" + mv "$PLANETCURR" "$PLANETPREV" + mv "$PLANETNEW" "$PLANETCURR" + pyosmium-up-to-date -vvv -o "$PLANETNEW" "$PLANETCURR" retval=$? - rm "$PLANETTMP" done if [ $retval -ne 0 ]; then -- 2.45.1