aboutsummaryrefslogtreecommitdiffstats
path: root/common/scripts/application-lifecycle.sh
diff options
context:
space:
mode:
authorJan-Simon Moeller <jsmoeller@linuxfoundation.org>2019-10-17 19:06:00 +0000
committerGerrit Code Review <gerrit@automotivelinux.org>2019-10-17 19:06:00 +0000
commit083006b12a5fb4938e1ce74875824238b0e90661 (patch)
treee54e4fc4d344d4457b3a5d128776086bfdea2332 /common/scripts/application-lifecycle.sh
parentad55d3e5d7f9c5a7d04aeeaac86cfba12750cc73 (diff)
parent9c57e1d0d4b601505607629156354bd44d7a6f4a (diff)
Merge "Differ platform and user scope in service and application"
Diffstat (limited to 'common/scripts/application-lifecycle.sh')
-rwxr-xr-x[-rw-r--r--]common/scripts/application-lifecycle.sh40
1 files changed, 38 insertions, 2 deletions
diff --git a/common/scripts/application-lifecycle.sh b/common/scripts/application-lifecycle.sh
index 9e3a92c..15d505c 100644..100755
--- 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
@@ -49,6 +56,19 @@ do
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,24 @@ 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"
+ fi
+ if test x"1" = x"$SERVICE_USER" ; then
+ PRE_CMD="su $AGLDRIVER -c"
+ fi
+ if test x"1" = x"$APPLICATION_USER" ; then
+ PRE_CMD="su $AGLDRIVER -c"
+ fi
+
+ # construct the command to call
+ CMD=( "$PRE_CMD" )
+ CMD+=( " ' " )
+ CMD+=( "afm-util start $NAMEID" )
+ CMD+=( " ' " )
echo "DEBUG: start $NAMEID"
- afm-util start $NAMEID > "rid"
+ exec "${CMD[@]}" > "rid"
if [ $? -ne 0 ];then
echo "ERROR: afm-util start"
lava-test-case afm-util-start-$WGTNAME --result fail
@@ -200,7 +236,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