updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / josm-smallscreen / resize-plugins.sh
blobbe9dd5e6da4f74763db18e8ad32c14ed55fe7d3b
1 #!/bin/sh
2 backupdir=`mktemp -d /tmp/josm-plugins.XXXXXXXXXX`
3 cp -r ~/.josm/plugins $backupdir
4 echo Backup is in $backupdir. Press Enter to continue, Ctrl-C to cancel
5 read
7 for jarfile in `find ~/.josm/plugins -iname '*.jar'`; do
8 tempdir=`mktemp -d /tmp/josm-smallscreen.XXXXXXXXXX`
9 echo
10 echo Processing $jarfile in $tempdir
11 cd $tempdir
12 fastjar -xf $jarfile
13 if [ -e josm-smallscreen ]; then
14 echo Already processed. Skipping...
15 continue
17 for image in `find -iname '*.png'`; do
18 size=`identify $image | cut -f 3 -d ' ' | cut -f 1 -d x`
19 if [ $size -ge 24 -a $size -le 48 ]; then
20 echo Resizing $image "(was $size)"
21 convert $image -resize 60% $image
23 done
24 echo
25 touch josm-smallscreen
27 # Create unsigned jar-file
28 sed '/^\s\?$/q' -i META-INF/MANIFEST.MF # remove all but first paragraph
29 rm -f META-INF/*.RSA META-INF/*.SF
31 fastjar -cfm $jarfile META-INF/MANIFEST.MF *
32 rm -rf $tempdir
33 done