From 3b94705e131111027af525c5eb921b6bb0070b59 Mon Sep 17 00:00:00 2001 From: Sasa Bodiroza Date: Thu, 24 Jul 2008 12:27:34 +0200 Subject: * Fix bashisms in src/med-xpi-pack --- src/med-xpi-pack | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/med-xpi-pack b/src/med-xpi-pack index 266a77e..bc21616 100755 --- a/src/med-xpi-pack +++ b/src/med-xpi-pack @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # Copyright (c) 2008 Alexander Sack, Sasa Bodiroza # Description: Script to pack indir to xpifile @@ -26,13 +26,13 @@ INDIR=$1; XPIFILE=$2; -function usage() { - echo -e "med-xpi-pack - Script to produce XPI file from input directory.\n"; +usage() { + echo "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 "output XPI file.\n" echo "To run it call:"; - echo -e "$ med-xpi-pack input_directory output_xpi_file\n"; + echo "$ 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; @@ -43,27 +43,29 @@ if [ $1 = "--help" -o $1 = "-h" ] ; then fi; if [ -z $INDIR ] ; then - echo -e "Missing input directory.\n"; + echo "Missing input directory.\n"; usage; fi; if [ -z $XPIFILE ] ; then - echo -e "Missing XPI name.\n"; + echo "Missing XPI name.\n"; usage; fi; if [ ! -d $INDIR ] ; then - echo -e "E: Input directory doesn't exist.\n"; + echo "E: Input directory doesn't exist.\n"; usage; fi; -pushd $INDIR > /dev/null; +START_DIR=`pwd`; +cd $INDIR; for JAR_DIR in `find . -type d -name *.jar\!` ; do JAR_FILE=`echo $JAR_DIR | sed "s/jar\!$/jar/"`; ABS_JAR_PATH=`cd $JAR_DIR ; pwd`; ABS_JAR_FILE=`echo $ABS_JAR_PATH | sed "s/jar\!$/jar/"`; - pushd $ABS_JAR_PATH > /dev/null; + ABS_CUR_DIR=`pwd`; + cd $ABS_JAR_PATH; echo "Packing $JAR_FILE"; zip -q -r $ABS_JAR_FILE .; - popd > /dev/null; + cd $ABS_CUR_DIR; rm -rf $ABS_JAR_PATH; done; echo "Packing $XPIFILE"; @@ -74,4 +76,4 @@ for JAR_PATH in `find . -name *.jar` ; do unzip -q $JAR_PATH -d $JAR_PATH!; rm -f $JAR_PATH; done; -popd > /dev/null; +cd $START_DIR; -- cgit v1.2.3