summaryrefslogtreecommitdiffstats
path: root/generate.sh
diff options
context:
space:
mode:
Diffstat (limited to 'generate.sh')
-rw-r--r--[-rwxr-xr-x]generate.sh18
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