get-icon.sh
753 Bytes
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
#!/bin/sh
ICON=$1
THEME=$2
SVG=$3
if [ -z $ICON ] || [ -z $THEME ] || [ -z $SVG ]; then
echo "use: $0 <ICON> <THEME> <ICON>"
echo "example:"
echo " $0 close Nuovo stock/gtk-close.svg"
exit 1
fi
SECTION="$(dirname $SVG)/"
PNG=$(basename $SVG | sed -e 's/\.svg/\.png/')
SVGFILE=/usr/share/icons/$THEME/scalable/$SVG
if [ ! -f $SVGFILE ]; then
echo "$SVGFILE not found, stopping."
exit 2
fi
rsvg -h 24 -h 24 $SVGFILE $PNG
if [ ! -f $PNG ]; then
echo "Error creating $PNG, stopping."
exit 2
fi
if [ -e .svn ]; then
svn add $PNG
else
git add $PNG
fi
LINE=$(printf "%-25s %-12s %s" $PNG $THEME $SECTION)
sed -i -e "s!### END OF ICONS LISTING ###!$LINE\n&!" README
echo ".icon-$ICON { background-image: url($PNG); }" >> style.css