diff options
-rwxr-xr-x | src/med-xpi-unpack | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/src/med-xpi-unpack b/src/med-xpi-unpack index 53b8bb1..9c66c89 100755 --- a/src/med-xpi-unpack +++ b/src/med-xpi-unpack @@ -24,23 +24,35 @@ XPIFILE=$1; OUTDIR=$2; +function usage() { + echo -e "med-xpi-unpack - Script to unpack XPI file to output directory.\n"; + echo "To run it call:"; + echo -e "$ med-xpi-unpack input_xpi_file output_directory\n"; + echo " input_xpi_file - packed XPI source tree"; + echo " output_directory - location where the unpacke XPI file is placed"; + exit 1; +} + +if [ $1 = "--help" -o $1 = "-h" ] ; then + usage; +fi; + if [ -z $XPIFILE ] ; then - echo "Missing xpiname directory."; - echo "Usage: med-xpi-unpack xpiname outdir"; - exit; + echo -e "Missing XPI file.\n"; + usage; fi; if [ -z $OUTDIR ] ; then - echo "Missing output directory."; - echo "Usage: med-xpi-unpack xpiname outdir"; - exit; + echo -e "Missing output directory.\n"; + usage; fi; if [ -d $OUTDIR ] ; then - echo "E: Output directory already exists."; - exit; + echo -e "E: Output directory already exists.\n"; + usage; fi; -if [ ! -e $XPIFILE ] ; then - echo "E: XPI file doesn't exist."; - exit; + +if [ ! -f $XPIFILE ] ; then + echo -e "E: XPI file doesn't exist.\n"; + usage; fi; mkdir $OUTDIR; |