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