diff options
author | José Bollo <jose.bollo@iot.bzh> | 2018-02-27 15:07:54 +0100 |
---|---|---|
committer | José Bollo <jose.bollo@iot.bzh> | 2018-02-28 09:15:17 +0100 |
commit | 3d50d615fbd4322315dd66859d886576e208b36d (patch) | |
tree | cb94b3865a65f5210d253eb52763ea68bfad68ba /scripts/afm-util.in | |
parent | e6fc32e9185b5d6c1ea97714a37f1112b54f64fb (diff) |
Add configuration variables for runtime socket dirs
2 new configuration variables:
- afm_platform_rundir (default /run/platform)
Path to location of platform runtime sockets
- afm_users_rundir (default /run/user)
Path to location of users runtime sockets
Change-Id: I65007fee1ca2ce6f1247a67ba0b121f97c08f209
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'scripts/afm-util.in')
-rwxr-xr-x | scripts/afm-util.in | 117 |
1 files changed, 117 insertions, 0 deletions
diff --git a/scripts/afm-util.in b/scripts/afm-util.in new file mode 100755 index 0000000..40bc7da --- /dev/null +++ b/scripts/afm-util.in @@ -0,0 +1,117 @@ +#!/bin/bash + +send() { + afb-client-demo -H -d unix:@afm_platform_rundir@/apis/ws/afm-main "$1" "$2" | + awk '$1=="ON-REPLY-FAIL"{$1="ERROR:";$2="";print;exit 1;}NR>1' +} + +case "$1" in + + list|runnables) + send runnables true + ;; + + add|install) + f=$(realpath $2) + r=true + if [[ "$(basename $0)" = "afm-install" ]]; then r=false; fi + send install '{"wgt":"'"$f"'","force":true,"reload":'"$r"'}' + ;; + + remove|uninstall) + i=$2 + send uninstall "\"$i\"" + ;; + + info|detail) + i=$2 + send detail "\"$i\"" + ;; + + ps|runners) + send runners true + ;; + + run|start) + i=$2 + send start "\"$i\"" + ;; + + run-remote|start-remote) + i=$2 + send start '{"id":"'"$i"'","mode":"remote"}' + ;; + + once) + i=$2 + send once "\"$i\"" + ;; + + terminate|kill) + i=$2 + send terminate "$i" + ;; + + stop|pause) + i=$2 + send pause "$i" + ;; + + resume|continue) + i=$2 + send resume "$i" + ;; + + state|status) + i=$2 + send state "$i" + ;; + + -h|--help|help) + cat << EOC +usage: $(basename $0) command [arg] + +The commands are: + + list + runnables list the runnable widgets installed + + add wgt + install wgt install the wgt file + + remove id + uninstall id remove the installed widget of id + + info id + detail id print detail about the installed widget of id + + ps + runners list the running instance + + run id + start id start an instance of the widget of id + + once id run once an instance of the widget of id + + kill rid + terminate rid terminate the running instance rid + + stop rid + pause rid pause the running instance rid + + resume rid + continue rid continue the previously paused rid + + status rid + state rid get status of the running instance rid + +EOC + ;; + + *) + echo "unknown command $1" >&2 + exit 1 + ;; +esac + + |