Subversion Repositories general

Rev

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

#!/bin/sh

# define dirs
build_dir="$project_dir/build"

if [ ! -d "$build_dir" ] ; then
        echo "Build dir '$build_dir' not found" >> /dev/stderr
        exit 1
fi

# 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
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)
                echo scp "$build_dir/*" "$META_webDir"
                ;;
        \*)
                [ -z "${META_webDir%%/*}" ]    || META_webDir="$project_dir/$META_webDir"
                echo cp "$build_dir/*" "$META_webDir"
                ;;
esac