diff --git a/run.sh b/run.sh index c591421..72ed14f 100755 --- a/run.sh +++ b/run.sh @@ -13,7 +13,7 @@ function setPostgresPassword() { } function compileStyle() { - local lang=$1 + local lang="${1:-}" cd /data/style/ git clone --single-branch --branch v6.0.0 https://github.com/osmbe/openstreetmap-carto-be --depth 1 mkdir /data/style/patterns/ @@ -26,12 +26,14 @@ function compileStyle() { if [ -z "$lang" ]; then carto openstreetmap-carto-be/project.mml > mapnik.xml return 1 + else + carto "openstreetmap-carto-be/project-${lang}.mml" > mapnik-${lang}.xml + return 1 fi - carto "openstreetmap-carto-be/project-${lang}.mml" > mapnik-${lang}.xml } -if [ "$#" -ne 1 ]; then +if [ "$#" -gt 2 ]; then echo "usage: " echo "commands:" echo " import: Set up the database and import /data/region.osm.pbf" @@ -54,7 +56,11 @@ fi if [ "$1" == "import" ]; then - compileStyle $2 + if [ "$#" -gt 1 ]; then + compileStyle "$2" + else + compileStyle + fi # Ensure that database directory is in right state mkdir -p /data/database/postgres/ @@ -146,7 +152,11 @@ if [ "$1" == "run" ]; then # Clean /tmp rm -rf /tmp/* - compileStyle $2 + if [ -z "$2" ]; then + compileStyle $2 + else + compileStyle + fi # migrate old files if [ -f /data/database/PG_VERSION ] && ! [ -d /data/database/postgres/ ]; then @@ -212,7 +222,11 @@ fi if [ "$1" == "generate_tiles" ]; then - compileStyle $2 + if [ -z "$2" ]; then + compileStyle $2 + else + compileStyle + fi service postgresql start service apache2 restart