Add a lang parameter to the run script

This commit is contained in:
nobohan 2025-05-02 15:06:14 +02:00
parent 4efa0b0ea1
commit 85b7a8261d

22
run.sh
View File

@ -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