14 echo "Unknown argument $1"
20 if [ -z "$BASEURL" ]; then
21 echo "$0: missing BASEURL"
22 echo "Usage: $0 -b BASEURL"
26 wget -q $BASEURL -O index.html
28 echo "ERROR: Cannot wget $BASEURL"
32 grep -o '[a-z-]*.wgt' index.html | sort | uniq |
35 WGTNAME=$(echo $wgtfile | sed 's,.wgt$,,')
36 echo "DEBUG: fetch $wgtfile"
37 wget -q $BASEURL/$wgtfile
39 echo "ERROR: wget from $BASEURL/$wgtfile"
43 echo "DEBUG: analyse wgt file"
46 grep hidden config.xml
48 echo "DEBUG: hidden package"
50 echo "DEBUG: not hidden package"
53 echo "DEBUG: fail to unzip"
56 echo "DEBUG: list current pkgs"
59 afm-util list --all > $LIST
61 echo "ERROR: afm-util list exit with error"
64 if [ ! -s "$LIST" ];then
65 echo "ERROR: afm-util list is empty"
69 echo "DEBUG: check presence of $WGTNAME"
70 NAMEID=$(grep id\\\":\\\"${WGTNAME}@ $LIST | cut -d\" -f4 | cut -d\\ -f1)
71 if [ ! -z "$NAMEID" ];then
72 echo "DEBUG: $WGTNAME already installed as $NAMEID"
73 # need to kill then deinstall
74 afm-util ps | grep -q $WGTNAME
76 echo "DEBUG: kill $WGTNAME"
77 afm-util kill $WGTNAME
79 echo "ERROR: afm-util kill"
80 lava-test-case afm-util-pre-kill-$WGTNAME --result fail
83 lava-test-case afm-util-pre-kill-$WGTNAME --result pass
86 echo "DEBUG: no need to kill $WGTNAME"
89 echo "DEBUG: deinstall $WGTNAME"
90 afm-util remove $NAMEID
92 echo "ERROR: afm-util remove"
93 lava-test-case afm-util-remove-$WGTNAME --result fail
96 lava-test-case afm-util-remove-$WGTNAME --result pass
99 echo "DEBUG: $WGTNAME not installed"
103 echo "DEBUG: install $wgtfile"
105 afm-util install $wgtfile > $OUT
107 echo "ERROR: afm-util install"
108 lava-test-case afm-util-install-$WGTNAME --result fail
111 lava-test-case afm-util-install-$WGTNAME --result pass
113 # message is like \"added\":\"mediaplayer@0.1\"
114 NAMEID=$(grep d\\\":\\\"${WGTNAME}@ $OUT | cut -d\" -f4 | cut -d\\ -f1)
115 if [ -z "$NAMEID" ];then
116 echo "ERROR: Cannot get nameid"
119 echo "DEBUG: $WGTNAME is installed as $NAMEID"
121 afm-util list --all > $LIST
123 echo "ERROR: afm-util list exit with error"
126 if [ ! -s "$LIST" ];then
127 echo "ERROR: afm-util list is empty"
130 echo "DEBUG: Verify that $WGTNAME is installed"
131 grep -q $NAMEID $LIST
133 echo "ERROR: $WGTNAME is not installed"
134 # for debugging, give full output
135 echo "DEBUG: start of list"
137 echo "DEBUG: end of list"
140 afm-util info $NAMEID
142 echo "ERROR: afm-util info"
143 lava-test-case afm-util-info-$WGTNAME --result fail
145 lava-test-case afm-util-info-$WGTNAME --result pass
148 echo "DEBUG: check if we see the package with systemctl list-units (before start)"
149 systemctl list-units --full | grep "afm.*$WGTNAME"
150 echo "DEBUG: check if we see the package with systemctl -a (before start)"
151 systemctl -a |grep "afm.*$WGTNAME"
153 echo "DEBUG: start $NAMEID"
154 afm-util start $NAMEID > "rid"
156 echo "ERROR: afm-util start"
157 lava-test-case afm-util-start-$WGTNAME --result fail
160 lava-test-case afm-util-start-$WGTNAME --result pass
163 echo "DEBUG: check if we see the package with systemctl list-units (after start)"
164 systemctl list-units --full | grep "afm.*$WGTNAME"
165 echo "DEBUG: check if we see the package with systemctl -a (after start)"
166 systemctl -a |grep "afm.*$WGTNAME"
168 echo "DEBUG: Get RID for $NAMEID"
170 afm-util ps > $PSLIST
172 echo "ERROR: afm-util ps"
173 lava-test-case afm-util-ps-$WGTNAME --result fail
177 lava-test-case afm-util-ps-$WGTNAME --result pass
179 # TODO, compare RID with the list in $PSLIST"
182 echo "DEBUG: status $NAMEID ($RID)"
185 echo "ERROR: afm-util status"
186 lava-test-case afm-util-status-$WGTNAME --result fail
189 lava-test-case afm-util-status-$WGTNAME --result pass
192 echo "DEBUG: kill $NAMEID ($RID)"
193 afm-util kill $NAMEID
195 echo "ERROR: afm-util kill"
196 lava-test-case afm-util-kill-$WGTNAME --result fail
199 lava-test-case afm-util-kill-$WGTNAME --result pass
202 echo "DEBUG: start2 $NAMEID"
203 afm-util start $NAMEID
205 echo "ERROR: afm-util start2"
206 lava-test-case afm-util-start2-$WGTNAME --result fail
209 lava-test-case afm-util-start2-$WGTNAME --result pass