notifies :restart, "service[apache2]"
end
+ directory "#{directory}/planet" do
+ owner "taginfo"
+ group "taginfo"
+ mode 0755
+ end
+
+ remote_file "#{directory}/planet/planet.pbf" do
+ action :create_if_missing
+ source "http://planet.openstreetmap.org/pbf/planet-latest.osm.pbf"
+ owner "taginfo"
+ group "taginfo"
+ mode 0644
+ end
+
+ template "#{directory}/planet/configuration.txt" do
+ source "configuration.txt.erb"
+ owner "taginfo"
+ group "taginfo"
+ mode 0644
+ end
+
+ file "#{directory}/planet/download.lock" do
+ owner "taginfo"
+ group "taginfo"
+ mode 0644
+ end
+
+ directory "#{directory}/bin" do
+ owner "taginfo"
+ group "taginfo"
+ mode 0755
+ end
+
+ template "#{directory}/bin/update-planet" do
+ source "update-planet.erb"
+ owner "taginfo"
+ group "taginfo"
+ mode 0755
+ variables :directory => directory
+ end
+
directory "#{directory}/data" do
owner "taginfo"
group "taginfo"
--- /dev/null
+#!/bin/sh
+
+set -e
+
+cd "<%= @directory %>/planet"
+
+OSCFILE="$(date +%Y%m%d-%H%M).osc"
+
+# if there are old .osc files, they have to be taken into account
+
+OLDFILE=2*-*.osc
+if [ -z "$OLDFILE" ]
+then
+ osmosis --rri --simc --write-xml-change "$OSCFILE"
+else
+ osmosis --rxc "$OLDFILE" --rri --mc --simc --write-xml-change "$OSCFILE" && rm "$OLDFILE"
+fi
+
+# osc file is ready, create new planet file
+
+osmosis --read-xml-change "$OSCFILE" --read-bin planet.pbf --buffer bufferCapacity=12000 --apply-change --buffer bufferCapacity=12000 --write-pbf planet-new.pbf
+
+# cleanup
+
+mv planet-new.pbf planet.pbf
+rm "$OSCFILE"