+ mode 0o664
+ variables :base_url => node[:nominatim][:state] == "off" ? node[:fqdn] : "nominatim.openstreetmap.org",
+ :dbname => node[:nominatim][:dbname],
+ :flatnode_file => node[:nominatim][:flatnode_file],
+ :log_file => "#{node[:nominatim][:logdir]}/query.log"
+end
+
+if node[:nominatim][:flatnode_file] # ~FC023
+ directory File.dirname(node[:nominatim][:flatnode_file]) do
+ recursive true
+ end
+end
+
+template "/etc/logrotate.d/nominatim" do
+ source "logrotate.nominatim.erb"
+ owner "root"
+ group "root"
+ mode 0o644
+end
+
+external_data = [
+ "wikipedia_article.sql.bin",
+ "wikipedia_redirect.sql.bin",
+ "gb_postcode_data.sql.gz"
+]
+
+external_data.each do |fname|
+ remote_file "#{source_directory}/data/#{fname}" do
+ action :create_if_missing
+ source "http://www.nominatim.org/data/#{fname}"
+ owner "nominatim"
+ group "nominatim"
+ mode 0o644
+ end
+end
+
+template "/etc/cron.d/nominatim" do
+ action node[:nominatim][:state] == :off ? :delete : :create
+ source "nominatim.cron.erb"
+ owner "root"
+ group "root"
+ mode "0644"
+ variables :bin_directory => "#{source_directory}/utils", :mailto => email_errors
+end
+
+template "#{source_directory}/utils/nominatim-update" do
+ source "updater.erb"
+ user "nominatim"
+ group "nominatim"
+ mode 0o755
+ variables :logfile => "#{node[:nominatim][:logdir]}/update.log",
+ :branch => node[:nominatim][:revision],
+ :update_stop_file => "#{basedir}/status/updates_disabled"