diff options
author | Ilya Zverev <zverik@textual.ru> | 2018-01-25 12:51:15 +0300 |
---|---|---|
committer | Roman Kuznetsov <r.kuznetsow@gmail.com> | 2018-02-13 12:55:59 +0300 |
commit | 8906f0b7c9a215cf52ac8f63ee6c8515fd831776 (patch) | |
tree | 0044507368d61d8ec16cb2811b9cfca2de890b72 | |
parent | 22cbb4aea9c46cc8751e66ae624ee22e5eb1f8ea (diff) |
[generator] Backup old borders regardless of options
-rwxr-xr-x | tools/unix/generate_planet.sh | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/tools/unix/generate_planet.sh b/tools/unix/generate_planet.sh index d21e13f592..2806ab2230 100755 --- a/tools/unix/generate_planet.sh +++ b/tools/unix/generate_planet.sh @@ -201,23 +201,22 @@ source "$SCRIPTS_PATH/find_generator_tool.sh" # Prepare borders mkdir -p "$TARGET/borders" +if [ -n "$(ls "$TARGET/borders" | grep '\.poly')" ]; then + # Backup old borders + BORDERS_BACKUP_PATH="$TARGET/borders.$(date +%Y%m%d%H%M%S)" + mkdir -p "$BORDERS_BACKUP_PATH" + log "BORDERS" "Note: old borders from $TARGET/borders were moved to $BORDERS_BACKUP_PATH" + mv "$TARGET/borders"/*.poly "$BORDERS_BACKUP_PATH" +fi NO_REGIONS= if [ -n "${REGIONS:-}" ]; then - # If region files are specified, backup old borders and copy new - if [ -n "$(ls "$TARGET/borders" | grep '\.poly')" ]; then - BORDERS_BACKUP_PATH="$TARGET/borders.$(date +%Y%m%d%H%M%S)" - mkdir -p "$BORDERS_BACKUP_PATH" - log "BORDERS" "Note: old borders from $TARGET/borders were moved to $BORDERS_BACKUP_PATH" - mv "$TARGET/borders"/*.poly "$BORDERS_BACKUP_PATH" - fi echo "$REGIONS" | xargs -I % cp "%" "$TARGET/borders/" elif [ -z "${REGIONS-1}" ]; then # A user asked specifically for no regions NO_REGIONS=1 -elif [ -z "$(ls "$TARGET/borders" | grep '\.poly')" ]; then - # If there are no borders, copy them from $BORDERS_PATH - BORDERS_PATH="${BORDERS_PATH:-$DATA_PATH/borders}" - cp "$BORDERS_PATH"/*.poly "$TARGET/borders/" +else + # Copy borders from $BORDERS_PATH or omim/data/borders + cp "${BORDERS_PATH:-$DATA_PATH/borders}"/*.poly "$TARGET/borders/" fi [ -z "$NO_REGIONS" -a -z "$(ls "$TARGET/borders" | grep '\.poly')" ] && fail "No border polygons found, please use REGIONS or BORDER_PATH variables" ULIMIT_REQ=$((3 * $(ls "$TARGET/borders" | { grep '\.poly' || true; } | wc -l))) |