Adjust hornsey thater icons a bit
[moblin-icon-theme.git] / create-icon-theme.sh
blobf038c28f94502aac201c9015920aa91bd92886d6
1 #! /bin/bash
3 if [ "x$1" = "x" ]
4 then
5 echo "Usage: $0 [icon theme directory]"
6 exit 1
7 fi
9 THEME_NAME=`echo "$1" | sed -e 's,/$,,'`
10 THEME_COMMENT="$THEME_NAME Icon Theme"
12 OUTPUT=$(echo "output/$1" | sed 's/ //')
13 OUTPUT=`pwd`/$OUTPUT
15 rm -rf "$OUTPUT"
17 mkdir -p "$OUTPUT"
19 CWD=`pwd`
20 cd "$1"
21 cp -r * $OUTPUT
22 cd $CWD
25 echo "Creating icon theme in '$OUTPUT'"
27 echo "Copying build files.."
29 cp build/* "$OUTPUT"
31 cd "$OUTPUT"
33 echo "Creating index.theme"
35 echo -e "[Icon Theme]\nName=$THEME_NAME\nComment=$THEME_COMMENT\n" > index.theme
36 echo -n "Directories=" >> index.theme
38 DIRS=`find * -type d | grep -v git | grep -v scalable | grep "/"`
40 for foo in $DIRS
42 echo -n "$foo," >> index.theme
43 done
45 for foo in $DIRS
47 echo -en "\n\n[$foo]\nSize=`echo $foo | sed 's/\x.*//'`\nContext=`basename $foo`\nType=Fixed" >> index.theme
48 done
51 echo "Creating Makefiles"
53 SIZES=$(find * -maxdepth 0 -type d -not -name 'scalable' -printf '%f ')
55 MAKEFILES='Makefile\n'
56 for dir in $SIZES
58 subdirs=$(find $dir/* -maxdepth 0 -type d -printf '%f ')
59 echo "SUBDIRS=$subdirs" > $dir/Makefile.am
60 MAKEFILES="$MAKEFILES\n$dir/Makefile"
61 for context in $subdirs
64 MAKEFILES="$MAKEFILES\n$dir/$context/Makefile"
65 files=`echo $dir/$context/*.png|sed "s/$dir\/$context\///g"`
66 echo "themedir = \$(datadir)/icons/$THEME_NAME/$dir/$context" > $dir/$context/Makefile.am
67 echo "theme_DATA = $files" >> $dir/$context/Makefile.am
68 echo "EXTRA_DIST = \$(theme_DATA)" >> $dir/$context/Makefile.am
69 echo "install-data-local: install-themeDATA" >> $dir/$context/Makefile.am
70 echo " (cd \"\$(DESTDIR)\$(themedir)\" && \$(ICONMAP) -c $context )" >> $dir/$context/Makefile.am
71 echo "MAINTAINERCLEANFILES = Makefile.in" >> $dir/$context/Makefile.am
72 done
73 done
75 echo "Updating configure.ac"
76 M=`echo "$MAKEFILES" | sed 's/\//\\\\\//g'`
77 sed -i -e "s/MAKEFILES/$M/" configure.ac
79 echo "Updating Makefile.am"
80 sed -i -e "s/REAL_SUB_DIRS/$SIZES/" Makefile.am
81 sed -i -e "s/THEME_NAME/$THEME_NAME/" Makefile.am
83 echo "Done"