BUG-1200 fix external run.sh for the same logic of checking arguments
authorJakub Toth <jatoth@cisco.com>
Mon, 16 Jun 2014 16:28:46 +0000 (12:28 -0400)
committerJakub Toth <jatoth@cisco.com>
Thu, 19 Jun 2014 14:14:23 +0000 (14:14 +0000)
Change-Id: Iee5fce8cccee12738e408d9d3d520bff5509d761
Signed-off-by: Jakub Toth <jatoth@cisco.com>
distributions/base/src/assemble/resources/run.sh

index 4f8d81597201a2c87e1498d88be3eeccd8e72dfe..de567fe5e4b019eb92409cd6a1ab2b2fea2c895f 100755 (executable)
@@ -5,11 +5,33 @@ RUNSH_DIR=$(dirname $0)
 CONTROLLER_RUNSH=${RUNSH_DIR}/run.internal.sh
 
 OF_FILTER=
-
-# Be extra careful to pass on usage from run.internal.sh, but add our 
-# usage as well in the standard way
+helparg=
+# Added help for of13 before help from controller (this help common for intagration and controller)
 function usage {
-    $CONTROLLER_RUNSH -help | sed 's/\[-help\]/\[-help\] \[-of13\] \[-bundlefilter \<bundlefilter\> \]/' | sed "s;$CONTROLLER_RUNSH;$0;"
+    needParentHelp=true
+    if [ -n "${helparg}" ]; then
+       . functions.sh
+       harvestHelp ${helparg}
+       if (( $? == 0 )); then
+           needParentHelp=false
+           echo -e '\nFor more information type -help.\n'
+       fi
+    else
+        echo 'For more information on a specific command, type -help command-name.'
+        echo
+        echo '    Added option for integration:'
+        echo '    of13             [-of13]'
+        echo
+        echo '    Visit wiki for more information :'
+        echo
+        echo '    https://wiki.opendaylight.org/view/CrossProject:Integration_Group:Controller_Artifacts:run_sh'
+        echo
+        echo 'Common options: '
+    fi
+
+    if ${needParentHelp}; then
+        $CONTROLLER_RUNSH -help ${helparg}
+    fi
     exit 1
 }
 
@@ -18,9 +40,9 @@ BUNDLEFILTER=
 while true ; do
     (( i += 1 ))
     case "${@:$i:1}" in
-        -of13) OF13=1 ;;
+        -of13) OF13=1 ; (( i += 1 ));;
         -bundlefilter) (( i += 1 )); BUNDLEFILTER="|${@:$i:1}";;
-        -help) usage ;;
+        -help) (( i += 1 )); helparg=${@:$i:1}; usage ;;
         "") break ;;
     esac
 done
@@ -28,6 +50,10 @@ done
 # clean available optional configurations (links)
 find configuration/initial -type l -exec rm {} \;
 
+##of13
+#of13             [-of13]
+#   Option to run the OpenDaylight controller with the OpenFlow plugin (1.3).
+##
 # OF Filter selection
 OF_FILTER="org.opendaylight.(openflowplugin|openflowjava)"
 if (( $OF13 != 0 )); then