summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSasa Bodiroza <jazzva@gmail.com>2008-07-08 23:32:02 +0200
committerSasa Bodiroza <jazzva@gmail.com>2008-07-08 23:32:02 +0200
commite1005d7fd10dba4585a781f36ef75aa0040fe79b (patch)
tree0a27a7be48e5fa859c17f13a14ca740acce15732 /src
parent553f700b449a06d7f0a2f5c9d55300f7af1088fc (diff)
Add function usage() to src/med-xpi-pack to print out information on error, or -h/--help
Diffstat (limited to 'src')
-rwxr-xr-xsrc/med-xpi-pack36
1 files changed, 25 insertions, 11 deletions
diff --git a/src/med-xpi-pack b/src/med-xpi-pack
index 0c7236d..a44698c 100755
--- a/src/med-xpi-pack
+++ b/src/med-xpi-pack
@@ -26,23 +26,37 @@
INDIR=$1;
XPIFILE=$2;
+function usage() {
+ echo -e "med-xpi-pack - Script to produce XPI file from input directory.\n";
+ echo "The output XPI file is placed in top-level of the input directory.";
+ echo "To place it somewhere else, provide relative or absolute path to the";
+ echo -e "output XPI file.\n"
+ echo "To run it call:";
+ echo -e "$ med-xpi-pack input_directory output_xpi_file\n";
+ echo " input_directory - directory with the XPI source tree";
+ echo " output_xpi_file - name of the produced file";
+ exit 1;
+}
+
+if [ $1 = "--help" -o $1 = "-h" ] ; then
+ usage;
+fi;
+
if [ -z $INDIR ] ; then
- echo "Missing input directory.";
- echo "Usage: med-xpi-pack indir xpiname";
- exit;
+ echo -e "Missing input directory.\n";
+ usage;
fi;
if [ -z $XPIFILE ] ; then
- echo "Missing XPI name.";
- echo "Usage: med-xpi-pack indir xpiname";
- exit;
+ echo -e "Missing XPI name.\n";
+ usage;
fi;
-if [ -e $XPIFILE ] ; then
- echo "E: XPI file already exists.";
- exit;
+if [ -f $XPIFILE ] ; then
+ echo -e "E: XPI file already exists.\n";
+ usage;
fi;
if [ ! -d $INDIR ] ; then
- echo "E: Input directory doesn't exist.";
- exit;
+ echo -e "E: Input directory doesn't exist.\n";
+ usage;
fi;
pushd $INDIR > /dev/null;