change name and version(s) for 2.0a1 release; create theme for delivering theme relea...
[themes.git] / maketheme
diff --git a/maketheme b/maketheme
new file mode 100755 (executable)
index 0000000..d8cf742
--- /dev/null
+++ b/maketheme
@@ -0,0 +1,58 @@
+#!/bin/sh
+
+RUN_DIR=$(pwd)
+cd $(dirname "$0")
+SCRIPT_DIR=$(pwd)
+
+if [ -n "$1" ]; then
+  case "$1" in
+  EarlyBlue)
+    THEME_NAME=$1
+    ;;
+  LCARStrek)
+    THEME_NAME=$1
+    ;;
+  *)
+    echo "unknown theme $option"
+    ;;
+  esac
+else
+  echo "You must specify a theme name."
+fi
+
+# define variables
+THEME_DIR=$SCRIPT_DIR/$THEME_NAME/
+WORK_DIR=$SCRIPT_DIR/$THEME_NAME.tmp/
+XPI_FILE=$SCRIPT_DIR/$THEME_NAME.xpi
+
+echo ensuring a clean work directory...
+if [ -e $WORK_DIR ] ; then
+  rm -rf $WORK_DIR/*
+fi
+mkdir -p $WORK_DIR/chrome
+
+echo copying basic files....
+cp $THEME_DIR/install.rdf $THEME_DIR/icon.png $THEME_DIR/preview.png $WORK_DIR/
+
+echo packing internal jar file...
+cd $THEME_DIR
+SUBDIRS=
+for filename in *; do
+  if [ -d "$filename" ]; then
+    SUBDIRS="$SUBDIRS $filename"
+  fi
+done
+zip -rX0Dq $WORK_DIR/chrome/$THEME_NAME.jar $SUBDIRS
+cd $WORK_DIR
+
+echo adjusting manifest...
+sed -e "s/skin \w* $THEME_NAME /\0jar:chrome\/$THEME_NAME.jar\!\//" $THEME_DIR/chrome.manifest > chrome.manifest
+
+echo creating new xpi file...
+if [ -e $XPI_FILE ] ; then
+  rm $XPI_FILE
+fi
+zip -rX9Dq $XPI_FILE *
+
+echo cleaning work directory...
+rm -rf $WORK_DIR/*