1 ;---------------------------------------------------------------------------------
8 ; Configure how installation of widget produces unit files for systemd
10 ; Processing and format:
14 ; Lines beginning with ; are firstly removed
16 ; 2. File instantiation
18 ; Mustache (extended) substitutions are applied using JSON
19 ; data deduced from config.xml file of the widget.
21 ; 3. Extraction of units
23 ; Extract produced units, pack it (remove empty lines and directives)
27 ; Any directive occupy one whole line starting with %
31 ; produce an empty line at the end
33 ; - %begin systemd-unit
36 ; delimit the produced unit
38 ; - %systemd-unit user
39 ; - %systemd-unit system
41 ; tells the kind of unit (user/system)
43 ; - %systemd-unit service NAME
44 ; - %systemd-unit socket NAME
46 ; gives the name and type of the unit
48 ; - %systemd-unit wanted-by NAME
50 ; tells to install a link to unit in the wants of NAME
54 ; AFM uses the feature of systemd that completely ignores options prefixed
57 ; Consequently, options starting with X-AFM- are recorded as public data
58 ; about the application and options starting starting with X-AFM-- are
59 ; recorded as private data.
63 ; X-AFM-description={{description}}
65 ; Records the description of the unit in the field "description"
66 ; of both the public and private object describing the unit.
68 ; X-AFM--wgtdir={{:#metadata.install-dir}}
70 ; Records the installation directory path in the field "wgtdir"
71 ; of the private object only.
73 ;---------------------------------------------------------------------------------
76 ;---------------------------------------------------------------------------------
77 ;---- P R O V I D E D U N I T S ----
78 ;---------------------------------------------------------------------------------
81 # auto generated by wgtpkg-unit for {{:id}} version {{:version}} target {{:#target}} of {{:idaver}}
85 Description={{description}}
86 X-AFM-description={{description}}
87 X-AFM-name={{name.content}}
88 X-AFM-shortname={{name.short}}
90 # use X-AFM-id={{:id}}--{{:ver}}--{{:#target}}
92 X-AFM-id={{idaver}}{{^#target=main}}@{{:#target}}{{/#target=main}}
93 # when home screen will use real ids
95 X-AFM-version={{:version}}
96 X-AFM-author={{author.content}}
97 X-AFM-author-email={{author.email}}
99 X-AFM-height={{height}}
101 X-AFM-icon={{:#metadata.install-dir}}/{{:src}}
104 X-AFM--target-name={{:#target}}
105 X-AFM--content={{content.src}}
106 X-AFM--type={{content.type}}
107 X-AFM--wgtdir={{:#metadata.install-dir}}
108 X-AFM--workdir={{&#metadata.app-data-dir}}/{{:id}}
113 # Adds check to smack
114 ConditionSecurity=smack
117 # Automatic bound to required api
120 BindsTo=afm-api-ws-{{name}}@%i.socket
121 After=afm-api-ws-{{name}}@%i.socket
127 EnvironmentFile=-@afm_confdir@/unit.env.d/*
128 SmackProcessLabel=User::App::{{:id}}
129 SuccessExitStatus=0 SIGKILL
134 {{#required-permission}}
135 {{#urn:AGL:permission::platform:no-oom}} OOMScoreAdjust=-500 {{/urn:AGL:permission::platform:no-oom}}
136 {{#urn:AGL:permission::partner:real-time}} IOSchedulingClass=realtime {{/urn:AGL:permission::partner:real-time}}
137 # {{^urn:AGL:permission::partner:real-time}} RestrictRealtime=on {{/urn:AGL:permission::partner:real-time}}
138 {{#urn:AGL:permission::public:display}} SupplementaryGroups=display {{/urn:AGL:permission::public:display}}
139 {{^urn:AGL:permission::public:syscall:clock}} SystemCallFilter=~@clock {{/urn:AGL:permission::public:syscall:clock}}
140 {{/required-permission}}
143 WorkingDirectory=-{{&#metadata.app-data-dir}}/{{:id}}
144 ExecStartPre=/bin/mkdir -p {{&#metadata.app-data-dir}}/{{:id}}
145 Environment=AFM_APP_INSTALL_DIR={{:#metadata.install-dir}}
146 Environment=PATH=/usr/sbin:/usr/bin:/sbin:/bin:{{:#metadata.install-dir}}
148 ; Needed to enable debug
149 Environment=AFM_ID={{idaver}}{{^#target=main}}@{{:#target}}{{/#target=main}}
150 EnvironmentFile=-/var/run/afm-debug/{{idaver}}{{^#target=main}}@{{:#target}}{{/#target=main}}.env
153 {{#required-permission.urn:AGL:permission::public:hidden}}\
154 %systemd-unit service afm-service-{{:id}}--{{:ver}}--{{:#target}}@
155 {{/required-permission.urn:AGL:permission::public:hidden}}\
156 {{^required-permission.urn:AGL:permission::public:hidden}}\
157 %systemd-unit service afm-appli-{{:id}}--{{:ver}}--{{:#target}}@
158 {{/required-permission.urn:AGL:permission::public:hidden}}\
160 Environment=LD_LIBRARY_PATH=$ORIGIN/lib
162 SyslogIdentifier=afbd-{{idaver}}{{^#target=main}}@{{:#target}}{{/#target=main}}
164 StandardOutput=journal
165 StandardError=journal
167 ;---------------------------------------------------------------------------------
168 ;---- text/html application/vnd.agl.native application/vnd.agl.service ----
169 ;---------------------------------------------------------------------------------
170 {{#content.type=text/html|application/vnd.agl.native|application/vnd.agl.service}}
172 X-AFM--http-port={{:#metadata.http-port}}
174 ExecStart=/usr/bin/afb-daemon \
175 --name afbd-{{idaver}}{{^#target=main}}@{{:#target}}{{/#target=main}} \
176 --rootdir={{:#metadata.install-dir}} \
177 --workdir={{&#metadata.app-data-dir}}/{{id}} \
178 --port={{:#metadata.http-port}} \
182 {{^content.type=application/vnd.agl.service}} \
183 {{#required-permission.urn:AGL:permission::public:no-htdocs}}\
185 {{/required-permission.urn:AGL:permission::public:no-htdocs}}\
186 {{^required-permission.urn:AGL:permission::public:no-htdocs}}\
188 {{/required-permission.urn:AGL:permission::public:no-htdocs}}\
189 {{/content.type=application/vnd.agl.service}} \
190 {{#content.type=application/vnd.agl.service}} \
192 {{/content.type=application/vnd.agl.service}} \
193 {{#required-permission.urn:AGL:permission::public:applications:read}}\
194 --alias=/icons:{{:#metadata.icons-dir}} \
195 {{/required-permission.urn:AGL:permission::public:applications:read}}\
198 --ws-client=unix:%t/apis/ws/{{name}} \
201 --ws-client=unix:%t/apis/ws/{{name}} \
204 --dbus-client={{name}} \
207 --binding=%t/apis/lib/{{name}} \
210 --cloud-client={{name}} \
213 --binding={{:#metadata.install-dir}}/{{name}} \
218 {{^required-permission.urn:AGL:permission::partner:service:no-ws}}\
219 --ws-server=sd:{{name}} \
220 {{/required-permission.urn:AGL:permission::partner:service:no-ws}}\
221 {{^required-permission.urn:AGL:permission::partner:service:no-dbus}}\
222 --dbus-server={{name}} \
223 {{/required-permission.urn:AGL:permission::partner:service:no-dbus}}\
226 --ws-server=sd:{{name}} \
229 --dbus-server={{name}} \
232 {{#content.type=text/html}}\
233 --exec /usr/bin/web-runtime http://localhost:@p/{{content.src}}?token=@t
234 {{/content.type=text/html}}\
235 {{#content.type=application/vnd.agl.native}}\
236 --exec {{:#metadata.install-dir}}/{{content.src}} @p @t
237 {{/content.type=application/vnd.agl.native}}
239 {{/content.type=text/html|application/vnd.agl.native|application/vnd.agl.service}}
242 ;---------------------------------------------------------------------------------
243 ;---- application/x-executable ----
244 ;---------------------------------------------------------------------------------
245 {{#content.type=application/x-executable}}
247 ExecStart={{:#metadata.install-dir}}/{{content.src}}
249 {{/content.type=application/x-executable}}
251 ;---------------------------------------------------------------------------------
253 ;---------------------------------------------------------------------------------
254 {{#required-permission.urn:AGL:permission::system:run-by-default}}
257 WantedBy=default.target
258 %systemd-unit wanted-by default.target
259 {{/required-permission.urn:AGL:permission::system:run-by-default}}
264 ;---------------------------------------------------------------------------------
265 ;---- P R O V I D E D A P I S ----
266 ;---------------------------------------------------------------------------------
273 # auto generated by wgtpkg-unit for {{:id}} version {{:version}} target {{:#target}} of {{:idaver}}
276 %systemd-unit socket afm-api-ws-{{name}}@
280 ListenStream=%t/apis/ws/{{name}}
281 FileDescriptorName={{name}}
283 {{#required-permission.urn:AGL:permission::public:hidden}}\
284 Service=afm-service-{{:id}}--{{:ver}}--{{:#target}}@%i.service
285 {{/required-permission.urn:AGL:permission::public:hidden}}\
286 {{^required-permission.urn:AGL:permission::public:hidden}}\
287 Service=afm-appli-{{:id}}--{{:ver}}--{{:#target}}@%i.service
288 {{/required-permission.urn:AGL:permission::public:hidden}}\
290 ;---------------------------------------------------------------------------------
293 WantedBy=sockets.target
294 %systemd-unit wanted-by sockets.target
295 ;---------------------------------------------------------------------------------