diff options
author | José Bollo <jose.bollo@iot.bzh> | 2017-03-17 23:43:41 +0100 |
---|---|---|
committer | José Bollo <jose.bollo@iot.bzh> | 2017-03-20 16:07:43 +0100 |
commit | 2c566e2dc9df934fb3884f9d4a9ad7ffc73a4aab (patch) | |
tree | aca751afe6992e95d99ab43accb1f58bacc517d6 /conf | |
parent | a069be3d476bbdaa56ce4750c8868b4f0682564a (diff) |
Provide unit in config.xml and documentation
This commit remove urn:AGL:widget:provided-application
in favour of urn:AGL:widget:provided-unit.
In the same time, the feature urn:AGL:widget:provided-api
must be attached to a unit. This will enable to export
more than one API for a unit if needed.
Change-Id: I17ade3651db2cd61402875333d063ee05cf57a10
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'conf')
-rw-r--r-- | conf/afm-unit.conf | 177 |
1 files changed, 150 insertions, 27 deletions
diff --git a/conf/afm-unit.conf b/conf/afm-unit.conf index 4cbfc87..82113ef 100644 --- a/conf/afm-unit.conf +++ b/conf/afm-unit.conf @@ -24,7 +24,7 @@ ; ; Directives: ; -; All directive occopy one whole line starting with % +; Any directive occupy one whole line starting with % ; ; - %nl ; @@ -72,9 +72,13 @@ ; ;--------------------------------------------------------------------------------- {{#targets}} + +;--------------------------------------------------------------------------------- +;---- P R O V I D E D U N I T S ---- +;--------------------------------------------------------------------------------- %begin systemd-unit -# auto generated by wgtpkg-unit for {{id}} version {{version}} target {{:#target}} +# auto generated by wgtpkg-unit for {{id}} version {{version}} target {{:#target}} of {{idaver}} %nl [Unit] @@ -82,7 +86,7 @@ Description={{description}} X-AFM-description={{description}} X-AFM-name={{name.content}} X-AFM-shortname={{name.short}} -X-AFM-id={{idaver}} +X-AFM-id={{idaver}}{{^#target=main}}@{{:#target}}{{/#target=main}} X-AFM-version={{version}} X-AFM-author={{author.content}} X-AFM-author-email={{author.email}} @@ -124,16 +128,23 @@ WorkingDirectory=-{{&#metadata.app-data-dir}}/{{id}} ExecStartPre=/bin/mkdir -p {{&#metadata.app-data-dir}}/{{id}} Environment=AFM_APP_INSTALL_DIR={{:#metadata.install-dir}} +%systemd-unit user +{{#required-permission.urn:AGL:permission::public:hidden}}\ +%systemd-unit service afm-service-{{idaver}}{{^#target=main}}@{{:#target}}{{/#target=main}} +{{/required-permission.urn:AGL:permission::public:hidden}}\ +{{^required-permission.urn:AGL:permission::public:hidden}}\ +%systemd-unit service afm-appli-{{idaver}}{{^#target=main}}@{{:#target}}{{/#target=main}} +{{/required-permission.urn:AGL:permission::public:hidden}}\ ;--------------------------------------------------------------------------------- +;---- text/html ---- +;--------------------------------------------------------------------------------- {{#content.type=text/html}} -%systemd-unit user - -%systemd-unit service afm-appli-{{idaver}}{{^#target=main}}@{{:#target}}{{/#target=main}} - X-AFM--http-port={{:#metadata.http-port}} -ExecStart=/usr/bin/afb-daemon --port={{:#metadata.http-port}} --random-token \ +ExecStart=/usr/bin/afb-daemon \ + --port={{:#metadata.http-port}} \ + --random-token \ --rootdir={{:#metadata.install-dir}} \ --workdir={{&#metadata.app-data-dir}}/{{id}} \ {{#required-permission.urn:AGL:permission::public:no-htdocs}}\ @@ -161,17 +172,35 @@ ExecStart=/usr/bin/afb-daemon --port={{:#metadata.http-port}} --random-token \ {{#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}}\ --exec /usr/bin/web-runtime http://localhost:@p/{{content.src}}?token=@t {{/content.type=text/html}} ;--------------------------------------------------------------------------------- +;---- application/x-executable ---- +;--------------------------------------------------------------------------------- {{#content.type=application/x-executable}} -%systemd-unit user -%systemd-unit service afm-appli-{{idaver}}{{^#target=main}}@{{:#target}}{{/#target=main}} - Environment=LD_LIBRARY_PATH=$ORIGIN/$LIB ExecStart={{:#metadata.install-dir}}/{{content.src}} @@ -179,48 +208,142 @@ ExecStart={{:#metadata.install-dir}}/{{content.src}} {{/content.type=application/x-executable}} ;--------------------------------------------------------------------------------- +;---- application/vnd.agl.service ---- +;--------------------------------------------------------------------------------- {{#content.type=application/vnd.agl.service}} -%systemd-unit user -%systemd-unit service afm-service-{{:#target}} - ExecStart=/usr/bin/afb-daemon \ --rootdir={{:#metadata.install-dir}} \ --workdir={{&#metadata.install-dir}}/{{id}} \ - {{^required-permission.urn:AGL:permission::partner:service:no-ws}}\ - --ws-server=sd:{{:#target}} \ - {{/required-permission.urn:AGL:permission::partner:service:no-ws}}\ - {{^required-permission.urn:AGL:permission::partner:service:no-dbus}}\ - --dbus-server={{:#target}} \ - {{/required-permission.urn:AGL:permission::partner:service:no-dbus}}\ + {{#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}}\ --no-httpd -{{^required-permission.urn:AGL:permission::partner:service:no-ws}} + +{{/content.type=application/vnd.agl.service}} + + +;--------------------------------------------------------------------------------- +; auto start +;--------------------------------------------------------------------------------- +{{#required-permission.urn:AGL:permission::system:run-by-default}} +{{^provided-api}} +%nl +[Install] +WantedBy=default.target +%systemd-unit wanted-by default.target +{{/provided-api}} +{{/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}} + %begin systemd-unit -# auto generated by wgtpkg-unit for {{id}} version {{version}} target {{:#target}} +# auto generated by wgtpkg-unit for {{id}} version {{version}} target {{:#target}} of {{idaver}} # %systemd-unit user -%systemd-unit socket afm-service-{{:#target}} +%systemd-unit socket afm-socket-{{name}} [Socket] SmackLabel=* -ListenStream=%t/bindings/{{:#target}} -FileDescriptorName={{:#target}} +ListenStream=%t/bindings/{{name}} +FileDescriptorName={{name}} -{{/required-permission.urn:AGL:permission::partner:service:no-ws}} +{{#required-permission.urn:AGL:permission::public:hidden}}\ +Service=afm-service-{{idaver}}{{^#target=main}}@{{:#target}}{{/#target=main}} +{{/required-permission.urn:AGL:permission::public:hidden}}\ +{{^required-permission.urn:AGL:permission::public:hidden}}\ +Service=afm-appli-{{idaver}}{{^#target=main}}@{{:#target}}{{/#target=main}} +{{/required-permission.urn:AGL:permission::public:hidden}}\ -{{/content.type=application/vnd.agl.service}} +;--------------------------------------------------------------------------------- +{{#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 + +{{/value=ws}} +{{#value=auto}} + +%begin systemd-unit + +# auto generated by wgtpkg-unit for {{id}} version {{version}} target {{:#target}} of {{idaver}} +# +%systemd-unit user +%systemd-unit socket afm-socket-{{name}} + +[Socket] +SmackLabel=* +ListenStream=%t/bindings/{{name}} +FileDescriptorName={{name}} + +{{#required-permission.urn:AGL:permission::public:hidden}}\ +Service=afm-service-{{idaver}}{{^#target=main}}@{{:#target}}{{/#target=main}} +{{/required-permission.urn:AGL:permission::public:hidden}}\ +{{^required-permission.urn:AGL:permission::public:hidden}}\ +Service=afm-appli-{{idaver}}{{^#target=main}}@{{:#target}}{{/#target=main}} +{{/required-permission.urn:AGL:permission::public:hidden}}\ ;--------------------------------------------------------------------------------- {{#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 + +{{/value=auto}} +{{/provided-api}} + {{/targets}} |