summaryrefslogtreecommitdiffstats
path: root/conf/afm-unit-debug.conf.in
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2017-11-15 16:20:28 +0100
committerJosé Bollo <jose.bollo@iot.bzh>2017-11-24 17:44:57 +0100
commit88531199d2f46f8758dd1ef3262e567cc849c0b8 (patch)
tree610ecc205121ddd7421755e07be878901830ed73 /conf/afm-unit-debug.conf.in
parent597a0e00c4fcb1af745804be6249f08203084f62 (diff)
Generate afm-unit.conf using m4
The use of m4 to generate the afm-unit.conf and afm-unit-debug.conf files has benefits: - the sync between debug versus not debug is mechanical - it allows easier maintainance by improving readability and writability (ex: macros TARGET or UNIT_NAME_BASE) Change-Id: Ic0427bedf4f8a5b174318562336603077f174fa5 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'conf/afm-unit-debug.conf.in')
-rw-r--r--conf/afm-unit-debug.conf.in157
1 files changed, 35 insertions, 122 deletions
diff --git a/conf/afm-unit-debug.conf.in b/conf/afm-unit-debug.conf.in
index e403a69..7588d32 100644
--- a/conf/afm-unit-debug.conf.in
+++ b/conf/afm-unit-debug.conf.in
@@ -3,6 +3,10 @@
;
; afm-unit.conf
;
+; Mode:
+;
+; DEVEL
+;
; Role:
;
; Configure how installation of widget produces unit files for systemd
@@ -72,15 +76,12 @@
;
;---------------------------------------------------------------------------------
{{#targets}}
-
;---------------------------------------------------------------------------------
-;---- P R O V I D E D U N I T S ----
+;---- M A I N P A R T O F T H E S E R V I C E ----
;---------------------------------------------------------------------------------
%begin systemd-unit
-
# auto generated by wgtpkg-unit for {{:id}} version {{:version}} target {{:#target}} of {{:idaver}}
%nl
-
[Unit]
Description={{description}}
X-AFM-description={{description}}
@@ -107,13 +108,10 @@ X-AFM--type={{content.type}}
X-AFM--wgtdir={{:#metadata.install-dir}}
X-AFM--workdir={{&#metadata.app-data-dir}}/{{:id}}
%nl
-
Wants=sockets.target
-
# Adds check to smack
ConditionSecurity=smack
%nl
-
# Automatic bound to required api
{{#required-api}}
{{#value=auto|ws}}
@@ -122,28 +120,20 @@ After=afm-api-ws-{{name}}@%i.socket
{{/value=auto|ws}}
{{/required-api}}
%nl
-
[Service]
EnvironmentFile=-@afm_confdir@/unit.env.d/*
SmackProcessLabel=User::App::{{:id}}
SuccessExitStatus=0 SIGKILL
-
#PAMName=su
User=%i
Slice=user-%i.slice
-
CapabilityBoundingSet=
AmbientCapabilities=
-
-{{#required-permission}}
- {{#urn:AGL:permission::platform:no-oom}} OOMScoreAdjust=-500 {{/urn:AGL:permission::platform:no-oom}}
- {{#urn:AGL:permission::partner:real-time}} IOSchedulingClass=realtime {{/urn:AGL:permission::partner:real-time}}
-# {{^urn:AGL:permission::partner:real-time}} RestrictRealtime=on {{/urn:AGL:permission::partner:real-time}}
- {{#urn:AGL:permission::public:display}} SupplementaryGroups=display {{/urn:AGL:permission::public:display}}
- {{^urn:AGL:permission::public:syscall:clock}} SystemCallFilter=~@clock {{/urn:AGL:permission::public:syscall:clock}}
-{{/required-permission}}
+{{#required-permission.urn:AGL:permission::platform:no-oom}}OOMScoreAdjust=-500{{/required-permission.urn:AGL:permission::platform:no-oom}}
+{{#required-permission.urn:AGL:permission::partner:real-time}}IOSchedulingClass=realtime{{/required-permission.urn:AGL:permission::partner:real-time}}
+{{#required-permission.urn:AGL:permission::public:display}}SupplementaryGroups=display{{/required-permission.urn:AGL:permission::public:display}}
+{{^required-permission.urn:AGL:permission::public:syscall:clock}}SystemCallFilter=~@clock{{/required-permission.urn:AGL:permission::public:syscall:clock}}
%nl
-
WorkingDirectory=-{{&#metadata.app-data-dir}}/{{:id}}
ExecStartPre=/bin/mkdir -p {{&#metadata.app-data-dir}}/{{:id}}
Environment=AFM_APP_INSTALL_DIR={{:#metadata.install-dir}}
@@ -153,160 +143,83 @@ Environment=XDG_CONFIG_HOME={{&#metadata.app-data-dir}}/{{:id}}
Environment=XDG_CACHE_HOME={{&#metadata.app-data-dir}}/{{:id}}
Environment=XDG_RUNTIME_DIR=/run/user/%i
Environment=DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%i/bus
-
+Environment=LD_LIBRARY_PATH=$ORIGIN/lib
; Needed to enable debug
Environment=AFM_ID={{idaver}}{{^#target=main}}@{{:#target}}{{/#target=main}}
EnvironmentFile=-/var/run/afm-debug/{{idaver}}{{^#target=main}}@{{:#target}}{{/#target=main}}.env
-
%systemd-unit system
-{{#required-permission.urn:AGL:permission::public:hidden}}\
-%systemd-unit service afm-service-{{:id}}--{{:ver}}--{{:#target}}@
-{{/required-permission.urn:AGL:permission::public:hidden}}\
-{{^required-permission.urn:AGL:permission::public:hidden}}\
-%systemd-unit service afm-appli-{{:id}}--{{:ver}}--{{:#target}}@
-{{/required-permission.urn:AGL:permission::public:hidden}}\
-
-Environment=LD_LIBRARY_PATH=$ORIGIN/lib
-
+%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}}
SyslogIdentifier=afbd-{{idaver}}{{^#target=main}}@{{:#target}}{{/#target=main}}
StandardInput=null
StandardOutput=journal
StandardError=journal
-
;---------------------------------------------------------------------------------
;---- text/html application/vnd.agl.native application/vnd.agl.service ----
;---------------------------------------------------------------------------------
{{#content.type=text/html|application/vnd.agl.native|application/vnd.agl.service}}
-
-X-AFM--http-port={{:#metadata.http-port}}
-
+X-AFM-http-port={{:#metadata.http-port}}
ExecStart=/usr/bin/afb-daemon \
--name afbd-{{idaver}}{{^#target=main}}@{{:#target}}{{/#target=main}} \
--rootdir={{:#metadata.install-dir}} \
--workdir={{&#metadata.app-data-dir}}/{{id}} \
- --port={{:#metadata.http-port}} \
- --token=HELLO \
+ --verbose \
--verbose \
--monitoring \
- {{^content.type=application/vnd.agl.service}} \
- {{#required-permission.urn:AGL:permission::public:no-htdocs}}\
- --roothttp=. \
- {{/required-permission.urn:AGL:permission::public:no-htdocs}}\
- {{^required-permission.urn:AGL:permission::public:no-htdocs}}\
- --roothttp=htdocs \
- {{/required-permission.urn:AGL:permission::public:no-htdocs}}\
- {{/content.type=application/vnd.agl.service}} \
- {{#content.type=application/vnd.agl.service}} \
- --roothttp=. \
- {{/content.type=application/vnd.agl.service}} \
- {{#required-permission.urn:AGL:permission::public:applications:read}}\
- --alias=/icons:{{:#metadata.icons-dir}} \
- {{/required-permission.urn:AGL:permission::public:applications:read}}\
- {{#required-api}}\
- {{#value=auto}}\
- --ws-client=unix:%t/apis/ws/{{name}} \
- {{/value=auto}}\
- {{#value=ws}}\
- --ws-client=unix:%t/apis/ws/{{name}} \
- {{/value=ws}}\
- {{#value=dbus}}\
- --dbus-client={{name}} \
- {{/value=dbus}}\
- {{#value=link}}\
- --binding=%t/apis/lib/{{name}} \
- {{/value=link}}\
- {{#value=cloud}}\
- --cloud-client={{name}} \
- {{/value=cloud}}\
- {{#value=local}}\
- --binding={{:#metadata.install-dir}}/{{name}} \
- {{/value=local}}\
- {{/required-api}}\
- {{#provided-api}}\
- {{#value=auto}}\
- {{^required-permission.urn:AGL:permission::partner:service:no-ws}}\
- --ws-server=sd:{{name}} \
- {{/required-permission.urn:AGL:permission::partner:service:no-ws}}\
- {{^required-permission.urn:AGL:permission::partner:service:no-dbus}}\
- --dbus-server={{name}} \
- {{/required-permission.urn:AGL:permission::partner:service:no-dbus}}\
- {{/value=auto}}\
- {{#value=ws}}\
- --ws-server=sd:{{name}} \
- {{/value=ws}}\
- {{#value=dbus}}\
- --dbus-server={{name}} \
- {{/value=dbus}}\
- {{/provided-api}}\
- {{#content.type=text/html}}\
- --exec /usr/bin/web-runtime http://localhost:@p/{{content.src}}?token=@t
- {{/content.type=text/html}}\
- {{#content.type=application/vnd.agl.native}}\
- --exec {{:#metadata.install-dir}}/{{content.src}} @p @t
- {{/content.type=application/vnd.agl.native}}
-
+ --port={{:#metadata.http-port}} \
+ --token=HELLO \
+ --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}} \
+ {{#required-permission.urn:AGL:permission::public:applications:read}}--alias=/icons:{{:#metadata.icons-dir}}{{/required-permission.urn:AGL:permission::public:applications:read}} \
+ {{#required-api}} \
+ {{#value=auto|ws}}--ws-client=unix:%t/apis/ws/{{name}}{{/value=auto|ws}} \
+ {{#value=dbus}}--dbus-client={{name}}{{/value=dbus}} \
+ {{#value=link}}--binding=%t/apis/lib/{{name}}{{/value=link}} \
+ {{#value=cloud}}--cloud-client={{name}}{{/value=cloud}} \
+ {{#value=local}}--binding={{:#metadata.install-dir}}/{{name}}{{/value=local}} \
+ {{/required-api}} \
+ {{#provided-api}} \
+ {{#value=auto|ws}}--ws-server=sd:{{name}}{{/value=auto|ws}} \
+ {{#value=dbus}}--dbus-server={{name}}{{/value=dbus}} \
+ {{/provided-api}} \
+ {{#content.type=text/html}}--exec /usr/bin/web-runtime http://localhost:@p/{{content.src}}?token=@t{{/content.type=text/html}} \
+ {{#content.type=application/vnd.agl.native}}--exec {{:#metadata.install-dir}}/{{content.src}} @p @t{{/content.type=application/vnd.agl.native}}
{{/content.type=text/html|application/vnd.agl.native|application/vnd.agl.service}}
-
-
;---------------------------------------------------------------------------------
;---- application/x-executable ----
;---------------------------------------------------------------------------------
{{#content.type=application/x-executable}}
-
ExecStart={{:#metadata.install-dir}}/{{content.src}}
-
{{/content.type=application/x-executable}}
-
+{{#required-permission.urn:AGL:permission::system:run-by-default}}
;---------------------------------------------------------------------------------
; auto start
;---------------------------------------------------------------------------------
-{{#required-permission.urn:AGL:permission::system:run-by-default}}
-%nl
[Install]
WantedBy=default.target
%systemd-unit wanted-by default.target
{{/required-permission.urn:AGL:permission::system:run-by-default}}
-
%end systemd-unit
-
-
;---------------------------------------------------------------------------------
;---- P R O V I D E D A P I S ----
;---------------------------------------------------------------------------------
-
{{#provided-api}}
{{#value=ws|auto}}
-
%begin systemd-unit
-
# auto generated by wgtpkg-unit for {{:id}} version {{:version}} target {{:#target}} of {{:idaver}}
-#
%systemd-unit system
%systemd-unit socket afm-api-ws-{{name}}@
-
[Socket]
SmackLabel=*
ListenStream=%t/apis/ws/{{name}}
FileDescriptorName={{name}}
-
-{{#required-permission.urn:AGL:permission::public:hidden}}\
-Service=afm-service-{{:id}}--{{:ver}}--{{:#target}}@%i.service
-{{/required-permission.urn:AGL:permission::public:hidden}}\
-{{^required-permission.urn:AGL:permission::public:hidden}}\
-Service=afm-appli-{{:id}}--{{:ver}}--{{:#target}}@%i.service
-{{/required-permission.urn:AGL:permission::public:hidden}}\
-
-;---------------------------------------------------------------------------------
+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
%nl
[Install]
WantedBy=sockets.target
%systemd-unit wanted-by sockets.target
-;---------------------------------------------------------------------------------
-
%end systemd-unit
-
{{/value=ws|auto}}
{{/provided-api}}
-
{{/targets}}
-
+;---------------------------------------------------------------------------------
+; End of file afm-unit.conf mode DEVEL
+;---------------------------------------------------------------------------------