<pre style='margin:0'>
Renee Otten (reneeotten) pushed a commit to branch master
in repository macports-ports.
</pre>
<p><a href="https://github.com/macports/macports-ports/commit/f19ca4e20e2106f062c892c0c6cc5bb0becfcb37">https://github.com/macports/macports-ports/commit/f19ca4e20e2106f062c892c0c6cc5bb0becfcb37</a></p>
<pre style="white-space: pre; background: #F8F8F8">The following commit(s) were added to refs/heads/master by this push:
<span style='display:block; white-space:pre;color:#404040;'> new f19ca4e20e2 mod_tile: new port
</span>f19ca4e20e2 is described below
<span style='display:block; white-space:pre;color:#808000;'>commit f19ca4e20e2106f062c892c0c6cc5bb0becfcb37
</span>Author: Frank Dean <frankdean@users.noreply.github.com>
AuthorDate: Mon Sep 27 17:48:23 2021 +0100
<span style='display:block; white-space:pre;color:#404040;'> mod_tile: new port
</span>---
gis/mod_tile/Portfile | 244 ++++++++++++++++++++
gis/mod_tile/files/README_MacPorts.md | 141 ++++++++++++
gis/mod_tile/files/configure-ac.diff | 38 ++++
gis/mod_tile/files/logrotate.conf | 3 +
gis/mod_tile/files/makefile-am.diff | 34 +++
.../files/openstreetmap-tiles-update-expire.diff | 159 +++++++++++++
gis/mod_tile/files/osm-tiles-update.conf.dist | 10 +
gis/mod_tile/files/osm_setup_db.sh | 253 +++++++++++++++++++++
gis/mod_tile/files/osmosis-db_replag.diff | 38 ++++
gis/mod_tile/files/renderd.conf.dist | 18 ++
gis/mod_tile/files/src-daemon-c.diff | 11 +
gis/mod_tile/files/src-mod_tile-c.diff | 15 ++
gis/mod_tile/files/src-render_submit_queue-c.diff | 10 +
13 files changed, 974 insertions(+)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/gis/mod_tile/Portfile b/gis/mod_tile/Portfile
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 00000000000..433f42e68ad
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/gis/mod_tile/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,244 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+PortSystem 1.0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+PortGroup active_variants 1.1
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+PortGroup github 1.0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+github.setup openstreetmap mod_tile 0.5
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+github.tarball_from archive
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+revision 0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+categories-append gis
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+platforms darwin
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+maintainers {@frankdean fdsd.co.uk:frank.dean} openmaintainer
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+license GPL-2+ Boost-1 BSD Permissive MIT
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+description Renders map tiles with mapnik and serves them using Apache and mod_tile
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+long_description mod_tile is a system to serve raster tiles for example to use within \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ a slippy map. It provides a dynamic combination of efficient caching \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ and on the fly rendering. Due to its dynamic rendering, only a small \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ fraction of overall tiles need to be kept on disk, reducing the \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ resources required. At the same time, its caching strategy allows for \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ a high performance serving and can support several thousand requests \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ per second.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+checksums rmd160 e6c2224c6500f695e4a17addc7d05086ce5bebd5 \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sha256 d730ec04f9dc01ac7e4f863130480451be849b5d14a632225b23957fe5da0aef \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ size 182209
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+depends_build port:apache2 \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:iniparser
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+depends_lib port:curl \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:freetype \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:harfbuzz \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:icu \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:libjpeg-turbo \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:libpng \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:mapnik \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:proj4 \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:tiff \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:webp \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:zlib
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+depends_run port:gsed \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:openstreetmap-carto \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:osm2pgsql-lua \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:postgis3 \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:wget
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+set agent_name fetch-osm-db-updates
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+set agent_uniquename org.macports.${agent_name}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+set apache_name apache2
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+set apxs ${prefix}/bin/apxs
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+set docdir ${prefix}/share/doc/${name}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+set mdir ${prefix}/lib/apache2/modules/
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+set renderd_user nobody
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+startupitem.type launchd
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+startupitem.create yes
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+startupitem.debug yes
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+startupitem.name renderd
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+startupitem.install yes
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+startupitem.logfile ${prefix}/var/log/renderd/renderd.log
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+startupitem.logevents yes
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+startupitem.user ${renderd_user}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+startupitem.executable ${prefix}/bin/renderd -f -c ${prefix}/etc/renderd/renderd.conf
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+patchfiles configure-ac.diff \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ makefile-am.diff \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ openstreetmap-tiles-update-expire.diff \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ osmosis-db_replag.diff \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ src-daemon-c.diff \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ src-mod_tile-c.diff \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ src-render_submit_queue-c.diff
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+use_autoreconf yes
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+configure.args --with-apxs=${apxs}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+use_parallel_build no
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+test.run yes
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+require_active_variants mapnik postgis
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+variant postgresql12 conflicts postgresql13 description {Use with PostgreSQL 12} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ depends_lib-append port:postgresql12
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+variant postgresql13 conflicts postgresql12 description {Use with PostgreSQL 13} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ depends_lib-append port:postgresql13
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+variant osmosis description {Perform incremental OSM updates} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ depends_run-append \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:osmium-tool \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:osmosis \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:trim_osc
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+variant logrotate description {Logrotate configuration} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ depends_run-append port:logrotate
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+default_variants +osmosis +logrotate
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+if {![variant_isset postgresql12] && ![variant_isset postgresql13]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ default_variants-append +postgresql13
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+post-extract {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ file rename ${worksrcpath}/renderd.conf ${worksrcpath}/renderd.conf.orig
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+post-patch {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ xinstall -m 0644 -W ${filespath} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ renderd.conf.dist \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ osm-tiles-update.conf.dist \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${worksrcpath}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ reinplace "s|@PREFIX@|${prefix}|g" \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${worksrcpath}/renderd.conf.dist \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${worksrcpath}/osmosis-db_replag
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+post-destroot {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ system -W ${worksrcpath} "make install-mod_tile DESTDIR=${destroot} PREFIX=${prefix}"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[variant_isset osmosis]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ xinstall -m 0755 -d ${destroot}${prefix}/etc/LaunchAgents/${agent_uniquename}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set minutes 20; # Run every ${minutes} minutes
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set plist [open "${destroot}${prefix}/etc/LaunchAgents/${agent_uniquename}/${agent_uniquename}.plist" w 0644]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ puts ${plist} {<?xml version="1.0" encoding="UTF-8"?>}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ puts ${plist} {<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ puts ${plist} {"http://www.apple.com/DTDs/PropertyList-1.0.dtd">}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ puts ${plist} {<plist version="1.0">}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ puts ${plist} { <dict>}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ puts ${plist} { <key>Disabled</key>}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ puts ${plist} { <false/>}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ puts ${plist} { <key>UserName</key>}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ puts ${plist} " <string>${renderd_user}</string>"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ puts ${plist} { <key>Label</key>}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ puts ${plist} " <string>${agent_uniquename}</string>"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ puts ${plist} { <key>Program</key>}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ puts ${plist} " <string>${prefix}/share/mod_tile/openstreetmap-tiles-update-expire</string>"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ puts ${plist} { <!-- See man launchd.plist -->}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ puts ${plist} { <key>StartCalendarInterval</key>}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ puts ${plist} { <array>}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ for {set i [expr int(rand() * $minutes)]} {$i < 60} {incr i $minutes} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ puts ${plist} { <dict>}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ puts ${plist} { <key>Minute</key>}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ puts ${plist} " <integer>${i}</integer>"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ puts ${plist} { </dict>}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ puts ${plist} { </array>}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ puts ${plist} { <key>ProcessType</key>}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ puts ${plist} { <string>Background</string>}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ puts ${plist} { </dict>}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ puts ${plist} {</plist>}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ close ${plist}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # install the plist
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[getuid] == 0 && ${startupitem.install}} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ xinstall -m 0755 -d ${destroot}/Library/LaunchAgents
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ln -sf ${prefix}/etc/LaunchAgents/${agent_uniquename}/${agent_uniquename}.plist ${destroot}/Library/LaunchAgents
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ln -sf ${prefix}/etc/LaunchAgents/${agent_uniquename}/${agent_uniquename}.plist ${destroot}${prefix}/etc/LaunchAgents
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ xinstall -m 0755 -d ${destroot}${docdir}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ file copy {*}[glob -directory ${worksrcpath} COPYING readme.txt] \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${filespath}/README_MacPorts.md \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${destroot}${docdir}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ xinstall -m 0755 -d ${destroot}${prefix}/etc/renderd
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ file rename ${destroot}${prefix}/etc/renderd.conf.orig ${destroot}${prefix}/etc/renderd/renderd.conf.orig
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ xinstall -o root -m 0644 ${worksrcpath}/renderd.conf.dist \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${destroot}${prefix}/etc/renderd/renderd.conf.dist
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ xinstall -m 0755 -d ${destroot}${prefix}/etc/${name}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ xinstall -o root -m 0644 ${worksrcpath}/osm-tiles-update.conf.dist \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${destroot}${prefix}/etc/${name}/osm-tiles-update.conf.dist
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ xinstall -m 0755 -d \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${destroot}${prefix}/share/${name}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ xinstall -m 0755 \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${filespath}/osm_setup_db.sh \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${worksrcpath}/openstreetmap-tiles-update-expire \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${worksrcpath}/osmosis-db_replag \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${destroot}${prefix}/share/${name}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ xinstall -o ${renderd_user} -m 0755 -d ${destroot}${prefix}/var/run/${name}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ xinstall -o ${renderd_user} -m 0755 -d ${destroot}${prefix}/var/lib/${name}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[variant_isset logrotate]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ xinstall -m 0755 -d ${destroot}${prefix}/etc/logrotate.d
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ reinplace "s|PREFIX:-/usr/local|PREFIX:-${prefix}|g" \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${destroot}${prefix}/share/${name}/osm_setup_db.sh \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${destroot}${prefix}/share/${name}/openstreetmap-tiles-update-expire
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ destroot.keepdirs \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${destroot}${prefix}/var/run/${name} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${destroot}${prefix}/var/lib/${name}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+post-activate {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {![file exists ${prefix}/etc/renderd/renderd.conf]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ file copy ${prefix}/etc/renderd/renderd.conf.dist ${prefix}/etc/renderd/renderd.conf
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {![file exists ${prefix}/etc/${name}/osm-tiles-update.conf]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ file copy ${prefix}/etc/${name}/osm-tiles-update.conf.dist ${prefix}/etc/${name}/osm-tiles-update.conf
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {![file exists ${prefix}/etc/logrotate.d/renderd] && [variant_isset logrotate]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ file copy ${filespath}/logrotate.conf ${prefix}/etc/logrotate.d/renderd
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ reinplace "s|@PREFIX@|${prefix}|g" ${prefix}/etc/logrotate.d/renderd
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # renderd actually logs to stderr
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ reinplace "s|StandardOutPath|StandardErrorPath|g" \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${prefix}/etc/LaunchDaemons/${startupitem.uniquename}/${startupitem.uniquename}.plist
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+pre-deactivate {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[variant_isset osmosis]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ system "launchctl unload /Library/LaunchAgents/${agent_uniquename}.plist"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+notes "If this is your first install, you might want to view the notes
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+at ${docdir}/README_MacPorts.md.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+To enable mod_tile in Apache:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ cd ${mdir}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sudo ${apxs} -a -e -n \"tile\" mod_tile.so
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+And then relaunch Apache:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sudo port reload apache2
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+if {[variant_isset osmosis]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ notes-append "To load ${agent_name}:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sudo launchctl load -w /Library/LaunchAgents/${agent_uniquename}.plist
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;color:#808080;'>diff --git a/gis/mod_tile/files/README_MacPorts.md b/gis/mod_tile/files/README_MacPorts.md
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 00000000000..2884eeb7182
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/gis/mod_tile/files/README_MacPorts.md
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,141 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+<!-- -*- mode: markdown; -*- vim: set tw=78 ts=4 sts=0 sw=4 noet ft=markdown norl: -->
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# Port—`mod_tile`
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+## Initial Configuration and Setup
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+This port primarily contains two applications, a daemon, `renderd`, which
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+renders map tiles from the database; and an Apache module, `mod_tile`, which
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+serves those tiles.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+These notes assume the port has been installed with the prefix `/opt/local`.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+Replace with the appropriate prefix if you have installed it elsewhere.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+The port includes a shell script, `/opt/local/share/mod_tile/osm_setup_db.sh`
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+which largely automates the process of downloading and importing OpenStreetMap
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+data into a PostgreSQL database. There are some notes at the beginning of the
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+script on how to use it. Note the section that requires a small modification
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+to the PostgreSQL database configuration to provide the `nobody` system user
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+with database access permission.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+By default the script imports the country of Monaco, situated on the
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+Mediterranean coast to the south of France. It is recommended you experiment
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+with a small area until you are satisfied with the processes involved.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+Depending on the power of the machine employed, processing data for larger
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+areas can take considerable time and resources. Generally, SSD disks are
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+recommended to reduce processing times.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+The script sources variables from
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+`/opt/local/etc/mod_tile/osm-tiles-update.conf`. Update that configuration
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+file appropriately.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+To enable the `mod_tile` module in Apache, install it with:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ $ cd /opt/local/lib/apache2/modules/
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ $ sudo /opt/local/bin/apxs -a -e -n "tile" mod_tile.so
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ $ sudo port reload apache2
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+You should complete the import process before starting the `renderd` daemon
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+process, otherwise it is simply going to report errors. The `renderd` process
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+is started with:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ $ sudo port load mod_tile
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+Optionally, you can download and apply incremental updates to the database by
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+running an import script which can be scheduled with:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ $ sudo launchctl load -w \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ /Library/LaunchAgents/org.macports.fetch-osm-db-updates.plist
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+This script downloads an hourly snapshot, so it has to be run at least that
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+frequently to keep up-to-date. The default installation runs it more
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+frequently to allow it to catch up, allowing for a little downtime. Depending
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+on your requirements, it may be better not to run this process at all and just
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+refresh the entire region every few months or so.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+The output of the various scripts and utilities are written to log files under
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+`/opt/local/var/log/renderd`. A configuration file for `logrotate` is
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+deployed to `/opt/local/etc/logrotate.d/renderd`. Please see the `logrotate`
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+man pages for further information.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+## Cleanup and Starting Afresh
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+To delete the imported data and start afresh, delete the database and the
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+`mod_tile` tile cache.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+As a PostgreSQL super user, drop the database (default `gis`):
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ $ dropdb gis
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+Remove the tile cache with:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ $ sudo rm -rf /opt/local/var/lib/mod_tile/*
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+Remove the state files for incremental updates with:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ $ sudo rm -rf /opt/local/var/lib/mod_tile/.osmosis
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+## Noto Fonts
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+The `mapnik.xml` configuration file attempts to use Google Noto Fonts if they
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+are available under `/opt/local/lib/mapnik/fonts`. Download the fonts and
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+create a symbolic to their installed location:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+1. Download a zip containing the fonts from
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ <https://www.google.com/get/noto/help/install/>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ $ sudo mkdir -p /usr/local/share/fonts/noto
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ $ sudo chown $USER /usr/local/share/fonts/noto
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ $ cd /usr/local/share/fonts/noto
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ $ unzip ~/Downloads/Noto-unhinted.zip
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ $ chmod +r *.?tf
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ $ sudo ln -s /usr/local/share/fonts/noto /opt/local/lib/mapnik/fonts
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+The debug information written to `/opt/local/var/lib/renderd/renderd.log`
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+during the daemon startup reports whether fonts are loaded successfully or
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+not. The configuration is fundamentally a priority preference for normal,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+bold and oblique fonts. It is expected some font varieties will not be found.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+## Changing the Default Database name
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+To use a different database name, it is necessary to modify a number of
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+configuration files:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- `/opt/local/etc/mod_tile/osm-tiles-update.conf`
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- `/opt/local/etc/openstreetmap-carto/external-data.yml`
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- `/opt/local/etc/openstreetmap-carto/mapnik.xml`
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+The `mapnik.xml` configuration file repeatedly defines the database name for
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+every style. It may be easier to re-create the entire configuration file from
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+its original source file as follows:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+1. Make a copy of `/opt/local/share/openstreetmap-carto/project.mml` and edit
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ the `dbname` attribute appropriately in the copy.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+1. Use `carto` to re-create `mapnik.xml` using the copy of the `project.mml`
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ source file:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ $ sudo port install carto
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ $ carto project.mml | sudo tee /opt/local/etc/openstreetmap-carto/mapnik.xml
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+## Useful Resources
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- [mod_tile][]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- [mod_tile_switch2osm][]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- [Osmosis][]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- [OpenStreetMap][]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- [openstreetmap-carto][]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- [OSM Tile Calculator][]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- [PostGIS][]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- [PostgreSQL][]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- [switch2osm][]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+[mod_tile]: https://github.com/openstreetmap/mod_tile "an Apache 2 module to deliver map tiles"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+[mod_tile_switch2osm]: https://github.com/SomeoneElseOSM/mod_tile "an Apache 2 module to deliver map tiles"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+[Osmosis]: https://github.com/openstreetmap/osmosis "a command line Java application for processing Open Street Map data"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+[OpenStreetMap]: http://www.openstreetmap.org/ "OpenStreetMap"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+[openstreetmap-carto]: https://github.com/gravitystorm/openstreetmap-carto "a general-purpose OpenStreetMap mapnik style, in CartoCSS"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+[OSM Tile Calculator]: https://tools.geofabrik.de/calc/#type=geofabrik_standard&bbox=7.405088,43.720716,7.447488,43.753832 "Calculates tile size and number of tiles in given bounding box"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+[PostGIS]: https://postgis.net. "Spatial and Geographic objects for PostgreSQL"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+[PostgreSQL]: https://www.postgresql.org "A powerful, open source object-relational database system"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+[switch2osm]: https://switch2osm.org/ "Switch2OSM—Take back control of your maps"
</span><span style='display:block; white-space:pre;color:#808080;'>diff --git a/gis/mod_tile/files/configure-ac.diff b/gis/mod_tile/files/configure-ac.diff
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 00000000000..957f5c6487f
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/gis/mod_tile/files/configure-ac.diff
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,38 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- configure.ac.orig 2020-09-28 08:43:13.000000000 +0100
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ configure.ac 2021-09-22 11:46:25.000000000 +0100
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -15,12 +15,12 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ AC_PROG_CC
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ AC_PROG_CC_C99
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-dnl Find C++ compiler
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-AC_CHECK_PROG(HAVE_CXX, $CXX, yes, no)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-if test "$HAVE_CXX" = "no"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- AC_MSG_ERROR([Could not find a c++ compiler]);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-fi
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++dnl Find C++ compiler
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++dnl AC_CHECK_PROG(HAVE_CXX, $CXX, yes, no)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++dnl if test "$HAVE_CXX" = "no"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++dnl then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++dnl AC_MSG_ERROR([Could not find a c++ compiler]);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++dnl fi
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Checks for libraries.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -74,9 +74,13 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ AC_MSG_ERROR([Could not find apxs on the path.])
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ fi
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-AC_SEARCH_LIBS([iniparser_load], [iniparser], [
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- AC_CHECK_HEADERS([iniparser.h], [have_system_iniparser=yes])
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-])
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++AC_SEARCH_LIBS([iniparser_load], [iniparser],
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ [
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ AC_CHECK_HEADERS([iniparser/iniparser.h], [have_system_iniparser=yes])
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ ],
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ [
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ AC_MSG_ERROR([Could not find iniparser library.])
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ ])
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ AM_CONDITIONAL([SYSTEM_LIBINIPARSER], [test "x$have_system_iniparser" = "xyes"])
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if test "x$have_system_iniparser" = "xyes"; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ AC_SUBST(SYSTEM_LIBINIPARSER, 1)
</span><span style='display:block; white-space:pre;color:#808080;'>diff --git a/gis/mod_tile/files/logrotate.conf b/gis/mod_tile/files/logrotate.conf
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 00000000000..dfdfb034881
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/gis/mod_tile/files/logrotate.conf
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,3 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@PREFIX@/var/log/renderd/*.log {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ nocreate
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;color:#808080;'>diff --git a/gis/mod_tile/files/makefile-am.diff b/gis/mod_tile/files/makefile-am.diff
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 00000000000..e2279e81421
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/gis/mod_tile/files/makefile-am.diff
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,34 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- Makefile.am.orig 2021-09-21 15:53:08.000000000 +0100
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ Makefile.am 2021-09-21 20:37:24.000000000 +0100
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -1,7 +1,4 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ AUTOMAKE_OPTIONS = foreign
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-if !SYSTEM_LIBINIPARSER
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- SUBDIRS = iniparser3.0b
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ACLOCAL_AMFLAGS = -I m4
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -19,11 +16,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ renderd_SOURCES = src/daemon.c src/daemon_compat.c src/gen_tile.cpp src/sys_utils.c src/request_queue.c src/cache_expire.c src/metatile.cpp src/parameterize_style.cpp src/protocol_helper.c $(STORE_SOURCES)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ renderd_CXXFLAGS = $(MAPNIK_CFLAGS)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ renderd_LDADD = $(PTHREAD_CFLAGS) $(MAPNIK_LDFLAGS) $(STORE_LDFLAGS) -liniparser
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-if !SYSTEM_LIBINIPARSER
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- renderd_SOURCES += iniparser3.0b/libiniparser.la
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- renderd_LDADD += -Liniparser3.0b/.libs
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-renderd_DATA = renderd.conf
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++renderd_DATA = renderd.conf.orig
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ render_speedtest_SOURCES = src/speedtest.cpp src/protocol_helper.c src/render_submit_queue.c src/sys_utils.c
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ render_speedtest_LDADD = $(PTHREAD_CFLAGS)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ render_list_SOURCES = src/render_list.c src/sys_utils.c src/protocol_helper.c src/render_submit_queue.c $(STORE_SOURCES)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -37,10 +30,6 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ gen_tile_test_CFLAGS = -DMAIN_ALREADY_DEFINED $(PTHREAD_CFLAGS)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ gen_tile_test_CXXFLAGS = $(MAPNIK_CFLAGS)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ gen_tile_test_LDADD = $(PTHREAD_CFLAGS) $(MAPNIK_LDFLAGS) $(STORE_LDFLAGS) -liniparser
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-if !SYSTEM_LIBINIPARSER
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- gen_tile_test_SOURCES += iniparser3.0b/libiniparser.la
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- gen_tile_test_LDADD += -Liniparser3.0b/.libs
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ CLEANFILES=*.slo mod_tile.la stderr.out src/*.slo src/*.lo src/.libs/* src/*.la
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;color:#808080;'>diff --git a/gis/mod_tile/files/openstreetmap-tiles-update-expire.diff b/gis/mod_tile/files/openstreetmap-tiles-update-expire.diff
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 00000000000..284fef38872
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/gis/mod_tile/files/openstreetmap-tiles-update-expire.diff
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,159 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- openstreetmap-tiles-update-expire.orig 2021-09-16 18:07:30.000000000 +0100
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ openstreetmap-tiles-update-expire 2021-09-22 19:07:57.000000000 +0100
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -4,13 +4,33 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #*************************************************************************
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #*************************************************************************
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-OSMOSIS_BIN=osmosis
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-OSM2PGSQL_BIN=osm2pgsql
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-OSM2PGSQL_OPTIONS=
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-#OSM2PGSQL_OPTIONS="--flat-nodes /path/to/flatnodes --hstore"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++PREFIX="${PREFIX:-/usr/local}"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++if [ -r ${PREFIX}/etc/mod_tile/osm-tiles-update.conf ]; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ source ${PREFIX}/etc/mod_tile/osm-tiles-update.conf
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++fi
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++# **Note:** Changes merged in from git commit
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++# `dd3c843697cfef8100c05312237d1d63ee44ffde` on the `switch2osm`
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++# branch, of <https://github.com/SomeoneElseOSM/mod_tile.git>.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#------------------------------------------------------------------------------
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++# AJT - change directory to mod_tile directory so that we can run replag
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++# and other things directly from this script when run from cron.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++# Change the actual location to wherever installed locally.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#------------------------------------------------------------------------------
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ACCOUNT="${GIS_USER:-nobody}"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++OSMOSIS_BIN=${PREFIX}/bin/osmosis
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++OSM2PGSQL_BIN=${PREFIX}/bin/osm2pgsql
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++OSM2PGSQL_RAM="${OSM2PGSQL_RAM:-4096}"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++OSM2PGSQL_CPUS="${OSM2PGSQL_CPUS:-4}"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++DBNAME="${GIS_DB:-gis}"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++OSM2PGSQL_OPTIONS="-d $DBNAME -G --hstore --tag-transform-script ${PREFIX}/share/openstreetmap-carto/openstreetmap-carto.lua --number-processes $OSM2PGSQL_CPUS -S ${PREFIX}/share/openstreetmap-carto/openstreetmap-carto.style -C $OSM2PGSQL_RAM"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++TRIM_BIN=${PREFIX}/share/trim_osc/trim_osc.py
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++TRIM_OPTIONS="-d $DBNAME --user $ACCOUNT"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++TRIM_REGION_OPTIONS="${TRIM_REGION_OPTIONS:--p region.poly}"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-BASE_DIR=/var/lib/mod_tile
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-LOG_DIR=/var/log/tiles/
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++BASE_DIR=${PREFIX}/var/lib/mod_tile
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++LOG_DIR=${PREFIX}/var/log/renderd
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ WORKOSM_DIR=$BASE_DIR/.osmosis
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ LOCK_FILE=/tmp/openstreetmap-update-expire-lock.txt
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -21,14 +41,26 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ OSMOSISLOG=$LOG_DIR/osmosis.log
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ PGSQLLOG=$LOG_DIR/osm2pgsql.log
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ EXPIRYLOG=$LOG_DIR/expiry.log
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-RUNLOG=$LOG_DIR/run.log
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++RUNLOG=$LOG_DIR/tile-update.log
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-EXPIRY_MINZOOM=10
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-EXPIRY_MAXZOOM=18
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#------------------------------------------------------------------------------
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++# The tile expiry section below can re-render, delete or dirty expired tiles.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++# By default, tiles between EXPIRY_MINZOOM and EXPIRY_MAXZOOM are rerendered.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++# "render_expired" can optionally delete (and/or dirty) tiles above a certail
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++# threshold rather than rendering them.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++# Here we expire (but don't immediately rerender) tiles between zoom levels
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++# 13 and 18 and delete between 19 and 20.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#------------------------------------------------------------------------------
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++EXPIRY_MINZOOM=13
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++EXPIRY_TOUCHFROM=13
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++EXPIRY_DELETEFROM=19
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++EXPIRY_MAXZOOM=20
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #*************************************************************************
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #*************************************************************************
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++cd "$BASE_DIR"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ m_info()
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ echo "[`date +"%Y-%m-%d %H:%M:%S"`] $$ $1" >> "$RUNLOG"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -76,6 +108,8 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ mkdir $WORKOSM_DIR
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ $OSMOSIS_BIN --read-replication-interval-init workingDirectory=$WORKOSM_DIR 1>&2 2> "$OSMOSISLOG"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ wget "https://replicate-sequences.osm.mazdermind.de/?"$1"T00:00:00Z" -O $WORKOSM_DIR/state.txt
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ mv $WORKOSM_DIR/configuration.txt $WORKOSM_DIR/configuration_orig.txt
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ sed "s!baseUrl=http://planet.openstreetmap.org/replication/minute!baseUrl=https://planet.openstreetmap.org/replication/minute!" $WORKOSM_DIR/configuration_orig.txt > $WORKOSM_DIR/configuration.txt
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ else
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # make sure the lockfile is removed when we exit and then claim it
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -89,9 +123,13 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ exit 2
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ fi
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if [ ! -r $WORKOSM_DIR/state.txt ];then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ m_error "The Osmosis replication system has not yet been initialised"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ fi
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ seq=`cat $WORKOSM_DIR/state.txt | grep sequenceNumber | cut -d= -f2`
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- m_ok "start import from seq-nr $seq, replag is `osmosis-db_replag -h`"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ m_ok "start import from seq-nr $seq, replag is `${PREFIX}/share/mod_tile/osmosis-db_replag -h`"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ /bin/cp $WORKOSM_DIR/state.txt $WORKOSM_DIR/last.state.txt
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ m_ok "downloading diff"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -99,22 +137,56 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if ! $OSMOSIS_BIN --read-replication-interval workingDirectory=$WORKOSM_DIR --simplify-change --write-xml-change $CHANGE_FILE 1>&2 2> "$OSMOSISLOG"; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ m_error "Osmosis error"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ fi
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if [ -x "$TRIM_BIN" ] && [ -n "$TRIM_REGION_OPTIONS" ] ; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ m_ok "filtering diff"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if ! $TRIM_BIN $TRIM_OPTIONS $TRIM_REGION_OPTIONS -z $CHANGE_FILE $CHANGE_FILE 1>&2 2>> "$RUNLOG"; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ m_ok "Trim_osc error but continue anyway"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ fi
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ fi
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ m_ok "importing diff"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- EXPIRY_METAZOOM=`expr $EXPIRY_MAXZOOM - 3`
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- if ! $OSM2PGSQL_BIN -a --slim -e$EXPIRY_METAZOOM:$EXPIRY_METAZOOM $OSM2PGSQL_OPTIONS -o "$EXPIRY_FILE.$$" $CHANGE_FILE 1>&2 2> "$PGSQLLOG"; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#------------------------------------------------------------------------------
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++# Previously openstreetmap-tiles-update-expire tried to dirty layer
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++# "$EXPIRY_MAXZOOM - 3" (which was 15) only. Instead we write all expired
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++# tiles in range to the list (note the "-" rather than ":" in the "-e"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++# parameter).
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#------------------------------------------------------------------------------
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if ! $OSM2PGSQL_BIN -a --slim -e$EXPIRY_MINZOOM-$EXPIRY_MAXZOOM $OSM2PGSQL_OPTIONS -o "$EXPIRY_FILE.$$" $CHANGE_FILE 1>&2 2> "$PGSQLLOG"; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ m_error "osm2pgsql error"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ fi
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- freelock "$LOCK_FILE"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#------------------------------------------------------------------------------
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++# The lockfile is normally removed before we expire tiles because that is
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++# something that can be done in parallel with further processing. In order to
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++# avoid rework, if actually rerendering is done rather than just deleting or
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++# dirtying, it makes sense to move it lower down.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#------------------------------------------------------------------------------
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++# m_ok "Import complete; removing lock file"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++# freelock "$LOCK_FILE"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ m_ok "expiring tiles"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- if ! render_expired --min-zoom=$EXPIRY_MINZOOM --max-zoom=$EXPIRY_MAXZOOM --touch-from=$EXPIRY_MINZOOM -s /run/renderd.sock < "$EXPIRY_FILE.$$" 2>&1 | tail -8 >> "$EXPIRYLOG"; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#------------------------------------------------------------------------------
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++# When expiring tiles we need to define the style sheet if it's not "default".
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++# In this case it's "ajt".
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++# Previously all tiles on the "dirty" list between $EXPIRY_MINZOOM and
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++# $EXPIRY_MAXZOOM were dirtied. We currently re-render
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++# tiles >= $EXPIRY_MINZOOM and < $EXPIRY_DELETEFROM, expiry from 14 and
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++# delete >= $EXPIRY_DELETEFROM and <= $EXPIRY_MAXZOOM.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++# The default path to renderd.sock is fixed.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#------------------------------------------------------------------------------
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if ! render_expired --map=ajt --min-zoom=$EXPIRY_MINZOOM --touch-from=$EXPIRY_TOUCHFROM --delete-from=$EXPIRY_DELETEFROM --max-zoom=$EXPIRY_MAXZOOM --tile-dir=${PREFIX}/var/lib/mod_tile -s ${PREFIX}/var/run/renderd/renderd.sock < "$EXPIRY_FILE.$$" 2>&1 | tail -8 >> "$EXPIRYLOG"; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ m_info "Expiry failed"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ fi
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ rm "$EXPIRY_FILE.$$"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#------------------------------------------------------------------------------
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++# Only remove the lock file after expiry (if system is slow we want to delay
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++# the next import, not have multiple render_expired processes running)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#------------------------------------------------------------------------------
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ freelock "$LOCK_FILE"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ m_ok "Done with import"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;color:#808080;'>diff --git a/gis/mod_tile/files/osm-tiles-update.conf.dist b/gis/mod_tile/files/osm-tiles-update.conf.dist
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 00000000000..ff8ffc67647
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/gis/mod_tile/files/osm-tiles-update.conf.dist
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,10 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# Options for openstreetmap-tiles-update-expire and osm_setup_db.sh scripts
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+OSM2PGSQL_RAM=4096
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+OSM2PGSQL_CPUS=4
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+GIS_DB=gis
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+GIS_USER=nobody
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# Options for osm_setup_db.sh script only
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#EXTERNAL_DATA_EXTRA_OPTIONS='--verbose'
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#PBF_DOWNLOAD_BASE_URL='http://localhost/download'
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#PBF_FILENAME=europe/monaco-latest.osm.pbf
</span><span style='display:block; white-space:pre;color:#808080;'>diff --git a/gis/mod_tile/files/osm_setup_db.sh b/gis/mod_tile/files/osm_setup_db.sh
</span>new file mode 100755
<span style='display:block; white-space:pre;color:#808080;'>index 00000000000..3692e3bf8d4
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/gis/mod_tile/files/osm_setup_db.sh
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,253 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#!/bin/bash
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# The MIT License (MIT)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# Copyright (c) 2021 Frank Dean
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# Permission is hereby granted, free of charge, to any person obtaining a copy
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# of this software and associated documentation files (the "Software"), to
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# deal in the Software without restriction, including without limitation the
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# sell copies of the Software, and to permit persons to whom the Software is
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# furnished to do so, subject to the following conditions:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# The above copyright notice and this permission notice shall be included in
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# all copies or substantial portions of the Software.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# IN THE SOFTWARE.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# - - -
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# This script is designed to run with default MacPorts installations of
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# 'openstreetmap-carto' and 'mod_tile'.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# The script creates the initial database, with a default name of 'gis' and
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# creates a PostgreSQL user, with a default name of 'nobody'. These and other
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# values can be overridden by specifying them as variables on the command
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# line. E.g.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# sudo EXTERNAL_DATA_EXTRA_OPTIONS='--verbose' \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# GIS_DB=osm \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# OSM2PGSQL_RAM=4096 OSM2PGSQL_CPUS=4 ./osm_setup_db.sh
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# Before running this script, you need to ensure that PostgreSQL has been
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# configured for the 'nobody' to be able to access the 'gis' database without
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# a password. Refer to the Ident Authentication section in the PostgreSQL
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# Manual, https://www.postgresql.org/docs/12/auth-ident.html to understand any
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# security implications of this approach.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# The simplest way to configure this is to add an 'ident' method for 'gis' and
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# 'nobody', most likely as the first active line of the configuration in
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# /opt/local/var/db/${postgresql_version}/defaultdb/pg_hba.conf. E.g.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# - - -
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# # TYPE DATABASE USER ADDRESS METHOD
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# local gis nobody ident
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# - - -
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# Reload the PostgreSQL server configuration after making the change. E.g
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# sudo port reload postgresql12-server
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# If the file specified by $PBF_FILENAME exists, it is imported as-is. If it
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# does not exist, it is assumed to be a file hosted at $PBF_DOWNLOAD_BASE_URL,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# e.g. monaco-latest.osm.pdf and curl is used to download it. You may need to
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# install the curl port to support this.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# Version 1.0 - 2021-08-22
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+set +e
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# Enable the following line to debug the script
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#set -x
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+PREFIX="${PREFIX:-/usr/local}"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+if [ -r $PREFIX/etc/mod_tile/osm-tiles-update.conf ]; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ source $PREFIX/etc/mod_tile/osm-tiles-update.conf
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+fi
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+GIS_DB="${GIS_DB:-gis}"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+GIS_USER="${GIS_USER:-nobody}"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+GIS_DB_USER="${GIS_DB_USER:-$GIS_USER}"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+PG_SUPER_USER="${PG_SUPER_USER:-postgres}"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+CURL_BIN="$PREFIX/bin/curl"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+MD5SUM_BIN="$PREFIX/bin/gmd5sum"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+OSM2PGSQL_BIN="$PREFIX/bin/osm2pgsql-lua"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+PBF_DOWNLOAD_BASE_URL="${PBF_DOWNLOAD_BASE_URL:-https://download.geofabrik.de}"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+PBF_FILENAME="${PBF_FILENAME:-europe/monaco-latest.osm.pbf}"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+POLY_FILENAME="${POLY_FILENAME:-europe/monaco.poly}"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+OSM2PGSQL_RAM="${OSM2PGSQL_RAM:-4096}"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+OSM2PGSQL_CPUS="${OSM2PGSQL_CPUS:-4}"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+SKIP_IMPORT="${SKIP_IMPORT:-}"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+EXTERNAL_DATA_EXTRA_OPTIONS="${EXTERNAL_DATA_EXTRA_OPTIONS}"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+CUT_BIN=/usr/bin/cut
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+GREP_BIN=/usr/bin/grep
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+if [ $(id -u) -ne 0 ]; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sudo $0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ exit 0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+fi
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+initializeDatabase()
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+{
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sudo -u "$PG_SUPER_USER" "$PREFIX/bin/createuser" "$GIS_DB_USER" -DRS >/dev/null 2>&1
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sudo -u "$PG_SUPER_USER" "$PREFIX/bin/createdb" "$GIS_DB" --owner="$GIS_DB_USER" --encoding=UTF8 >/dev/null 2>&1
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ cat <<EOF | sudo -u "$PG_SUPER_USER" psql "$GIS_DB" >/dev/null 2>&1
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+CREATE EXTENSION postgis;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+CREATE EXTENSION hstore;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ALTER TABLE geometry_columns OWNER TO $GIS_DB_USER;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ALTER TABLE spatial_ref_sys OWNER TO $GIS_DB_USER;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+EOF
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+readPolyFile()
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+{
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Either uses the local file or attempts to download it
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sudo -u "$GIS_USER" test -r "$POLY_FILENAME"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if [ $? -eq 0 ]; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sudo -u cp "$POLY_FILENAME" "${PREFIX}/var/lib/mod_tile/region.poly"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ else
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ POLY_FILE="${PREFIX}/var/lib/mod_tile/region.poly"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sudo -u "$GIS_USER" test -x "$CURL_BIN"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if [ $? -eq 0 ]; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ >&2 echo "Downloading ${PBF_DOWNLOAD_BASE_URL}/${POLY_FILENAME}..."
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ >&2 echo "Saving to $POLY_FILE"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sudo -u "$GIS_USER" $CURL_BIN --fail -L "${PBF_DOWNLOAD_BASE_URL}/${POLY_FILENAME}" -o "$POLY_FILE"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if [ $? -ne 0 ]; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ >&2 echo "Unable to download ${POLY_FILENAME} from ${PBF_DOWNLOAD_BASE_URL}"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ fi
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ fi
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ fi
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+readPbf()
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+{
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Either uses the local file or attempts to download it
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ cd "${PREFIX}/var/lib/mod_tile"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sudo -u "$GIS_USER" test -r "$PBF_FILENAME"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if [ $? -eq 0 ]; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ PBF_FILE="$PBF_FILENAME"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ else
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sudo -u "$GIS_USER" test -x "$CURL_BIN"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if [ $? -eq 0 ]; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ PBF_FILE=$(basename "${PBF_FILENAME}")
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ >&2 echo "Downloading ${PBF_DOWNLOAD_BASE_URL}/${PBF_FILENAME}..."
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sudo -u "$GIS_USER" $CURL_BIN --fail -L "${PBF_DOWNLOAD_BASE_URL}/${PBF_FILENAME}" -o "$PBF_FILE"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if [ $? -ne 0 ]; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ >&2 echo "Unable to download ${PBF_FILENAME} from ${PBF_DOWNLOAD_BASE_URL}"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ exit 1
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ else
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sudo -u "$GIS_USER" test -x "$MD5SUM_BIN"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if [ $? -eq 0 ]; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sudo -u "$GIS_USER" $CURL_BIN --fail -L "${PBF_DOWNLOAD_BASE_URL}/${PBF_FILENAME}.md5" -o "${PBF_FILE}.md5"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if [ $? -eq 0 ]; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ MD5_RESULT="$($MD5SUM_BIN -c ${PBF_FILE}.md5 2>&1 > /dev/null)"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if [ $? -eq "0" ]; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ >&2 echo "${PBF_FILE} checksum OK"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ else
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ >&2 echo "Checksum failed, aborted: $MD5_RESULT"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ exit 1
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ fi
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ else
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ >&2 echo "MD5 not checked-download not available for checking"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ fi
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ fi
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ fi
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ fi
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ fi
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+createDatabase()
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+{
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Create indexes to support the style definitions from openstreetmap-carto
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sudo -u "$GIS_USER" test -r "$PBF_FILE"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if [ $? -eq 0 ]; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ >&2 echo "Importing from $PBF_FILE... (This can take a very long time, depending on import size and other factors)"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sudo -u nobody "$OSM2PGSQL_BIN" -d "$GIS_DB" \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ --create --slim -G --hstore \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ --tag-transform-script \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ "$PREFIX/share/openstreetmap-carto/openstreetmap-carto.lua" \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ -C "$OSM2PGSQL_RAM" --number-processes "$OSM2PGSQL_CPUS" \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ -S "$PREFIX/share/openstreetmap-carto/openstreetmap-carto.style" \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ --input-reader='pbf' \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ "$PBF_FILE"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if [ $? -ne 0 ]; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ >&2 echo "Error importing $PBF_FILE"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ exit 1
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ fi
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ >&2 echo "Creating indexes... (This can also take a very long time)"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sudo -u "$GIS_USER" psql -d "$GIS_DB" -U "$GIS_DB_USER" \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ -f "$PREFIX/share/openstreetmap-carto/indexes.sql" >/dev/null
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if [ $? -ne 0 ]; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ >&2 echo "Error creating indexes in PostgreSQL"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ exit 1
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ fi
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ fi
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+downloadExternalData()
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+{
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Download polygons for water, icesheets and administrative boundaries
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sudo -u "$GIS_USER" test -d "$PREFIX/var/lib/openstreetmap-carto"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if [ $? -eq 0 ]; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sudo -u "$GIS_USER" test -x "$PREFIX/share/openstreetmap-carto/scripts/get-external-data.py"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if [ $? -eq 0 ]; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ >&2 echo "Importing external data (boundaries, water & icesheet polygons)..."
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ cd "$PREFIX/share/openstreetmap-carto"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sudo -u "$GIS_USER" \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ "$PREFIX/share/openstreetmap-carto/scripts/get-external-data.py" \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ $EXTERNAL_DATA_EXTRA_OPTIONS
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if [ $? -ne 0 ]; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ >&2 echo "Error downloading and importing external data"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ exit 1
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ fi
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ else
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ >&2 echo "Unable to import external data – $PREFIX/share/openstreetmap-carto/scripts/get-external-data.py script does not exist or is not executable"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ fi
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ else
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ >&2 echo "Unable to import external data – $PREFIX/var/lib/openstreetmap-carto directory does not exist"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ fi
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+initializeIncrementalUpdates()
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+{
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if [ -d "$PREFIX/var/lib/mod_tile/.osmosis" ]; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ rm -rf "$PREFIX/var/lib/mod_tile/.osmosis"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ fi
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Save the timestamp of the PBF file as a baseline for incremental updates
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if [ -x "$PREFIX/share/mod_tile/openstreetmap-tiles-update-expire" ]; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if [ -x "$PREFIX/bin/osmium" ]; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ timestamp=$("$PREFIX/bin/osmium" fileinfo --input-format=pbf "$PBF_FILE" | "$GREP_BIN" osmosis_replication_timestamp | "$CUT_BIN" -b35-)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if [ -n "$timestamp" ]; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ >&2 echo "Initializing baseline timestamp for incremental updates to '$timestamp'"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sudo -u nobody "$PREFIX/share/mod_tile/openstreetmap-tiles-update-expire" "$timestamp"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ else
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ >&2 echo "Unable to extract timestamp from ${PBF_FILE}"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ fi
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ else
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ >&2 echo "Not initializing baseline timestamp for incremental updates as osmium is not installed"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ fi
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ else
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ >&2 echo "Not initializing baseline timestamp for incremental updates as the update script is not executable"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ fi
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+if [ -z "$SKIP_IMPORT" ]; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ initializeDatabase
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ readPbf
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ readPolyFile
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ createDatabase
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ initializeIncrementalUpdates
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+fi
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+downloadExternalData
</span><span style='display:block; white-space:pre;color:#808080;'>diff --git a/gis/mod_tile/files/osmosis-db_replag.diff b/gis/mod_tile/files/osmosis-db_replag.diff
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 00000000000..2966d8fe60f
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/gis/mod_tile/files/osmosis-db_replag.diff
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,38 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- osmosis-db_replag.orig 2021-08-25 14:21:18.000000000 +0100
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ osmosis-db_replag 2021-08-27 16:29:57.000000000 +0100
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -1,13 +1,24 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #!/bin/bash
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-STATE=/var/lib/mod_tile/.osmosis/state.txt
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++STATE=@PREFIX@/var/lib/mod_tile/.osmosis/state.txt
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-rep=`cat ${STATE} |\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++if [ ! -r "$STATE" ]; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ echo "-1 seconds"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ exit 0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++fi
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++if [[ "$OSTYPE" != "darwin"* ]]; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ rep=`cat ${STATE} |\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ grep 'timestamp' |\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ awk '{split($0, a, "="); print a[2]}' |\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ tr 'T' ' ' |\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ xargs -I{} ${BINPATH}date --utc --date "{}" +%s`
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-is=`date --utc +%s`
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ is=`date --utc +%s`
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++else
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ rep=`cat ${STATE} |\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ awk '/timestamp=/{d = substr($1, 11, 10);t = substr($1, 22, 10); z = substr($1, 32); if (z = "Z") {z = "UTC";}; print d " " t z;}' |\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ xargs -I{} ${BINPATH}date -ju -f "%Y-%m-%d %H:%M:%S%Z" "{}" +%s`
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ is=`date -u +%s`
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++fi
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ lag=$(($is - $rep))
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if [ "$1" = "-h" ]; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -22,4 +33,4 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ echo $lag;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-fi
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+\ No newline at end of file
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++fi
</span><span style='display:block; white-space:pre;color:#808080;'>diff --git a/gis/mod_tile/files/renderd.conf.dist b/gis/mod_tile/files/renderd.conf.dist
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 00000000000..558ac0ac3ba
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/gis/mod_tile/files/renderd.conf.dist
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,18 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+[renderd]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+num_threads=16
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+tile_dir=@PREFIX@/var/lib/mod_tile
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+stats_file=@PREFIX@/var/run/renderd/renderd.stats
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+socketname=@PREFIX@/var/run/renderd/renderd.sock
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+[mapnik]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+plugins_dir=@PREFIX@/lib/mapnik/input
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+font_dir=@PREFIX@/lib/mapnik/fonts
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+font_dir_recurse=1
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+[ajt]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+URI=/tile/
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+TILEDIR=@PREFIX@/var/lib/mod_tile
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+XML=@PREFIX@/etc/openstreetmap-carto/mapnik.xml
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+HOST=localhost
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+TILESIZE=256
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+MAXZOOM=20
</span><span style='display:block; white-space:pre;color:#808080;'>diff --git a/gis/mod_tile/files/src-daemon-c.diff b/gis/mod_tile/files/src-daemon-c.diff
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 00000000000..270c21db015
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/gis/mod_tile/files/src-daemon-c.diff
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,11 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- src/daemon.c.orig 2021-09-21 20:20:15.000000000 +0100
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ src/daemon.c 2021-09-21 20:20:34.000000000 +0100
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -29,7 +29,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #define PIDFILE "/run/renderd/renderd.pid"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #if SYSTEM_LIBINIPARSER
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-#include <iniparser.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#include <iniparser/iniparser.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #else
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ // extern "C" {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #include "iniparser3.0b/src/iniparser.h"
</span><span style='display:block; white-space:pre;color:#808080;'>diff --git a/gis/mod_tile/files/src-mod_tile-c.diff b/gis/mod_tile/files/src-mod_tile-c.diff
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 00000000000..5d74c8530aa
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/gis/mod_tile/files/src-mod_tile-c.diff
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,15 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- src/mod_tile.c~ 2020-09-28 08:43:13.000000000 +0100
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ src/mod_tile.c 2021-07-20 17:04:03.000000000 +0100
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -753,7 +753,11 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- hashkey = (ip.s6_addr32[0] ^ ip.s6_addr32[1] ^ ip.s6_addr32[2] ^ ip.s6_addr32[3]) % DELAY_HASHTABLE_SIZE;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ // hashkey = (ip.s6_addr32[0] ^ ip.s6_addr32[1] ^ ip.s6_addr32[2] ^ ip.s6_addr32[3]) % DELAY_HASHTABLE_SIZE;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ // See https://github.com/openstreetmap/mod_tile/commit/8307d19ab7040691b1fd243052b6668a14f4df1f
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ // and https://github.com/openstreetmap/mod_tile/issues/114
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ // https://github.com/openstreetmap/mod_tile/issues/106
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ hashkey = (*((uint32_t *)(&ip.s6_addr[0])) ^ *((uint32_t *)(&ip.s6_addr[4])) ^ *((uint32_t *)(&ip.s6_addr[8])) ^ *((uint32_t *)(&ip.s6_addr[12]))) % DELAY_HASHTABLE_SIZE;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ /* If a delaypool fillup is ongoing, just skip accounting to not block on a lock */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (delayp->locked) {
</span><span style='display:block; white-space:pre;color:#808080;'>diff --git a/gis/mod_tile/files/src-render_submit_queue-c.diff b/gis/mod_tile/files/src-render_submit_queue-c.diff
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 00000000000..585a5d110a4
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/gis/mod_tile/files/src-render_submit_queue-c.diff
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,10 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- src/render_submit_queue.c~ 2020-09-28 08:43:13.000000000 +0100
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ src/render_submit_queue.c 2021-07-20 17:02:14.000000000 +0100
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -7,6 +7,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #include <stdlib.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #include <sys/time.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #include <errno.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#include <string.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #include "render_submit_queue.h"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #include "sys_utils.h"
</span></pre><pre style='margin:0'>
</pre>