Generate afm-unit.conf using m4
[src/app-framework-main.git] / conf / afm-unit-debug.conf.in
1 ;---------------------------------------------------------------------------------
2 ; File:
3 ;
4 ;    afm-unit.conf
5 ;
6 ; Mode:
7 ;
8 ;    DEVEL
9 ;
10 ; Role:
11 ;
12 ;    Configure how installation of widget produces unit files for systemd
13 ;
14 ; Processing and format:
15 ;
16 ;    1. File load
17 ;
18 ;           Lines beginning with ; are firstly removed
19 ;
20 ;    2. File instantiation
21 ;
22 ;           Mustache (extended) substitutions are applied using JSON
23 ;           data deduced from config.xml file of the widget.
24 ;
25 ;    3. Extraction of units
26 ;
27 ;           Extract produced units, pack it (remove empty lines and directives)
28 ;
29 ; Directives:
30 ;
31 ;    Any directive occupy one whole line starting with %
32 ;
33 ;     - %nl
34 ;
35 ;             produce an empty line at the end
36 ;
37 ;     - %begin systemd-unit
38 ;     - %end systemd-unit
39 ;
40 ;             delimit the produced unit
41 ;
42 ;     - %systemd-unit user
43 ;     - %systemd-unit system
44 ;
45 ;             tells the kind of unit (user/system)
46 ;
47 ;     - %systemd-unit service NAME
48 ;     - %systemd-unit socket NAME
49 ;
50 ;             gives the name and type of the unit
51 ;
52 ;     - %systemd-unit wanted-by NAME
53 ;
54 ;             tells to install a link to unit in the wants of NAME
55 ;
56 ; Setting variables:
57 ;
58 ;    AFM uses the feature of systemd that completely ignores options prefixed
59 ;    with X-
60 ;
61 ;    Consequently, options starting with X-AFM- are recorded as public data
62 ;    about the application and options starting starting with X-AFM-- are
63 ;    recorded as private data.
64 ;
65 ;    Examples:
66 ;
67 ;        X-AFM-description={{description}}
68 ;
69 ;              Records the description of the unit in the field "description"
70 ;              of both the public and private object describing the unit.
71 ;
72 ;        X-AFM--wgtdir={{:#metadata.install-dir}}
73 ;
74 ;              Records the installation directory path in the field "wgtdir"
75 ;              of the private object only.
76 ;
77 ;---------------------------------------------------------------------------------
78 {{#targets}}
79 ;---------------------------------------------------------------------------------
80 ;----         M A I N    P A R T    O F   T H E   S E R V I C E               ----
81 ;---------------------------------------------------------------------------------
82 %begin systemd-unit
83 # auto generated by wgtpkg-unit for {{:id}} version {{:version}} target {{:#target}} of {{:idaver}}
84 %nl
85 [Unit]
86 Description={{description}}
87 X-AFM-description={{description}}
88 X-AFM-name={{name.content}}
89 X-AFM-shortname={{name.short}}
90 #***************
91 # use X-AFM-id={{:id}}--{{:ver}}--{{:#target}}
92 # instead of:
93 X-AFM-id={{idaver}}{{^#target=main}}@{{:#target}}{{/#target=main}}
94 # when home screen will use real ids
95 #**************
96 X-AFM-version={{:version}}
97 X-AFM-author={{author.content}}
98 X-AFM-author-email={{author.email}}
99 X-AFM-width={{width}}
100 X-AFM-height={{height}}
101 {{#icon}}
102 X-AFM-icon={{:#metadata.install-dir}}/{{:src}}
103 {{/icon}}
104 X-AFM--ID={{:id}}
105 X-AFM--target-name={{:#target}}
106 X-AFM--content={{content.src}}
107 X-AFM--type={{content.type}}
108 X-AFM--wgtdir={{:#metadata.install-dir}}
109 X-AFM--workdir={{&#metadata.app-data-dir}}/{{:id}}
110 %nl
111 Wants=sockets.target
112 # Adds check to smack
113 ConditionSecurity=smack
114 %nl
115 # Automatic bound to required api
116 {{#required-api}}
117 {{#value=auto|ws}}
118 BindsTo=afm-api-ws-{{name}}@%i.socket
119 After=afm-api-ws-{{name}}@%i.socket
120 {{/value=auto|ws}}
121 {{/required-api}}
122 %nl
123 [Service]
124 EnvironmentFile=-@afm_confdir@/unit.env.d/*
125 SmackProcessLabel=User::App::{{:id}}
126 SuccessExitStatus=0 SIGKILL
127 #PAMName=su
128 User=%i
129 Slice=user-%i.slice
130 CapabilityBoundingSet=
131 AmbientCapabilities=
132 {{#required-permission.urn:AGL:permission::platform:no-oom}}OOMScoreAdjust=-500{{/required-permission.urn:AGL:permission::platform:no-oom}}
133 {{#required-permission.urn:AGL:permission::partner:real-time}}IOSchedulingClass=realtime{{/required-permission.urn:AGL:permission::partner:real-time}}
134 {{#required-permission.urn:AGL:permission::public:display}}SupplementaryGroups=display{{/required-permission.urn:AGL:permission::public:display}}
135 {{^required-permission.urn:AGL:permission::public:syscall:clock}}SystemCallFilter=~@clock{{/required-permission.urn:AGL:permission::public:syscall:clock}}
136 %nl
137 WorkingDirectory=-{{&#metadata.app-data-dir}}/{{:id}}
138 ExecStartPre=/bin/mkdir -p {{&#metadata.app-data-dir}}/{{:id}}
139 Environment=AFM_APP_INSTALL_DIR={{:#metadata.install-dir}}
140 Environment=PATH=/usr/sbin:/usr/bin:/sbin:/bin:{{:#metadata.install-dir}}
141 Environment=XDG_DATA_HOME={{&#metadata.app-data-dir}}/{{:id}}
142 Environment=XDG_CONFIG_HOME={{&#metadata.app-data-dir}}/{{:id}}
143 Environment=XDG_CACHE_HOME={{&#metadata.app-data-dir}}/{{:id}}
144 Environment=XDG_RUNTIME_DIR=/run/user/%i
145 Environment=DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%i/bus
146 Environment=LD_LIBRARY_PATH=$ORIGIN/lib
147 ; Needed to enable debug
148 Environment=AFM_ID={{idaver}}{{^#target=main}}@{{:#target}}{{/#target=main}}
149 EnvironmentFile=-/var/run/afm-debug/{{idaver}}{{^#target=main}}@{{:#target}}{{/#target=main}}.env
150 %systemd-unit system
151 %systemd-unit service afm-{{#required-permission.urn:AGL:permission::public:hidden}}service{{/required-permission.urn:AGL:permission::public:hidden}}{{^required-permission.urn:AGL:permission::public:hidden}}appli{{/required-permission.urn:AGL:permission::public:hidden}}-{{:id}}--{{:ver}}--{{:#target}}
152 SyslogIdentifier=afbd-{{idaver}}{{^#target=main}}@{{:#target}}{{/#target=main}}
153 StandardInput=null
154 StandardOutput=journal
155 StandardError=journal
156 ;---------------------------------------------------------------------------------
157 ;----   text/html  application/vnd.agl.native  application/vnd.agl.service    ----
158 ;---------------------------------------------------------------------------------
159 {{#content.type=text/html|application/vnd.agl.native|application/vnd.agl.service}}
160 X-AFM-http-port={{:#metadata.http-port}}
161 ExecStart=/usr/bin/afb-daemon \
162         --name afbd-{{idaver}}{{^#target=main}}@{{:#target}}{{/#target=main}} \
163         --rootdir={{:#metadata.install-dir}} \
164         --workdir={{&#metadata.app-data-dir}}/{{id}} \
165         --verbose \
166         --verbose \
167         --monitoring \
168         --port={{:#metadata.http-port}} \
169         --token=HELLO \
170         --roothttp={{#content.type=application/vnd.agl.service}}.{{/content.type=application/vnd.agl.service}}{{^content.type=application/vnd.agl.service}}{{#required-permission.urn:AGL:permission::public:no-htdocs}}.{{/required-permission.urn:AGL:permission::public:no-htdocs}}{{^required-permission.urn:AGL:permission::public:no-htdocs}}htdocs{{/required-permission.urn:AGL:permission::public:no-htdocs}}{{/content.type=application/vnd.agl.service}} \
171         {{#required-permission.urn:AGL:permission::public:applications:read}}--alias=/icons:{{:#metadata.icons-dir}}{{/required-permission.urn:AGL:permission::public:applications:read}} \
172         {{#required-api}} \
173                 {{#value=auto|ws}}--ws-client=unix:%t/apis/ws/{{name}}{{/value=auto|ws}} \
174                 {{#value=dbus}}--dbus-client={{name}}{{/value=dbus}} \
175                 {{#value=link}}--binding=%t/apis/lib/{{name}}{{/value=link}} \
176                 {{#value=cloud}}--cloud-client={{name}}{{/value=cloud}} \
177                 {{#value=local}}--binding={{:#metadata.install-dir}}/{{name}}{{/value=local}} \
178         {{/required-api}} \
179         {{#provided-api}} \
180                 {{#value=auto|ws}}--ws-server=sd:{{name}}{{/value=auto|ws}} \
181                 {{#value=dbus}}--dbus-server={{name}}{{/value=dbus}} \
182         {{/provided-api}} \
183         {{#content.type=text/html}}--exec /usr/bin/web-runtime http://localhost:@p/{{content.src}}?token=@t{{/content.type=text/html}} \
184         {{#content.type=application/vnd.agl.native}}--exec {{:#metadata.install-dir}}/{{content.src}} @p @t{{/content.type=application/vnd.agl.native}}
185 {{/content.type=text/html|application/vnd.agl.native|application/vnd.agl.service}}
186 ;---------------------------------------------------------------------------------
187 ;----                 application/x-executable                                ----
188 ;---------------------------------------------------------------------------------
189 {{#content.type=application/x-executable}}
190 ExecStart={{:#metadata.install-dir}}/{{content.src}}
191 {{/content.type=application/x-executable}}
192 {{#required-permission.urn:AGL:permission::system:run-by-default}}
193 ;---------------------------------------------------------------------------------
194 ; auto start
195 ;---------------------------------------------------------------------------------
196 [Install]
197 WantedBy=default.target
198 %systemd-unit wanted-by default.target
199 {{/required-permission.urn:AGL:permission::system:run-by-default}}
200 %end systemd-unit
201 ;---------------------------------------------------------------------------------
202 ;----        P R O V I D E D   A P I S                                        ----
203 ;---------------------------------------------------------------------------------
204 {{#provided-api}}
205 {{#value=ws|auto}}
206 %begin systemd-unit
207 # auto generated by wgtpkg-unit for {{:id}} version {{:version}} target {{:#target}} of {{:idaver}}
208 %systemd-unit system
209 %systemd-unit socket afm-api-ws-{{name}}@
210 [Socket]
211 SmackLabel=*
212 ListenStream=%t/apis/ws/{{name}}
213 FileDescriptorName={{name}}
214 Service=afm-{{#required-permission.urn:AGL:permission::public:hidden}}service{{/required-permission.urn:AGL:permission::public:hidden}}{{^required-permission.urn:AGL:permission::public:hidden}}appli{{/required-permission.urn:AGL:permission::public:hidden}}-{{:id}}--{{:ver}}--{{:#target}}%i.service
215 %nl
216 [Install]
217 WantedBy=sockets.target
218 %systemd-unit wanted-by sockets.target
219 %end systemd-unit
220 {{/value=ws|auto}}
221 {{/provided-api}}
222 {{/targets}}
223 ;---------------------------------------------------------------------------------
224 ; End of file afm-unit.conf mode DEVEL
225 ;---------------------------------------------------------------------------------