3 <link rel="stylesheet" type="text/css" href="doc.css">
7 <a name="The.afm-system-daemon"></a>
8 <h1>The afm-system-daemon</h1>
15 <a name="Foreword"></a>
18 <p>This document describes what we intend to do. It may happen that our
19 current implementation and the content of this document differ.</p>
21 <p>In case of differences, it is assumed that this document is right
22 and the implementation is wrong.</p>
24 <a name="Introduction"></a>
27 <p>The daemon <strong>afm-system-daemon</strong> is in charge of installing
28 applications on the system. Its main tasks are:</p>
31 <li><p>installs the applications and setup the security framework
32 to include it</p></li>
33 <li><p>uninstall the applications</p></li>
37 <p>The <strong>afm-system-daemon</strong> takes its orders from the system
38 instance of D-Bus.</p>
40 <p>The figure below summarizes the situation of the
41 <strong>afm-system-daemon</strong> in the system.</p>
43 <pre><code>+------------------------------------------------------------+
46 | +-------------------------------------------------+ |
48 | | afm-user-daemon | |
50 | +----------+----------------------+----------+----+ |
53 :================|======================|==========:=========:
55 | +----------+----------+ +-----+-----+ : |
56 | | D-Bus system +-----+ CYNARA | : |
57 | +----------+----------+ +-----+-----+ : |
59 | +----------+---------+ +-------+----------+----+ |
60 | | afm-system-daemon +----+ SECURITY-MANAGER | |
61 | +--------------------+ +-----------------------+ |
64 +------------------------------------------------------------+
67 <a name="Starting..strong.afm-system-daemon..strong."></a>
68 <h2>Starting <strong>afm-system-daemon</strong></h2>
70 <p><strong>afm-system-daemon</strong> is launched as a <strong>systemd</strong> service
71 attached to system. Normally, the service file is
72 located at /lib/systemd/system/afm-system-daemon.service.</p>
74 <p>The options for launching <strong>afm-system-daemon</strong> are:</p>
79 Set the root application directory.
81 Note that the default root directory is defined
82 to be /usr/share/afm/applications (may change).
87 Daemonizes the process. It is not needed by sytemd.
92 Reduces the verbosity (can be repeated).
97 Increases the verbosity (can be repeated).
105 <a name="The.D-Bus.interface"></a>
106 <h2>The D-Bus interface</h2>
108 <a name="Overview.of.the.dbus.interface"></a>
109 <h3>Overview of the dbus interface</h3>
111 <p><strong><em>afm-system-daemon</em></strong> takes its orders from the session instance
112 of D-Bus. The use of D-Bus is great because it allows to implement
113 discovery and signaling.</p>
115 <p>The <strong>afm-system-daemon</strong> is listening with the destination name
116 <strong><em>org.AGL.afm.system</em></strong> at the object of path <strong><em>/org/AGL/afm/system</em></strong>
117 on the interface <strong><em>org.AGL.afm.system</em></strong> for the below detailed
118 members <strong><em>install</em></strong> and <strong><em>uninstall</em></strong>.</p>
120 <p>D-Bus is mainly used for signaling and discovery. Its optimized
121 typed protocol is not used except for transmitting only one string
122 in both directions.</p>
124 <p>The client and the service are using JSON serialisation to
127 <p>The D-Bus interface is defined by:</p>
130 <li><p>DESTINATION: <strong>org.AGL.afm.system</strong></p></li>
131 <li><p>PATH: <strong>/org/AGL/afm/system</strong></p></li>
132 <li><p>INTERFACE: <strong>org.AGL.afm.system</strong></p></li>
136 <p>The signature of any member of the interface is <strong><em>string -> string</em></strong>
137 for <strong><em>JSON -> JSON</em></strong>.</p>
139 <p>This is the normal case. In case of error, the current implmentation
140 returns a dbus error that is a string.</p>
142 <p>Here is an example that use <em>dbus-send</em> to query data on
143 installed applications.</p>
145 <pre><code>dbus-send --session --print-reply \
146 --dest=org.AGL.afm.system \
147 /org/AGL/afm/system \
148 org.AGL.afm.system.install 'string:"/tmp/appli.wgt"'
151 <a name="The.protocol.over.D-Bus"></a>
152 <h3>The protocol over D-Bus</h3>
156 <a name="Method.org.AGL.afm.system.install"></a>
157 <h4>Method org.AGL.afm.system.install</h4>
159 <p><strong>Description</strong>: Install an application from its widget file.</p>
161 <p>If an application of the same <em>id</em> and <em>version</em> exists, it is not
162 reinstalled except if <em>force=true</em>.</p>
164 <p>Applications are installed in the subdirectories of the common directory
166 If <em>root</em> is specified, the application is installed under the
167 sub-directories of the <em>root</em> defined.</p>
169 <p>Note that this methods is a simple accessor to the method
170 <strong><em>org.AGL.afm.system.install</em></strong> of <strong><em>afm-system-daemon</em></strong>.</p>
172 <p>After the installation and before returning to the sender,
173 <strong><em>afm-system-daemon</em></strong> sends the signal <strong><em>org.AGL.afm.system.changed</em></strong>.</p>
175 <p><strong>Input</strong>: The <em>path</em> of the widget file to install and, optionaly,
176 a flag to <em>force</em> reinstallation, and, optionaly, a <em>root</em> directory.</p>
178 <p>Either just a string being the absolute path of the widget file:</p>
180 <pre><code>"/a/path/driving/to/the/widget"
186 "wgt": "/a/path/to/the/widget",
188 "root": "/a/path/to/the/root"
192 <p>“wgt” and “root” must be absolute paths.</p>
194 <p><strong>output</strong>: An object with the field “added” being the string for
195 the id of the added application.</p>
197 <pre><code>{"added":"appli@x.y"}
202 <a name="Method.org.AGL.afm.system.uninstall"></a>
203 <h4>Method org.AGL.afm.system.uninstall</h4>
205 <p><strong>Description</strong>: Uninstall an application from its id.</p>
207 <p>Note that this methods is a simple accessor to the method
208 <strong><em>org.AGL.afm.system.uninstall</em></strong> of <strong><em>afm-system-daemon</em></strong>.</p>
210 <p>After the uninstallation and before returning to the sender,
211 <strong><em>afm-system-daemon</em></strong> sends the signal <strong><em>org.AGL.afm.system.changed</em></strong>.</p>
213 <p><strong>Input</strong>: the <em>id</em> of the application and, otpionaly, the path to
214 <em>root</em> of the application.</p>
216 <p>Either a string:</p>
218 <pre><code>"appli@x.y"
225 "root": "/a/path/to/the/root"
229 <p><strong>output</strong>: the value ‘true’.</p>