]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/planet/templates/default/planet-update-file.erb
Convert cplanet to be a recipe in the planet cookbook
[chef.git] / cookbooks / planet / templates / default / planet-update-file.erb
diff --git a/cookbooks/planet/templates/default/planet-update-file.erb b/cookbooks/planet/templates/default/planet-update-file.erb
new file mode 100644 (file)
index 0000000..36786e2
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+# DO NOT EDIT - This file is being maintained by Chef
+
+# setup
+
+PLANETDIR="/var/lib/planet"
+PLANETPREV="${PLANETDIR}/planet-previous.pbf"
+PLANETCURR="${PLANETDIR}/planet.pbf"
+PLANETNEW="${PLANETDIR}/planet-new.pbf"
+PLANETTMP="${PLANETDIR}/planet-tmp.pbf"
+
+pyosmium-up-to-date -v -o "$PLANETNEW" "$PLANETCURR"
+retval=$?
+
+while [ $retval -eq 1 ]; do
+    mv "$PLANETNEW" "$PLANETTMP"
+    pyosmium-up-to-date -v -o "$PLANETNEW" "$PLANETTMP"
+    retval=$?
+    rm "$PLANETTMP"
+done
+
+if [ $retval -ne 0 ]; then
+    exit $retval
+fi
+
+# cleanup
+
+mv "$PLANETCURR" "$PLANETPREV"
+mv "$PLANETNEW" "$PLANETCURR"