ba8d9c5b61f716fe1eaf5b7f7f0a64df5d57cd35
[integration/distribution.git] / distributions / base / src / assemble / resources / run.sh
1 #!/bin/bash
2
3 # Use same path for run.internal.sh
4 RUNSH_DIR=$(dirname $0)
5 CONTROLLER_RUNSH=${RUNSH_DIR}/run.internal.sh
6
7 OF_FILTER=
8
9 # Be extra careful to pass on usage from run.internal.sh, but add our 
10 # usage as well in the standard way
11 function usage {
12     $CONTROLLER_RUNSH -help | sed 's/\[-help\]/\[-help\] \[-of13\] \[-bundlefilter \<bundlefilter\> \]/' | sed "s;$CONTROLLER_RUNSH;$0;"
13     exit 1
14 }
15
16 OF13=0
17 BUNDLEFILTER=
18 while true ; do
19     (( i += 1 ))
20     case "${@:$i:1}" in
21         -of13) OF13=1 ;;
22         -bundlefilter) (( i += 1 )); BUNDLEFILTER="|${@:$i:1}";;
23         -help) usage ;;
24         "") break ;;
25     esac
26 done
27
28 # OF Filter selection
29 OF_FILTER="org.opendaylight.(openflowplugin|openflowjava)"
30 if [ $OF13 -ne 0 ]; then
31     OF_FILTER="org.opendaylight.controller.(thirdparty.org.openflow|protocol_plugins.openflow)"
32 fi
33
34 # Make sure we suck out our additional args so as to not confuse
35 # run.internal.sh
36 NEWARGS=`echo $@|sed 's/-of13//'|sed 's/-bundlefilter[ ]*[^ ]*//'`
37
38 # Build the filter string
39 FILTERBEGINING='^(?!'
40 FILTERENDING=').*'
41 FILTER=${FILTERBEGINING}${OF_FILTER}${BUNDLEFILTER}${FILTERENDING}
42
43 # Run the command
44 $CONTROLLER_RUNSH -Dfelix.fileinstall.filter="$FILTER" $NEWARGS