diff options
author | Suren A. Chilingaryan <csa@suren.me> | 2022-06-26 01:59:38 +0400 |
---|---|---|
committer | Suren A. Chilingaryan <csa@suren.me> | 2022-06-26 01:59:38 +0400 |
commit | 0f437199b65025a903d568be87747cf5eb4b9805 (patch) | |
tree | 72f05f8ce69af6348e5c2521632f5ada5781f3ba /generate.sh | |
parent | 90d1bf5893a9a373eccd40693f801aa74c3ad36b (diff) | |
download | openmtbmap-0f437199b65025a903d568be87747cf5eb4b9805.tar.gz openmtbmap-0f437199b65025a903d568be87747cf5eb4b9805.tar.bz2 openmtbmap-0f437199b65025a903d568be87747cf5eb4b9805.tar.xz openmtbmap-0f437199b65025a903d568be87747cf5eb4b9805.zip |
Diffstat (limited to 'generate.sh')
-rw-r--r--[-rwxr-xr-x] | generate.sh | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/generate.sh b/generate.sh index ae4fdad..517c2e9 100755..100644 --- a/generate.sh +++ b/generate.sh @@ -7,7 +7,8 @@ function prepare { 7z x -owork $1 &> /dev/null [ $? -ne 0 ] && 7z x -owork $1 - for file_name in `find work -maxdepth 1 -name "???"`; do mv $file_name/* work/ ; done + for file_name in `find work -maxdepth 1 -type d -name "???"`; do mv $file_name/* work/ ; done + for file_name in `find work -maxdepth 1 -type d -regextype posix-extended -iregex ".*($name|mtb$name|velo$name)"`; do mv $file_name/* work/ ; done } function clean { @@ -19,25 +20,18 @@ if [ -z "$1" ]; then exit 1 fi -file=$1 +file="$1" +name="$2" +img="$3" echo "====> Generating Garmin maps for $file" -if [[ "$file" =~ "velo" ]]; then - typ=velo*.TYP - name=`basename $file .exe | cut -c 5-` - img=maps/velo-$name.img -else - name=`basename $file .exe | cut -c 4-` - img=maps/mtb-$name.img -fi - if [ -f $img ]; then echo "Already existing, skipping..." exit 0 fi -prepare $file +prepare "$file" if [ ! -f work/$typ ]; then [ -f work/clas*.TYP ] && typ=clas*.TYP |