Commit | Line | Data |
---|---|---|
738054be RK |
1 | #!/bin/sh |
2 | ||
3 | RUN_DIR=$(pwd) | |
4 | cd $(dirname "$0") | |
5 | SCRIPT_DIR=$(pwd) | |
6 | ||
7 | if [ -n "$1" ]; then | |
8 | case "$1" in | |
9 | EarlyBlue) | |
10 | THEME_NAME=$1 | |
11 | ;; | |
12 | LCARStrek) | |
13 | THEME_NAME=$1 | |
14 | ;; | |
15 | *) | |
16 | echo "unknown theme $option" | |
17 | ;; | |
18 | esac | |
19 | else | |
20 | echo "You must specify a theme name." | |
21 | fi | |
22 | ||
23 | # define variables | |
24 | THEME_DIR=$SCRIPT_DIR/$THEME_NAME/ | |
25 | WORK_DIR=$SCRIPT_DIR/$THEME_NAME.tmp/ | |
26 | XPI_FILE=$SCRIPT_DIR/$THEME_NAME.xpi | |
27 | ||
28 | echo ensuring a clean work directory... | |
29 | if [ -e $WORK_DIR ] ; then | |
30 | rm -rf $WORK_DIR/* | |
31 | fi | |
32 | mkdir -p $WORK_DIR/chrome | |
33 | ||
34 | echo copying basic files.... | |
35 | cp $THEME_DIR/install.rdf $THEME_DIR/icon.png $THEME_DIR/preview.png $WORK_DIR/ | |
36 | ||
37 | echo packing internal jar file... | |
38 | cd $THEME_DIR | |
39 | SUBDIRS= | |
40 | for filename in *; do | |
41 | if [ -d "$filename" ]; then | |
42 | SUBDIRS="$SUBDIRS $filename" | |
43 | fi | |
44 | done | |
45 | zip -rX0Dq $WORK_DIR/chrome/$THEME_NAME.jar $SUBDIRS | |
46 | cd $WORK_DIR | |
47 | ||
48 | echo adjusting manifest... | |
49 | sed -e "s/skin \w* $THEME_NAME /\0jar:chrome\/$THEME_NAME.jar\!\//" $THEME_DIR/chrome.manifest > chrome.manifest | |
50 | ||
51 | echo creating new xpi file... | |
52 | if [ -e $XPI_FILE ] ; then | |
53 | rm $XPI_FILE | |
54 | fi | |
55 | zip -rX9Dq $XPI_FILE * | |
56 | ||
57 | echo cleaning work directory... | |
58 | rm -rf $WORK_DIR/* |