]> git.openstreetmap.org Git - chef.git/blob - cookbooks/planet/templates/default/planet-update.erb
planet: do not keep previous planet around.
[chef.git] / cookbooks / planet / templates / default / planet-update.erb
1 #!/bin/sh
2
3 # DO NOT EDIT - This file is being maintained by Chef
4
5 # setup
6
7 SUFFIX="osh.pbf"
8
9 PLANETDIR="/var/lib/planet"
10 PLANETPREV="${PLANETDIR}/planet-previous.${SUFFIX}"
11 PLANETCURR="${PLANETDIR}/planet.${SUFFIX}"
12 PLANETNEW="${PLANETDIR}/planet-new.${SUFFIX}"
13
14 rm -f "$PLANETPREV"
15
16 pyosmium-up-to-date -vvv -o "$PLANETNEW" "$PLANETCURR"
17 retval=$?
18
19 while [ $retval -eq 1 ]; do
20     mv "$PLANETCURR" "$PLANETPREV"
21     rm -f "$PLANETPREV"
22     mv "$PLANETNEW" "$PLANETCURR"
23     pyosmium-up-to-date -vvv -o "$PLANETNEW" "$PLANETCURR"
24     retval=$?
25 done
26
27 if [ $retval -ne 0 ]; then
28     exit $retval
29 fi
30
31 # cleanup
32
33 mv "$PLANETCURR" "$PLANETPREV"
34 rm -f "$PLANETPREV"
35 mv "$PLANETNEW" "$PLANETCURR"