X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=common%2Fscripts%2Fapplication-lifecycle.sh;h=83ca34005fbbbdb3ec3e03453f8c369050836a4d;hb=ba2a97f4acb44194cc2a827e344d71f916d432b8;hp=9e3a92c8ca21c1e3311501e76d0d465907636441;hpb=f6e4ceb2f7e5a3f6020e3d64e8c9270a11f94bd4;p=src%2Fqa-testdefinitions.git diff --git a/common/scripts/application-lifecycle.sh b/common/scripts/application-lifecycle.sh old mode 100644 new mode 100755 index 9e3a92c..83ca340 --- a/common/scripts/application-lifecycle.sh +++ b/common/scripts/application-lifecycle.sh @@ -1,7 +1,14 @@ #!/bin/sh +set -x + export TERM=dumb +SERVICE_PLATFORM=0 +SERVICE_USER=0 +APPLICATION_USER=0 +AGLDRIVER=agl-driver + while [ $# -ge 1 ] do case $1 in @@ -42,13 +49,26 @@ do echo "DEBUG: analyse wgt file" unzip $wgtfile - if [ $? -eq 0 ];then + if [ -f config.xml ];then grep hidden config.xml if [ $? -eq 0 ];then echo "DEBUG: hidden package" else echo "DEBUG: not hidden package" fi + # a service sets urn:AGL:widget:provided-api + if $(grep "urn:AGL:widget:provided-api" config.xml) ; then + # we are a service, now determine the scope ... + if $(grep "urn:AGL:permission::partner:scope-platform" config.xml) ; then + SERVICE_PLATFORM=1 + else + SERVICE_USER=1 + fi + else + # we are an application + APPLICATION_USER=1 + # no other type known (yet) + fi else echo "DEBUG: fail to unzip" fi @@ -150,8 +170,26 @@ do echo "DEBUG: check if we see the package with systemctl -a (before start)" systemctl -a |grep "afm.*$WGTNAME" + # here we need to differ between SERVICE_PLATFORM, SERVICE_USER and APPLICATION_USER + if test x"1" = x"$SERVICE_PLATFORM" ; then + PRE_CMD="su -c ' " + POST_CMD=" '" + fi + if test x"1" = x"$SERVICE_USER" ; then + PRE_CMD="su $AGLDRIVER -c '" + POST_CMD=" '" + fi + if test x"1" = x"$APPLICATION_USER" ; then + PRE_CMD="su $AGLDRIVER -c '" + POST_CMD=" '" + fi + + # construct the command to call + CMD=( "$PRE_CMD" ) + CMD+=( "afm-util start $NAMEID" ) + CMD+=( "$POST_CMD" ) echo "DEBUG: start $NAMEID" - afm-util start $NAMEID > "rid" + ${CMD[@]} > "rid" if [ $? -ne 0 ];then echo "ERROR: afm-util start" lava-test-case afm-util-start-$WGTNAME --result fail @@ -200,7 +238,7 @@ do fi echo "DEBUG: start2 $NAMEID" - afm-util start $NAMEID + exec "${CMD[@]}" if [ $? -ne 0 ];then echo "ERROR: afm-util start2" lava-test-case afm-util-start2-$WGTNAME --result fail