Rework cplanet file locations
[chef.git] / cookbooks / cplanet / templates / default / planet-update-file.erb
1 #!/bin/sh
2
3 # DO NOT EDIT - This file is being maintained by Chef
4
5 # setup
6
7 PLANETDIR="/var/lib/planet"
8 PLANETPREV="${PLANETDIR}/planet-previous.pbf"
9 PLANETCURR="${PLANETDIR}/planet.pbf"
10 PLANETNEW="${PLANETDIR}/planet-new.pbf"
11 PLANETTMP="${PLANETDIR}/planet-tmp.pbf"
12
13 pyosmium-up-to-date -v -o "$PLANETNEW" "$PLANETCURR"
14 retval=$?
15
16 while [ $retval -eq 1 ]; do
17     mv "$PLANETNEW" "$PLANETTMP"
18     pyosmium-up-to-date -v -o "$PLANETNEW" "$PLANETTMP"
19     retval=$?
20     rm "$PLANETTMP"
21 done
22
23 if [ $retval -ne 0 ]; then
24     exit $retval
25 fi
26
27 # cleanup
28
29 mv "$PLANETCURR" "$PLANETPREV"
30 mv "$PLANETNEW" "$PLANETCURR"