aboutsummaryrefslogtreecommitdiffstats
path: root/docs/1-afm-daemons.md
blob: 6ed8d09cf8ab77f2d62140e01e12fbc1f02d90e2 (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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# The application framework

## Introduction

The daemon ***afm-system-daemon*** handle applications life.
Understand that they will manage operations that mainly are:

- ***installation***
- ***uninstallation***
- ***running***
- ***terminating***
- ***inventory***

In addition, they ensure that operations use the security framework as needed
and that applications are executed in the correct context.

The daemon ***afm-system-daemon*** is accessible through AGL
micro-service architecture using either the binder ***afb-binder*** or
the client library ***libafbwsc***.

## Starting **afm-system-daemon**

***afm-system-daemon*** is launched by systemd services.
Normally, service files are located in the directory
*/lib/systemd/system/afm-system-daemon.service*.

Internally, the daemon is built as a binding served by afb-daemon.

## Tasks of **afm-system-daemon**

### Maintaining list of applications

At start **afm-system-daemon** scans the directories containing
applications and load in memory a list of available applications
accessible by current user.

When **afm-system-daemon** installs or removes an application,
on success it sends the signal **.
When receiving such a signal, **afm-system-daemon** rebuilds its
applications list.

**afm-system-daemon** provides the data it collects about
applications to its clients.
Clients may either request the full list
of available applications or a more specific information about a
given application.

### Launching application

**afm-system-daemon** launches application by using systemd.
Systemd builds a secure environment for the application
before starting it.

Once launched, running instances of application receive
a runid that identify them. On previous versions, the *runid*
had a special meaning. The current version uses the linux *PID*
of the launched process as *runid*.

### Managing instances of running applications

**afm-system-daemon** manages the list of applications
that it launched.

When owning the right permissions, a client can get the list
of running instances and details about a specific
running instance.
It can also terminate a given application.

### Installing and uninstalling applications

If the client own the right permissions,
**afm-system-daemon** delegates that task
to **afm-system-daemon**.

## Using ***afm-util***

The command line tool ***afm-util*** is available in devel mode.

It uses afb-client-demo to send orders to **afm-system-daemon**.
This small scripts allows to send command to ***afm-system-daemon*** either
interactively at shell prompt or scriptically.

The syntax is simple:

- it accept a command and when requires attached arguments.

Here is the summary of ***afm-util***:

- **afm-util runnables      **:
  list the runnable widgets installed

- **afm-util install    wgt **:
  install the wgt file

- **afm-util uninstall  id  **:
  remove the installed widget of id

- **afm-util detail     id  **:
  print detail about the installed widget of id

- **afm-util runners        **:
  list the running instance

- **afm-util start      id  **:
  start an instance of the widget of id

- **afm-util once      id  **:
  run once an instance of the widget of id

- **afm-util terminate  rid **:
  terminate the running instance rid

- **afm-util state      rid **:
  get status of the running instance rid

Here is how to list applications using ***afm-util***:

```bash
    afm-util runnables
```

[afm-daemons]: pictures/afm-daemons.svg