aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorKevin Rocard <kevinx.rocard@intel.com>2013-02-04 14:53:43 +0100
committerDavid Wagner <david.wagner@intel.com>2014-02-12 17:03:46 +0100
commit8b751e92fae2e13353309d3e41e57aa3ccd9fb8c (patch)
tree90cf6e874c2d1398c1eedcbe65c682e156493e24 /tools
parent53493b2f22bc2d491f7607672e1d07e588677efa (diff)
downloadexternal_parameter-framework-8b751e92fae2e13353309d3e41e57aa3ccd9fb8c.zip
external_parameter-framework-8b751e92fae2e13353309d3e41e57aa3ccd9fb8c.tar.gz
external_parameter-framework-8b751e92fae2e13353309d3e41e57aa3ccd9fb8c.tar.bz2
PFW: Support .pfw argument in lightRoutingUpdate.sh
BZ: 86003 Adding an argument to lightRoutingUpdate.sh will overwrite the environement variable "PFWtest_DomainFile". Change-Id: Ia7447b9cb0d774bd91ec310874c0e6531ec0ea38 Signed-off-by: Kevin Rocard <kevinx.rocard@intel.com> Reviewed-on: http://android.intel.com:8080/90087 Reviewed-by: Gonzalve, Sebastien <sebastien.gonzalve@intel.com> Reviewed-by: cactus <cactus@intel.com> Tested-by: Dixon, CharlesX <charlesx.dixon@intel.com> Reviewed-by: buildbot <buildbot@intel.com> Tested-by: buildbot <buildbot@intel.com>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/xmlGenerator/lightRoutingUpdate.sh46
1 files changed, 30 insertions, 16 deletions
diff --git a/tools/xmlGenerator/lightRoutingUpdate.sh b/tools/xmlGenerator/lightRoutingUpdate.sh
index 37499d6..646bdf5 100755
--- a/tools/xmlGenerator/lightRoutingUpdate.sh
+++ b/tools/xmlGenerator/lightRoutingUpdate.sh
@@ -25,7 +25,7 @@
# It only works if you have an parameter running with criterion compatible
# with the .pfw
-set -eu
+set -eu -o pipefail
adbShell="adb shell"
parameterCommandAccess="eval parameter"
@@ -44,7 +44,7 @@ adbShellForward () {
echo 'exit'
)|
# adb shell can not handle a too fast input, create artificial delay :(
- while read line; do echo "$line"; sleep 0.03; done |
+ while read line; do echo "$line"; sleep 0.04; done |
$adbShell |
# keep only the -3line, the output of "echo $?"
tee /dev/stderr | tail -3 | sed '1{s/\r//;q}' |
@@ -56,7 +56,7 @@ adbShellForward () {
function parameterExecute ()
{
echo " \$ $parameter $@"
- result="$($parameter $@)"
+ result="$($parameter $@ | sed 's/\r$//')"
if [[ "$result" != "Done"* ]]; then
echo "$result"
@@ -68,6 +68,13 @@ function parameterExecute ()
# Clean tmp file
rm "$tmpfile" || true
+if test $# -eq 0
+then
+ domainFile="$(realpath "$PFWtest_DomainFile")"
+else
+ domainFile="$1"
+fi
+
#################
# Configure PFW #
#################
@@ -77,7 +84,7 @@ parameterExecute setAutoSync off
echo "Delete routing domains"
-for domain in $(parameterExecute listDomains |grep -io "^Routing.[^ ]*")
+for domain in $(parameterExecute listDomains |grep -io '^Routing.[^ ]*')
do
echo "Will delete domain $domain"
echo "deleteDomain $domain" >> "$tmpfile"
@@ -87,18 +94,25 @@ done
# Generate PFW commands #
#########################
-echo "Generate domain commands from file $(realpath $PFWtest_DomainFile)"
-m4 "$PFWtest_DomainFile" | $(dirname $0)/PFWScriptGenerator.py --pfw >> "$tmpfile"
+echo "Generate domain commands from file $(realpath $domainFile)"
+m4 "$domainFile" | $(dirname $0)/PFWScriptGenerator.py --pfw >> "$tmpfile"
sed -i -e':a' \
- -e '/\\$/{
- s/.$//;
- N;
- s/\n *//;
- ta};' \
- -e '/^$/d;' -e 's/^ *//' \
- -e 's/^.*$/'"$parameterCommandAccess"' "\0"\;/' "$tmpfile"
+ -e '# look for line finishing wih \
+ /\\$/{
+ # Delete the last char (\)
+ s/\\$//;
+ # Append the next line and delete the \n separator
+ N;
+ s/\n/ /;
+ # Jump back to the expression begining
+ ta;
+ };' \
+ -e '/^$/d;# delete empty lines' \
+ -e 's/^ *//;# delete leading space' \
+ -e 's/ */ /g;# delete multiple spaces' \
+ -e 's/^.*$/'"$parameterCommandAccess"' "\0"\;/;# Add a prefix ($parameterCommandAccess) on each line' "$tmpfile"
echo "Execute commands"
adbShellForward "$tmpfile"
@@ -112,16 +126,16 @@ parameterExecute setTuningMode off
#####################
# Output file is the input file with the xml extension
-outputFile="$(realpath "$(echo $PFWtest_DomainFile | sed 's#\.pfw$#.xml#')")"
+outputFile="$(echo "$domainFile" | sed 's#\.pfw$#.xml#')"
# Test if diferent from .pfw file (we do not whant to overwrite it)
-if test "$outputFile" == "$PFWtest_DomainFile"
+if test "$outputFile" == "$domainFile"
then
outputFile="${outputFile}.xml"
fi
echo "Output file: $outputFile"
-parameterExecute getDomainsXML |sed 's/\r//' > "$outputFile"
+$parameter getDomainsXML |sed 's/\r//' > "$outputFile"
echo "The media serveur PFW domains have been change, please restart it to restore old domains"