-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
icon-private-copy.sh
executable file
·62 lines (49 loc) · 1.65 KB
/
icon-private-copy.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/sh
if [ $# -ne 3 -a $# -ne 4 ]; then
echo "You need to supply three mandatory arguments, e.g.:"
echo "$0 apps/internet-mail apps/kmail ../../../../kdepim/kmail/icons/"
echo "...and optionally the namespace (e.g. \"ox\" or \"hi\") as fourth argument."
exit
fi
# Split the two arguments into their category and icon name parts.
src="$1"
src_category=${src%/*}
src_icon=${src#*/}
dest="$2"
dest_category=${dest%/*}
dest_icon=${dest#*/}
destdir="$3"
ns="ox"
if [ $# -eq 4 ]; then
ns="$4"
fi
svn add $destdir
# Copy the scalable icon.
if [ -f scalable/$src.svgz ]; then
echo "Copying scalable/$src.svgz to $destdir/${ns}sc-$dest_category-$dest_icon.svgz..."
svn cp scalable/$src.svgz $destdir/${ns}sc-$dest_category-$dest_icon.svgz
echo
fi
# Copy the optimized small versions of the icon.
for size in 8 16 22 32 48 64 128 256; do
dir="${size}x${size}"
if [ -f scalable/$src_category/small/$dir/$src_icon.svgz ]; then
echo "Copying scalable/$src_category/small/$dir/$src_icon.svgz"
echo " to $destdir/${ns}$size-$dest_category-$dest_icon.svgz..."
# Generate the size dir for smaller SVGs (e.g. icons/22x22/) if necessary.
if [ ! -d $destdir/small ]; then
svn mkdir $destdir/small
fi
svn cp scalable/$src_category/small/$dir/$src_icon.svgz $destdir/small/${ns}$size-$dest_category-$dest_icon.svgz
echo
fi
done
# Copy the rendered PNGs.
for size in 8 16 22 32 48 64 128 256; do
dir="${size}x${size}"
if [ -f $dir/$src.png ]; then
echo "Copying $dir/$src.png to $destdir/${ns}$size-$dest_category-$dest_icon.png..."
svn cp $dir/$src.png $destdir/${ns}$size-$dest_category-$dest_icon.png
echo
fi
done