From 85b7a8261d9fc60c210c12e8cb583b2bb027dba0 Mon Sep 17 00:00:00 2001 From: nobohan Date: Fri, 2 May 2025 15:06:14 +0200 Subject: [PATCH] Add a lang parameter to the run script --- run.sh | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/run.sh b/run.sh index cb02cbd..a86d016 100755 --- a/run.sh +++ b/run.sh @@ -13,6 +13,7 @@ function setPostgresPassword() { } function compileStyle() { + local lang=$1 cd /data/style/ git clone --single-branch --branch update-2025 https://github.com/nobohan/openstreetmap-carto-be --depth 1 mkdir /data/style/patterns/ @@ -22,7 +23,11 @@ function compileStyle() { mkdir /data/style/scripts/ mv /data/style/openstreetmap-carto-be/scripts/* /data/style/scripts/ mv /data/style/openstreetmap-carto-be/external-data.yml /data/style/external-data.yml - carto openstreetmap-carto-be/project.mml > mapnik.xml + if [ -z "$lang" ]; then + carto openstreetmap-carto-be/project.mml > mapnik.xml + return 1 + fi + carto "openstreetmap-carto-be/project-${lang}.mml" > mapnik-${lang}.xml } @@ -49,7 +54,7 @@ fi if [ "$1" == "import" ]; then - compileStyle + compileStyle $2 # Ensure that database directory is in right state mkdir -p /data/database/postgres/ @@ -141,7 +146,7 @@ if [ "$1" == "run" ]; then # Clean /tmp rm -rf /tmp/* - compileStyle + compileStyle $2 # migrate old files if [ -f /data/database/PG_VERSION ] && ! [ -d /data/database/postgres/ ]; then @@ -207,17 +212,20 @@ fi if [ "$1" == "generate_tiles" ]; then - compileStyle + compileStyle $2 service postgresql start service apache2 restart sudo -u renderer renderd -c /etc/renderd.conf - render_list --map osmbe -n 36 --min-zoom=0 --max-zoom=7 --all - - cat /data/tiles/osmbe/tiles.list | render_list --map osmbe -n 36 + if [ -z "$2" ]; then + render_list --map osmbe -n 36 --min-zoom=0 --max-zoom=7 --all + cat /data/tiles/osmbe/tiles.list | render_list --map osmbe -n 36 + bash + render_list --map osmbe_${$2} -n 36 --min-zoom=0 --max-zoom=7 --all + cat /data/tiles/osmbe/tiles.list | render_list --map osmbe_${$2} -n 36 bash fi