summaryrefslogtreecommitdiffstats
path: root/conf/unit
diff options
context:
space:
mode:
Diffstat (limited to 'conf/unit')
-rw-r--r--conf/unit/afm-unit-debug.conf.in36
-rw-r--r--conf/unit/afm-unit.conf.in36
-rw-r--r--conf/unit/generate-unit-conf/Makefile2
-rw-r--r--conf/unit/generate-unit-conf/afm-unit6
-rw-r--r--conf/unit/generate-unit-conf/binder.inc5
-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.inc33
-rw-r--r--conf/unit/generate-unit-conf/service.inc10
8 files changed, 117 insertions, 19 deletions
diff --git a/conf/unit/afm-unit-debug.conf.in b/conf/unit/afm-unit-debug.conf.in
index 55af22d..01d3c2e 100644
--- a/conf/unit/afm-unit-debug.conf.in
+++ b/conf/unit/afm-unit-debug.conf.in
@@ -111,6 +111,12 @@ After=user@%i.service
ConditionSecurity=smack
%nl
# Automatic bound to required api
+{{#required-binding}}
+{{#value=extern}}
+BindsTo=afm-link-{{name}}@%i.service
+After=afm-link-{{name}}@%i.service
+{{/value=extern}}
+{{/required-binding}}
{{#required-api}}
{{#value=auto|ws}}
BindsTo=afm-api-{{name}}@%i.service
@@ -119,8 +125,8 @@ After=afm-api-{{name}}@%i.service
{{/required-api}}
{{#provided-api}}
{{#value=ws|auto}}
-Requires=afm-api-{{name}}@%i.service
-After=afm-api-{{name}}@%i.service
+Requires=afm-api-{{name}}@%i.socket
+After=afm-api-{{name}}@%i.socket
{{/value=ws|auto}}
{{/provided-api}}
%nl
@@ -174,10 +180,13 @@ ExecStart=/usr/bin/afb-daemon \
{{#required-api}} \
{{#value=auto|ws}}--ws-client=unix:@afm_users_rundir@/%i/apis/ws/{{name}}{{/value=auto|ws}} \
{{#value=dbus}}--dbus-client={{name}}{{/value=dbus}} \
- {{#value=link}}--binding=@afm_users_rundir@/%i/apis/lib/{{name}}{{/value=link}} \
{{#value=cloud}}--cloud-client={{name}}{{/value=cloud}} \
{{#value=local}}--binding={{:#metadata.install-dir}}/{{name}}{{/value=local}} \
{{/required-api}} \
+ {{#required-binding}} \
+ {{#value=local}}--binding={{:#metadata.install-dir}}/{{name}}{{/value=local}} \
+ {{#value=extern}}--binding=@afm_users_rundir@/%i/apis/link/{{name}}{{/value=extern}} \
+ {{/required-binding}} \
{{#provided-api}} \
{{#value=auto|ws}}--ws-server=sd:{{name}}{{/value=auto|ws}} \
{{#value=dbus}}--dbus-server={{name}}{{/value=dbus}} \
@@ -250,6 +259,27 @@ Service=afm-{{#required-permission.urn:AGL:permission::public:hidden}}service{{/
%end systemd-unit
{{/value=ws|auto}}
{{/provided-api}}
+;-------------------------------------------------------------------------------
+;---- 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 afm-link-{{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}} @afm_users_rundir@/%i/apis/link/{{name}}
+%end systemd-unit
+{{/provided-binding}}
{{/targets}}
;---------------------------------------------------------------------------------
; End of file afm-unit.conf mode DEVEL
diff --git a/conf/unit/afm-unit.conf.in b/conf/unit/afm-unit.conf.in
index 0cbe103..74c57ea 100644
--- a/conf/unit/afm-unit.conf.in
+++ b/conf/unit/afm-unit.conf.in
@@ -111,6 +111,12 @@ After=user@%i.service
ConditionSecurity=smack
%nl
# Automatic bound to required api
+{{#required-binding}}
+{{#value=extern}}
+BindsTo=afm-link-{{name}}@%i.service
+After=afm-link-{{name}}@%i.service
+{{/value=extern}}
+{{/required-binding}}
{{#required-api}}
{{#value=auto|ws}}
BindsTo=afm-api-{{name}}@%i.service
@@ -119,8 +125,8 @@ After=afm-api-{{name}}@%i.service
{{/required-api}}
{{#provided-api}}
{{#value=ws|auto}}
-Requires=afm-api-{{name}}@%i.service
-After=afm-api-{{name}}@%i.service
+Requires=afm-api-{{name}}@%i.socket
+After=afm-api-{{name}}@%i.socket
{{/value=ws|auto}}
{{/provided-api}}
%nl
@@ -174,10 +180,13 @@ ExecStart=/usr/bin/afb-daemon \
{{#required-api}} \
{{#value=auto|ws}}--ws-client=unix:@afm_users_rundir@/%i/apis/ws/{{name}}{{/value=auto|ws}} \
{{#value=dbus}}--dbus-client={{name}}{{/value=dbus}} \
- {{#value=link}}--binding=@afm_users_rundir@/%i/apis/lib/{{name}}{{/value=link}} \
{{#value=cloud}}--cloud-client={{name}}{{/value=cloud}} \
{{#value=local}}--binding={{:#metadata.install-dir}}/{{name}}{{/value=local}} \
{{/required-api}} \
+ {{#required-binding}} \
+ {{#value=local}}--binding={{:#metadata.install-dir}}/{{name}}{{/value=local}} \
+ {{#value=extern}}--binding=@afm_users_rundir@/%i/apis/link/{{name}}{{/value=extern}} \
+ {{/required-binding}} \
{{#provided-api}} \
{{#value=auto|ws}}--ws-server=sd:{{name}}{{/value=auto|ws}} \
{{#value=dbus}}--dbus-server={{name}}{{/value=dbus}} \
@@ -250,6 +259,27 @@ Service=afm-{{#required-permission.urn:AGL:permission::public:hidden}}service{{/
%end systemd-unit
{{/value=ws|auto}}
{{/provided-api}}
+;-------------------------------------------------------------------------------
+;---- 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 afm-link-{{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}} @afm_users_rundir@/%i/apis/link/{{name}}
+%end systemd-unit
+{{/provided-binding}}
{{/targets}}
;---------------------------------------------------------------------------------
; End of file afm-unit.conf mode RELEASE
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}}