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." | |
39d844b6 | 21 | exit 1 |
738054be RK |
22 | fi |
23 | ||
24 | # define variables | |
25 | THEME_DIR=$SCRIPT_DIR/$THEME_NAME/ | |
26 | WORK_DIR=$SCRIPT_DIR/$THEME_NAME.tmp/ | |
27 | XPI_FILE=$SCRIPT_DIR/$THEME_NAME.xpi | |
28 | ||
29 | echo ensuring a clean work directory... | |
30 | if [ -e $WORK_DIR ] ; then | |
31 | rm -rf $WORK_DIR/* | |
32 | fi | |
33 | mkdir -p $WORK_DIR/chrome | |
34 | ||
35 | echo copying basic files.... | |
36 | cp $THEME_DIR/install.rdf $THEME_DIR/icon.png $THEME_DIR/preview.png $WORK_DIR/ | |
37 | ||
38 | echo packing internal jar file... | |
39 | cd $THEME_DIR | |
40 | SUBDIRS= | |
41 | for filename in *; do | |
42 | if [ -d "$filename" ]; then | |
43 | SUBDIRS="$SUBDIRS $filename" | |
44 | fi | |
45 | done | |
46 | zip -rX0Dq $WORK_DIR/chrome/$THEME_NAME.jar $SUBDIRS | |
47 | cd $WORK_DIR | |
48 | ||
49 | echo adjusting manifest... | |
50 | sed -e "s/skin \w* $THEME_NAME /\0jar:chrome\/$THEME_NAME.jar\!\//" $THEME_DIR/chrome.manifest > chrome.manifest | |
51 | ||
52 | echo creating new xpi file... | |
53 | if [ -e $XPI_FILE ] ; then | |
54 | rm $XPI_FILE | |
55 | fi | |
56 | zip -rX9Dq $XPI_FILE * | |
57 | ||
58 | echo cleaning work directory... | |
99d068f3 | 59 | rm -rf $WORK_DIR |