Author: ks156
Date: 2008-12-20 11:27:29 +0100 (Sat, 20 Dec 2008)
New Revision: 3270

Modified:
   
software_suite_v2/software/development_tools/gadget_packer/trunk/tux_gadget_packer
Log:
* Added options :
  -d DIR  : the directory to pack (required)
  -n NAME : The name of the TGF file (optionnal).


Modified: 
software_suite_v2/software/development_tools/gadget_packer/trunk/tux_gadget_packer
===================================================================
--- 
software_suite_v2/software/development_tools/gadget_packer/trunk/tux_gadget_packer
  2008-12-20 09:52:10 UTC (rev 3269)
+++ 
software_suite_v2/software/development_tools/gadget_packer/trunk/tux_gadget_packer
  2008-12-20 10:27:29 UTC (rev 3270)
@@ -154,13 +154,38 @@
 }
 
 #### Start of the script
+
+usage () {
+    echo "Usage :"
+    echo "tux_gadget_packer -d [-n]"
+    echo ""
+    echo "  -d DIR  : The directory to pack"
+    echo "  -n NAME : The name of the gadget"
+    echo ""
+}
+
 #>>> Header
 echo 
"--------------------------------------------------------------------------------"
 echo "TuxDroid gadgets compiler"
 echo 
"--------------------------------------------------------------------------------"
 #<<< Check if the path is correct >>>
-DIR=$1
-if [[ -z $1 ]] || [ ! -d $DIR ]; then
+while getopts "d:n:" options; do
+    case $options in
+        n)
+            NAME=$OPTARG
+            ;;
+       d)
+           DIR=$OPTARG
+           ;;
+    esac
+done
+
+if [[ -z $DIR ]]; then
+    usage
+    exit 1
+fi
+
+if [ ! -d $DIR ]; then
     echo "Couldn't find the folder to pack"
     echo "Please specify the complete path to the folder"
     exit 1
@@ -254,9 +279,11 @@
 verify_xml
 
 # <<< Creating the TGF file >>>
-NAME=`echo $DESC_NAME |sed 's/ /_/g'`
 if [[ -z $NAME ]]; then
-    NAME=tuxdroid-gadget
+    NAME=`echo $DESC_NAME |sed 's/ /_/g'`
+    if [[ -z $NAME ]]; then
+       NAME=tuxdroid-gadget
+    fi
 fi
 cd $DIR
 zip -r -q $NAME.zip *


------------------------------------------------------------------------------
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn

Reply via email to