diff options
author | José Bollo <jose.bollo@iot.bzh> | 2018-08-02 18:48:57 +0200 |
---|---|---|
committer | Jan-Simon Moeller <jsmoeller@linuxfoundation.org> | 2018-08-16 13:49:16 +0000 |
commit | 6caade489f8bd15dccdde6c69452d920ead2201e (patch) | |
tree | fd04aca394c42225aa235a6453c560f2eb6761a6 /conf/unit/generate-unit-conf | |
parent | 8c7132a146aa744f167ea2fc45dcd8d53018ecc0 (diff) |
Add the external binding featureflounder_5.99.3flounder/5.99.35.99.3
This commit introduce two new features:
<urn:AGL:widget:provided-binding>
<param "name"="public-name" "value"="relative-path-to-the-binding"/>
<urn:AGL:widget:required-binding>
<param "name"="public-name" "value"="extern">
<param "name"="relative-path-to-the-binding" "value"="local">
TODO: manage security by setting correct Smack label to the exported files
Bugs-AGL: SPEC-1439
Bugs-AGL: SPEC-1663
Change-Id: I70aad7d523ece7a2ae0058b79708a02ef81144e2
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'conf/unit/generate-unit-conf')
-rw-r--r-- | conf/unit/generate-unit-conf/Makefile | 2 | ||||
-rw-r--r-- | conf/unit/generate-unit-conf/afm-unit | 6 | ||||
-rw-r--r-- | conf/unit/generate-unit-conf/binder.inc | 5 | ||||
-rw-r--r-- | conf/unit/generate-unit-conf/provided-api.inc (renamed from conf/unit/generate-unit-conf/provided.inc) | 8 | ||||
-rw-r--r-- | conf/unit/generate-unit-conf/provided-binding.inc | 33 | ||||
-rw-r--r-- | conf/unit/generate-unit-conf/service.inc | 10 |
6 files changed, 51 insertions, 13 deletions
diff --git a/conf/unit/generate-unit-conf/Makefile b/conf/unit/generate-unit-conf/Makefile index 5f5346b..562f025 100644 --- a/conf/unit/generate-unit-conf/Makefile +++ b/conf/unit/generate-unit-conf/Makefile @@ -2,7 +2,7 @@ MAIN = afm-unit -FILES = $(MAIN) binder.inc provided.inc service.inc Makefile +FILES = $(MAIN) binder.inc provided-api.inc provided-binding.inc service.inc Makefile DIR = .. diff --git a/conf/unit/generate-unit-conf/afm-unit b/conf/unit/generate-unit-conf/afm-unit index 40a56fc..99d986d 100644 --- a/conf/unit/generate-unit-conf/afm-unit +++ b/conf/unit/generate-unit-conf/afm-unit @@ -53,6 +53,8 @@ define( `UNIT_NAME_SERVICE', `UNIT_NAME_BASE%i.service') define( `UNIT_NAME_API_BASE', `afm-api-$1') define( `UNIT_NAME_API_SERVICE', `UNIT_NAME_API_BASE($1)@$2.service') define( `UNIT_NAME_API_SOCKET', `UNIT_NAME_API_BASE($1)@$2.socket') +define( `UNIT_NAME_BINDING_BASE', `afm-link-$1') +define( `UNIT_NAME_BINDING_SERVICE', `UNIT_NAME_BINDING_BASE($1)@$2.service') define( `APP_DATA_DIR', `/home/%i/app-data') define( `USER_RUN_DIR', `@afm_users_rundir@/%i') define( `DEBUGGING_DIR', `@afm_platform_rundir@/debug') @@ -144,7 +146,9 @@ divert(0)dnl include(service.inc) -include(provided.inc) +include(provided-api.inc) + +include(provided-binding.inc) {{/targets}} ;--------------------------------------------------------------------------------- diff --git a/conf/unit/generate-unit-conf/binder.inc b/conf/unit/generate-unit-conf/binder.inc index 98efd4e..57f4166 100644 --- a/conf/unit/generate-unit-conf/binder.inc +++ b/conf/unit/generate-unit-conf/binder.inc @@ -33,10 +33,13 @@ ENDIF \ {{#required-api}} \ ON_VALUE(auto|ws, --ws-client=unix:USER_RUN_DIR/apis/ws/{{name}}) \ ON_VALUE(dbus, --dbus-client={{name}}) \ - ON_VALUE(link, --binding=USER_RUN_DIR/apis/lib/{{name}}) \ ON_VALUE(cloud, --cloud-client={{name}}) \ ON_VALUE(local, --binding={{:#metadata.install-dir}}/{{name}}) \ {{/required-api}} \ + {{#required-binding}} \ + ON_VALUE(local, --binding={{:#metadata.install-dir}}/{{name}}) \ + ON_VALUE(extern, --binding=USER_RUN_DIR/apis/link/{{name}}) \ + {{/required-binding}} \ {{#provided-api}} \ ON_VALUE(auto|ws, --ws-server=sd:{{name}}) \ ON_VALUE(dbus, --dbus-server={{name}}) \ diff --git a/conf/unit/generate-unit-conf/provided.inc b/conf/unit/generate-unit-conf/provided-api.inc index 267e2ed..8a667a9 100644 --- a/conf/unit/generate-unit-conf/provided.inc +++ b/conf/unit/generate-unit-conf/provided-api.inc @@ -33,14 +33,6 @@ RemainAfterExit=yes {{#value=ws|auto}} ExecStart=/bin/true {{/value=ws|auto}} -dnl {{#value=link}} -dnl ExecStart=/bin/ln -s {{:#metadata.install-dir}}/ USER_RUN_DIR/apis/link/{{name}} -dnl {{/value=link}} - -dnl %nl -dnl [Install] -dnl WantedBy=afm-user-session@.target -dnl %systemd-unit wanted-by afm-user-session@.target %end systemd-unit diff --git a/conf/unit/generate-unit-conf/provided-binding.inc b/conf/unit/generate-unit-conf/provided-binding.inc new file mode 100644 index 0000000..a5636ee --- /dev/null +++ b/conf/unit/generate-unit-conf/provided-binding.inc @@ -0,0 +1,33 @@ +dnl vim: set filetype=sysctl.conf.m4 syntax=sysctl.conf.m4: +;------------------------------------------------------------------------------- +;---- P R O V I D E D B I N D I N G ---- +;------------------------------------------------------------------------------- + +{{#provided-binding}} + +;------------------------------------------------------------------------------- +;---- T H E S E R V I C E O F T H E B I N D I N G ---- +;------------------------------------------------------------------------------- +%begin systemd-unit + +# auto generated by wgtpkg-unit for {{:id}} version {{:version}} target {{:#target}} of {{:idaver}} + +%systemd-unit system +%systemd-unit service UNIT_NAME_BINDING_BASE({{name}})@ + +[Unit] +Description=Provides binding {{name}} for user %i + +Requires=afm-user-setup@%i.service +After=afm-user-setup@%i.service + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=/bin/ln -s {{:#metadata.install-dir}}/{{value}} USER_RUN_DIR/apis/link/{{name}} + +%end systemd-unit + +{{/provided-binding}} + + diff --git a/conf/unit/generate-unit-conf/service.inc b/conf/unit/generate-unit-conf/service.inc index 3efa975..1df4210 100644 --- a/conf/unit/generate-unit-conf/service.inc +++ b/conf/unit/generate-unit-conf/service.inc @@ -40,6 +40,12 @@ ConditionSecurity=smack %nl # Automatic bound to required api +{{#required-binding}} +{{#value=extern}} +BindsTo=UNIT_NAME_BINDING_SERVICE({{name}},%i) +After=UNIT_NAME_BINDING_SERVICE({{name}},%i) +{{/value=extern}} +{{/required-binding}} {{#required-api}} {{#value=auto|ws}} BindsTo=UNIT_NAME_API_SERVICE({{name}},%i) @@ -48,8 +54,8 @@ After=UNIT_NAME_API_SERVICE({{name}},%i) {{/required-api}} {{#provided-api}} {{#value=ws|auto}} -Requires=UNIT_NAME_API_SERVICE({{name}},%i) -After=UNIT_NAME_API_SERVICE({{name}},%i) +Requires=UNIT_NAME_API_SOCKET({{name}},%i) +After=UNIT_NAME_API_SOCKET({{name}},%i) {{/value=ws|auto}} {{/provided-api}} |