Merge: migrate appfw from meta-agl-extra
[AGL/meta-agl.git] / meta-app-framework / recipes-core / af-main / af-main / afm-install
1 #!/bin/sh
2
3 pretty() {
4         sed \
5                 -e '/^method return .*/d' \
6                 -e 's/^Error org.freedesktop.DBus.Error.Failed: "\?\(.*\)"\?$/ERROR: \1/' \
7                 -e 's/^   string "\(.*\)"/\1/' \
8                 -e 's/},/&\n/'
9 }
10
11 send() {
12         dbus-send --system --print-reply \
13                 --dest=org.AGL.afm.system \
14                 /org/AGL/afm/system \
15                 org.AGL.afm.system.$1 \
16                 "string:$2" |
17         pretty
18 }
19
20 case "$1" in
21
22   add|install)
23     f=$(realpath $2)
24     send install '{"wgt":"'"$f"'","force":true}'
25     ;;
26
27   -h|--help|help)
28     cat << EOC
29
30 The commands are:
31
32   add wgt
33   install wgt    install the wgt file
34
35 EOC
36     ;;
37
38   *)
39     echo "unknown command $1" >&2
40     exit 1
41     ;;
42 esac
43
44