+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 :bindir => build_directory,
+ :srcdir => source_directory,
+ :logfile => "#{node[:nominatim][:logdir]}/update.log",
+ :branch => node[:nominatim][:revision],
+ :update_stop_file => "#{basedir}/status/updates_disabled"
+end
+
+template "/etc/init.d/nominatim-update" do
+ source "updater.init.erb"
+ user "nominatim"