Contents of /data/icons/josm_import.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (show annotations)
Tue Dec 9 20:06:06 2008 UTC (15 years, 4 months ago) by harbaum
File MIME type: application/x-sh
File size: 1200 byte(s)
Initial import
1 #!/bin/bash
2 #
3 # Copy all images from the given JOSM images path to the osm2go icon path
4 # and adjust their size
5 #
6 # Only process files that are actually referenced in presets.xml
7 # and elemstyles.xml
8 #
9
10 SIZE="24x24"
11 STYLE="styles/standard/"
12
13 if [ "$1" == "" ]; then
14 echo "Usage: $0 JOSM_IMAGES_PATH"
15 exit 0;
16 fi;
17
18 # cut trailing slash if present
19 CPATH=${1%/}
20
21 rm -rf $SUBDIRS
22
23 for f in `find $CPATH -iname '*.png'`; do
24 NAME=.`echo $f | cut -b $[${#CPATH}+1]-`
25 FOUND=""
26
27 # search in presets.xml
28 PRESETNAME=`echo $NAME | cut -b 3-`
29 if [ "`grep $PRESETNAME ../presets.xml`" != "" ]; then
30 echo "$NAME is referenced in presets.xml";
31 FOUND="true"
32 fi;
33
34 # search in elemstyles.xml
35 # elemstyle references the files without the leading
36 # "styles/standard/"
37 if [ "`echo $PRESETNAME | grep $STYLE`" != "" ]; then
38 ELEMNAME=`echo $PRESETNAME | cut -b $[${#STYLE}+1]-`
39 if [ "`grep $ELEMNAME ../elemstyles.xml`" != "" ]; then
40 echo "$NAME is referenced in elemstyles.xml";
41 FOUND="true"
42 fi;
43 fi;
44
45 if [ "$FOUND" != "" ]; then
46 mkdir -p `dirname $NAME`
47 convert $f -scale $SIZE $NAME;
48 else
49 echo "Skipping unused $NAME"
50 fi;
51
52 done;

Properties

Name Value
svn:executable