diff --git a/README.md b/README.md index bc9ce61..9fdfbd8 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ This image respects the following custom environment variables to be passed duri - `tile_urls`: Add as many (space-separated) URLs as you like, e.g. https://download.geofabrik.de/europe/andorra-latest.osm.pbf - `use_tiles_ignore_pbf`: `True` uses a local tile.tar file and skips building. Default `True`. -- `force_rebuild`: `True` forces a rebuild of the routing tiles. Default `False`. +- `force_rebuild`: `True` forces a rebuild of the routing tiles and sets `build_tar` to `Force`. Default `False`. - `build_elevation`: `True` downloads elevation tiles which are covering the routing graph. `Force` will do the same, but first delete any existing elevation tiles. Default `False`. - `build_admins`: `True` builds the admin db needed for things like border-crossing penalties and detailed routing responses. `Force` will do the same, but first delete the existing db. Default `False`. - `build_time_zones`: `True` builds the timezone db which is needed for time-dependent routing. `Force` will do the same, but first delete the existing db. Default `False`. diff --git a/scripts/run.sh b/scripts/run.sh index 2b4545a..5463004 100755 --- a/scripts/run.sh +++ b/scripts/run.sh @@ -17,11 +17,15 @@ run_cmd() { } do_build_tar() { - if ([[ ${build_tar} == "True" && ! -f $TILE_TAR ]]) || [[ ${build_tar} == "Force" ]]; then + local build_tar_local=$1 + if ([[ ${build_tar_local} == "True" && ! -f $TILE_TAR ]]) || [[ ${build_tar_local} == "Force" ]]; then options="-c ${CONFIG_FILE} -v" if ! [[ -z ${traffic_name} ]]; then options="${options} -t" fi + if [[${build_tar_local} == "Force" ]]; then + options="${options} --overwrite" + fi run_cmd "valhalla_build_extract ${options}" fi } @@ -49,14 +53,17 @@ fi if [[ -z $serve_tiles ]]; then serve_tiles="True" fi +if [[ "$force_rebuild" == "True" ]]; then + build_tar="Force" +fi # evaluate CMD if [[ $1 == "build_tiles" ]]; then run_cmd "/valhalla/scripts/configure_valhalla.sh ${CONFIG_FILE} ${CUSTOM_FILES} ${TILE_DIR} ${TILE_TAR}" # tar tiles unless not wanted - if [[ "$build_tar" == "True" ]] || [[ ${build_tar} == "Force" ]]; then - do_build_tar + if [[ "$build_tar" == "True" ]] || [[ "$build_tar" == "Force" ]]; then + do_build_tar "$build_tar" else echo "WARNING: Skipping tar building. Expect degraded performance while using Valhalla." fi @@ -86,7 +93,7 @@ if [[ $1 == "build_tiles" ]]; then echo "INFO: Not serving tiles. Exiting." fi elif [[ $1 == "tar_tiles" ]]; then - do_build_tar + do_build_tar "$build_tar" else echo "ERROR: Unrecognized CMD: '$1'" exit 1