summaryrefslogtreecommitdiffstats
path: root/meta-app-framework/recipes-core/af-main/af-main/afm-install
blob: 6d37baed899df9d614a4015677afc6b9bd00fdaa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/sh

pretty() {
	sed \
		-e '/^method return .*/d' \
		-e 's/^Error org.freedesktop.DBus.Error.Failed: "\?\(.*\)"\?$/ERROR: \1/' \
		-e 's/^   string "\(.*\)"/\1/' \
		-e 's/},/&\n/'
}

send() {
	dbus-send --system --print-reply \
		--dest=org.AGL.afm.system \
		/org/AGL/afm/system \
		org.AGL.afm.system.$1 \
		"string:$2" |
	pretty
}

case "$1" in

  add|install)
    f=$(realpath $2)
    send install '{"wgt":"'"$f"'","force":true}'
    ;;

  -h|--help|help)
    cat << EOC

The commands are:

  add wgt
  install wgt    install the wgt file

EOC
    ;;

  *)
    echo "unknown command $1" >&2
    exit 1
    ;;
esac