Add afm-install used to install wgt at first boot
authorRonan Le Martret <ronan.lemartret@iot.bzh>
Wed, 15 Feb 2017 15:54:11 +0000 (16:54 +0100)
committerStephane Desneux <stephane.desneux@iot.bzh>
Mon, 27 Mar 2017 13:33:40 +0000 (15:33 +0200)
 * afm-install can install wgt app like afm-util but use
   dbus "system" session instead of "user".
   #/usr/bin/afm-install install /usr/AGL/apps/$file.wgt

Change-Id: Id7361350257347a8db32f539b3bdeb3f2d8f554c
Signed-off-by: Ronan Le Martret <ronan.lemartret@iot.bzh>
Signed-off-by: Stephane Desneux <stephane.desneux@iot.bzh>
meta-app-framework/recipes-core/af-main/af-main/afm-install [new file with mode: 0755]
meta-app-framework/recipes-core/af-main/af-main_1.0.bb

diff --git a/meta-app-framework/recipes-core/af-main/af-main/afm-install b/meta-app-framework/recipes-core/af-main/af-main/afm-install
new file mode 100755 (executable)
index 0000000..6d37bae
--- /dev/null
@@ -0,0 +1,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
+
+
index 834e293..7819bfa 100644 (file)
@@ -64,6 +64,11 @@ SRC_URI += "\
        file://add-qt-wayland-shell-integration.patch \
 "
 
+# tools used to install wgt at first boot
+SRC_URI += "\
+       file://afm-install \
+"
+
 do_install_append() {
     install -d ${D}${bindir}
     install -m 0755 ${WORKDIR}/init-afm-dirs.sh ${D}${bindir}
@@ -74,6 +79,7 @@ do_install_append() {
        install -p -D ${WORKDIR}/init-afm-dirs.service ${D}${systemd_unitdir}/system/init-afm-dirs.service
        ln -sf ${systemd_unitdir}/system/init-afm-dirs.service ${D}${sysconfdir}/systemd/system/default.target.wants
     fi
+    install -m 0755 ${WORKDIR}/afm-install ${D}${bindir}
 }
 
 do_install_append_smack () {