Subversion Repositories general

Rev

Rev 1330 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

#!/bin/sh

# define dirs
build_dir="$project_dir/build"

# read meta data
[ -f "$common_dir/meta.xml" ]        && $(xsltproc "$common_dir/meta.xsl" "$common_dir/meta.xml")
[ -f "$common_dir/meta_local.xml" ]  && $(xsltproc "$common_dir/meta.xsl" "$common_dir/meta_local.xml")
[ -f "$project_dir/meta.xml" ]       && $(xsltproc "$common_dir/meta.xsl" "$project_dir/meta.xml")
[ -f "$project_dir/meta_local.xml" ] && $(xsltproc "$common_dir/meta.xsl" "$project_dir/meta_local.xml")
$(xsltproc "$common_dir/id.xsl"   "$project_dir/src/install.rdf")

if [ -z "$META_xpiName" ] ; then
        echo "xpiName not defined in meta.xml" >> /dev/stderr
        exit 2
fi
if [ -z "$META_webDir" ] ; then
        echo "webDir not defined in meta.xml" >> /dev/stderr
        exit 2
fi
if [ -z "$META_keyDir" ] ; then
        echo "keyDir not defined in meta.xml" >> /dev/stderr
        exit 2
fi
if [ -z "$META_spockExec" ] ; then
        echo "spock not defined in meta.xml" >> /dev/stderr
        exit 2
fi
if [ -z "$META_id" ] ; then
        echo "id of the exception is unknown" >> /dev/stderr
        exit 2
fi

# convert paths to abs
[ -z "${META_keyDir%%/*}" ]    || META_keyDir="$project_dir/$META_keyDir"
[ -z "${META_spockExec%%/*}" ] || META_spockExec="$project_dir/$META_spockExec"

# cleanup
mkdir -p "$build_dir"
rm -f "$build_dir"/*

(cd "$project_dir/src"; find . -not -path '*/.svn*' | zip -q -@ "$build_dir/$META_xpiName" )

xsltproc --stringparam dir "$project_dir" "$common_dir/update.xsl" "$project_dir/src/install.rdf" \
        > "$build_dir/update.rdf_unsigned"

"$META_spockExec" "$build_dir/update.rdf_unsigned" -i "urn:mozilla:extension:$META_id" \
        -d "$META_keyDir" -f "$build_dir/$META_xpiName" \
        > "$build_dir/update.rdf" \
        && rm "$build_dir/update.rdf_unsigned"

case "$META_deployMethod" in
        scp)
                scp "$build_dir"/* "$META_webDir"
                ;;
        cp)
                [ -z "${META_webDir%%/*}" ]    || META_webDir="$project_dir/$META_webDir"
                cp "$build_dir"/* "$META_webDir"
                ;;
        \*)
                echo "Unknown deployMethod" >> /dev/stderr
                exit 2
                ;;
esac