#!/bin/bash rm temp -rf mkdir temp cp theme temp -r cp options temp -r cp icon.png temp/theme cp icon.png temp/options cd temp cd theme/icons echo "Generating icon layers..." SIZES="16 22 24 48" for F in layer-*; do echo " $F" echo "/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ @import url(\"chrome://icons/skin/icon-theme-base.css\"); :root {" > $F.css while read -r LINE; do LINE1=`echo $LINE | grep -Po "^[\w-]+"` LINE2=`echo $LINE | grep -Po "[\w-]+$"` for S in $SIZES; do echo " --icon-$LINE1-$S: url(\"moz-icon://stock/$LINE2?size=$S\");" >> $F.css echo " --icon-$LINE1-$S-dis: url(\"moz-icon://stock/$LINE2?size=$S&state=disabled\");" >> $F.css done echo "" >> $F.css done < $F echo "}" >> $F.css rm $F sed -E "s/(size=)16/\1menu/g;s/(size=)22/\1button/g;s/(size=)24/\1toolbar/g;s/(size=)48/\1dialog/g;" -i $F.css done echo "Generating icon themes..." SIZES="16 20 22 24 32 48" THEMES=`echo */ | sed -E "s/\///g"` mkdir -p dis for THEME in $THEMES; do echo " $THEME" cd $THEME BASE=`cat base` rm base FILES="" DIRS=`ls -v` for D in $SIZES; do if [ -d ${D}x$D ]; then cd ${D}x$D TMP_F=`find * -type f -name "*.png"` FILES="$FILES $TMP_F" cd .. fi done FILES=`echo $FILES | sed -E "s/\.png//g;s/\s+/\\n/g" | sort | uniq` cd .. cp -r $THEME dis touch icon-theme-$THEME.css echo "/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ @import url(\"chrome://icons/skin/icon-theme-$BASE.css\"); :root {" > icon-theme-$THEME.css for F in $FILES; do D=`echo $F | grep -Po "^[\w\d-_\.]+"` N=`echo $F | grep -Po "[\w\d-_]+$"` for DD in $SIZES; do if [ -f $THEME/${DD}x$DD/$D/$N.png ]; then mogrify -alpha set -channel a -evaluate divide 3 dis/$THEME/${DD}x$DD/$D/$N.png echo " --icon-$N-$DD: url(\"chrome://icons/skin/$THEME/${DD}x$DD/$D/$N.png\");" >> icon-theme-$THEME.css echo " --icon-$N-$DD-dis: url(\"chrome://icons/skin/dis/$THEME/${DD}x$DD/$D/$N.png\");" >> icon-theme-$THEME.css fi done echo "" >> icon-theme-$THEME.css done echo '}' >> icon-theme-$THEME.css done cd ../.. echo "Substituting variables..." FILES="theme/install.rdf options/install.rdf" while read LINE; do if [[ $LINE != [A-Z]* ]]; then continue fi LINE1=`echo $LINE | grep -oE "^[^=]+"` LINE2=`echo $LINE | grep -oE "[^=]+$"` sed "s|\$$LINE1|$LINE2|g" -i theme/install.rdf options/install.rdf eval "$LINE1=\"$LINE2\"" done < "../config.txt" echo "Packaging..." cd theme zip ../../gnomerunner-$VERSION-sm-linux.xpi * -qr cd ../options zip ../../gnomerunner-options-$VERSION-sm-linux.xpi * -qr cd ../..