21 echo "Unknown argument $1"
27 if [ -z "$BASEURL" ]; then
28 echo "$0: missing BASEURL"
29 echo "Usage: $0 -b BASEURL"
33 wget -q $BASEURL -O index.html
35 echo "ERROR: Cannot wget $BASEURL"
39 grep -o '[a-z-]*.wgt' index.html | sort | uniq |
42 WGTNAME=$(echo $wgtfile | sed 's,.wgt$,,')
43 echo "DEBUG: fetch $wgtfile"
44 wget -q $BASEURL/$wgtfile
46 echo "ERROR: wget from $BASEURL/$wgtfile"
50 echo "DEBUG: analyse wgt file"
52 if [ -f config.xml ];then
53 grep hidden config.xml
55 echo "DEBUG: hidden package"
57 echo "DEBUG: not hidden package"
59 # a service sets urn:AGL:widget:provided-api
60 if $(grep "urn:AGL:widget:provided-api" config.xml) ; then
61 # we are a service, now determine the scope ...
62 if $(grep "urn:AGL:permission::partner:scope-platform" config.xml) ; then
68 # we are an application
70 # no other type known (yet)
73 echo "DEBUG: fail to unzip"
76 echo "DEBUG: list current pkgs"
79 afm-util list --all > $LIST
81 echo "ERROR: afm-util list exit with error"
84 if [ ! -s "$LIST" ];then
85 echo "ERROR: afm-util list is empty"
89 echo "DEBUG: check presence of $WGTNAME"
90 NAMEID=$(grep id\\\":\\\"${WGTNAME}@ $LIST | cut -d\" -f4 | cut -d\\ -f1)
91 if [ ! -z "$NAMEID" ];then
92 echo "DEBUG: $WGTNAME already installed as $NAMEID"
93 # need to kill then deinstall
94 afm-util ps | grep -q $WGTNAME
96 echo "DEBUG: kill $WGTNAME"
97 afm-util kill $WGTNAME
99 echo "ERROR: afm-util kill"
100 lava-test-case afm-util-pre-kill-$WGTNAME --result fail
103 lava-test-case afm-util-pre-kill-$WGTNAME --result pass
106 echo "DEBUG: no need to kill $WGTNAME"
109 echo "DEBUG: deinstall $WGTNAME"
110 afm-util remove $NAMEID
112 echo "ERROR: afm-util remove"
113 lava-test-case afm-util-remove-$WGTNAME --result fail
116 lava-test-case afm-util-remove-$WGTNAME --result pass
119 echo "DEBUG: $WGTNAME not installed"
123 echo "DEBUG: install $wgtfile"
125 afm-util install $wgtfile > $OUT
127 echo "ERROR: afm-util install"
128 lava-test-case afm-util-install-$WGTNAME --result fail
131 lava-test-case afm-util-install-$WGTNAME --result pass
133 # message is like \"added\":\"mediaplayer@0.1\"
134 NAMEID=$(grep d\\\":\\\"${WGTNAME}@ $OUT | cut -d\" -f4 | cut -d\\ -f1)
135 if [ -z "$NAMEID" ];then
136 echo "ERROR: Cannot get nameid"
139 echo "DEBUG: $WGTNAME is installed as $NAMEID"
141 afm-util list --all > $LIST
143 echo "ERROR: afm-util list exit with error"
146 if [ ! -s "$LIST" ];then
147 echo "ERROR: afm-util list is empty"
150 echo "DEBUG: Verify that $WGTNAME is installed"
151 grep -q $NAMEID $LIST
153 echo "ERROR: $WGTNAME is not installed"
154 # for debugging, give full output
155 echo "DEBUG: start of list"
157 echo "DEBUG: end of list"
160 afm-util info $NAMEID
162 echo "ERROR: afm-util info"
163 lava-test-case afm-util-info-$WGTNAME --result fail
165 lava-test-case afm-util-info-$WGTNAME --result pass
168 echo "DEBUG: check if we see the package with systemctl list-units (before start)"
169 systemctl list-units --full | grep "afm.*$WGTNAME"
170 echo "DEBUG: check if we see the package with systemctl -a (before start)"
171 systemctl -a |grep "afm.*$WGTNAME"
173 # here we need to differ between SERVICE_PLATFORM, SERVICE_USER and APPLICATION_USER
174 if test x"1" = x"$SERVICE_PLATFORM" ; then
178 if test x"1" = x"$SERVICE_USER" ; then
179 PRE_CMD="su $AGLDRIVER -c '"
182 if test x"1" = x"$APPLICATION_USER" ; then
183 PRE_CMD="su $AGLDRIVER -c '"
187 # construct the command to call
189 CMD+=( "afm-util start $NAMEID" )
191 echo "DEBUG: start $NAMEID"
194 echo "ERROR: afm-util start"
195 lava-test-case afm-util-start-$WGTNAME --result fail
198 lava-test-case afm-util-start-$WGTNAME --result pass
201 echo "DEBUG: check if we see the package with systemctl list-units (after start)"
202 systemctl list-units --full | grep "afm.*$WGTNAME"
203 echo "DEBUG: check if we see the package with systemctl -a (after start)"
204 systemctl -a |grep "afm.*$WGTNAME"
206 echo "DEBUG: Get RID for $NAMEID"
208 afm-util ps > $PSLIST
210 echo "ERROR: afm-util ps"
211 lava-test-case afm-util-ps-$WGTNAME --result fail
215 lava-test-case afm-util-ps-$WGTNAME --result pass
217 # TODO, compare RID with the list in $PSLIST"
220 echo "DEBUG: status $NAMEID ($RID)"
223 echo "ERROR: afm-util status"
224 lava-test-case afm-util-status-$WGTNAME --result fail
227 lava-test-case afm-util-status-$WGTNAME --result pass
230 echo "DEBUG: kill $NAMEID ($RID)"
231 afm-util kill $NAMEID
233 echo "ERROR: afm-util kill"
234 lava-test-case afm-util-kill-$WGTNAME --result fail
237 lava-test-case afm-util-kill-$WGTNAME --result pass
240 echo "DEBUG: start2 $NAMEID"
243 echo "ERROR: afm-util start2"
244 lava-test-case afm-util-start2-$WGTNAME --result fail
247 lava-test-case afm-util-start2-$WGTNAME --result pass