Update run.sh for dealing with lang argument (second arg of the script)
This commit is contained in:
@@ -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
|
||||
fi
|
||||
else
|
||||
carto "openstreetmap-carto-be/project-${lang}.mml" > mapnik-${lang}.xml
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
if [ "$#" -ne 1 ]; then
|
||||
if [ "$#" -gt 2 ]; then
|
||||
echo "usage: <import|run>"
|
||||
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/*
|
||||
|
||||
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
|
||||
|
||||
if [ -z "$2" ]; then
|
||||
compileStyle $2
|
||||
else
|
||||
compileStyle
|
||||
fi
|
||||
|
||||
service postgresql start
|
||||
service apache2 restart
|
||||
|
||||
Reference in New Issue
Block a user