From 401188a731f39ce464db3a31d810be962bf21e1d Mon Sep 17 00:00:00 2001 From: José Bollo Date: Wed, 15 May 2019 13:55:45 +0200 Subject: Use definition of afm_prefix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The prefix of the URN for AGL features should be settable. Bug-AGL: SPEC-2436 Change-Id: I49e9634ebc6a280c28caa6e6764e543a7e78253c Signed-off-by: José Bollo --- conf/unit/afm-unit-debug.conf.in | 22 +++++++++++----------- conf/unit/afm-unit.conf.in | 22 +++++++++++----------- conf/unit/generate-unit-conf/afm-unit | 2 +- src/afm-binding.c | 20 ++++++++++---------- src/wgtpkg-install.c | 4 ++-- 5 files changed, 35 insertions(+), 35 deletions(-) diff --git a/conf/unit/afm-unit-debug.conf.in b/conf/unit/afm-unit-debug.conf.in index f09956d..8221105 100644 --- a/conf/unit/afm-unit-debug.conf.in +++ b/conf/unit/afm-unit-debug.conf.in @@ -83,7 +83,7 @@ # auto generated by wgtpkg-unit for {{:id}} version {{:version}} target {{:#target}} of {{:idaver}} %nl %systemd-unit system -%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}}@ +%systemd-unit service afm-{{#required-permission.@afm_prefix@permission::public:hidden}}service{{/required-permission.@afm_prefix@permission::public:hidden}}{{^required-permission.@afm_prefix@permission::public:hidden}}appli{{/required-permission.@afm_prefix@permission::public:hidden}}-{{:id}}--{{:ver}}--{{:#target}}@ [Unit] Description={{description}} X-AFM-description={{description}} @@ -104,7 +104,7 @@ X-AFM--content={{content.src}} X-AFM--type={{content.type}} X-AFM--wgtdir={{:#metadata.install-dir}} X-AFM--workdir=/home/%i/app-data/{{:id}} -X-AFM--visibility={{#required-permission.urn:AGL:permission::public:hidden}}hidden{{/required-permission.urn:AGL:permission::public:hidden}}{{^required-permission.urn:AGL:permission::public:hidden}}visible{{/required-permission.urn:AGL:permission::public:hidden}} +X-AFM--visibility={{#required-permission.@afm_prefix@permission::public:hidden}}hidden{{/required-permission.@afm_prefix@permission::public:hidden}}{{^required-permission.@afm_prefix@permission::public:hidden}}visible{{/required-permission.@afm_prefix@permission::public:hidden}} %nl Requires=afm-user-session@%i.target After=user@%i.service @@ -141,10 +141,10 @@ User=%i Slice=user-%i.slice CapabilityBoundingSet= #AmbientCapabilities= -{{#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}} +{{#required-permission.@afm_prefix@permission::platform:no-oom}}OOMScoreAdjust=-500{{/required-permission.@afm_prefix@permission::platform:no-oom}} +{{#required-permission.@afm_prefix@permission::partner:real-time}}IOSchedulingClass=realtime{{/required-permission.@afm_prefix@permission::partner:real-time}} +{{#required-permission.@afm_prefix@permission::public:display}}SupplementaryGroups=display{{/required-permission.@afm_prefix@permission::public:display}} +{{^required-permission.@afm_prefix@permission::public:syscall:clock}}SystemCallFilter=~@clock{{/required-permission.@afm_prefix@permission::public:syscall:clock}} %nl WorkingDirectory=-/home/%i/app-data/{{:id}} ExecStartPre=/bin/mkdir -p /home/%i/app-data/{{:id}} @@ -180,8 +180,8 @@ ExecStart=/usr/bin/afb-daemon \ --monitoring \ --port={{:#metatarget.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}} \ + --roothttp={{#content.type=application/vnd.agl.service}}.{{/content.type=application/vnd.agl.service}}{{^content.type=application/vnd.agl.service}}{{#required-permission.@afm_prefix@permission::public:no-htdocs}}.{{/required-permission.@afm_prefix@permission::public:no-htdocs}}{{^required-permission.@afm_prefix@permission::public:no-htdocs}}htdocs{{/required-permission.@afm_prefix@permission::public:no-htdocs}}{{/content.type=application/vnd.agl.service}} \ + {{#required-permission.@afm_prefix@permission::public:applications:read}}--alias=/icons:{{:#metadata.icons-dir}}{{/required-permission.@afm_prefix@permission::public:applications:read}} \ {{#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}} \ @@ -207,14 +207,14 @@ ExecStart=/usr/bin/afb-daemon \ {{#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}} +{{#required-permission.@afm_prefix@permission::system:run-by-default}} ;--------------------------------------------------------------------------------- ; auto start ;--------------------------------------------------------------------------------- [Install] WantedBy=afm-user-session@.target %systemd-unit wanted-by afm-user-session@.target -{{/required-permission.urn:AGL:permission::system:run-by-default}} +{{/required-permission.@afm_prefix@permission::system:run-by-default}} %end systemd-unit ;------------------------------------------------------------------------------- ;---- P R O V I D E D A P I S ---- @@ -262,7 +262,7 @@ SmackLabelIPIn=System SmackLabelIPOut=System ListenStream=@afm_users_rundir@/%i/apis/ws/{{name}} FileDescriptorName={{name}} -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 +Service=afm-{{#required-permission.@afm_prefix@permission::public:hidden}}service{{/required-permission.@afm_prefix@permission::public:hidden}}{{^required-permission.@afm_prefix@permission::public:hidden}}appli{{/required-permission.@afm_prefix@permission::public:hidden}}-{{:id}}--{{:ver}}--{{:#target}}@%i.service %end systemd-unit {{/value=ws|auto}} {{/provided-api}} diff --git a/conf/unit/afm-unit.conf.in b/conf/unit/afm-unit.conf.in index 1c14eb1..f8e4409 100644 --- a/conf/unit/afm-unit.conf.in +++ b/conf/unit/afm-unit.conf.in @@ -83,7 +83,7 @@ # auto generated by wgtpkg-unit for {{:id}} version {{:version}} target {{:#target}} of {{:idaver}} %nl %systemd-unit system -%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}}@ +%systemd-unit service afm-{{#required-permission.@afm_prefix@permission::public:hidden}}service{{/required-permission.@afm_prefix@permission::public:hidden}}{{^required-permission.@afm_prefix@permission::public:hidden}}appli{{/required-permission.@afm_prefix@permission::public:hidden}}-{{:id}}--{{:ver}}--{{:#target}}@ [Unit] Description={{description}} X-AFM-description={{description}} @@ -104,7 +104,7 @@ X-AFM--content={{content.src}} X-AFM--type={{content.type}} X-AFM--wgtdir={{:#metadata.install-dir}} X-AFM--workdir=/home/%i/app-data/{{:id}} -X-AFM--visibility={{#required-permission.urn:AGL:permission::public:hidden}}hidden{{/required-permission.urn:AGL:permission::public:hidden}}{{^required-permission.urn:AGL:permission::public:hidden}}visible{{/required-permission.urn:AGL:permission::public:hidden}} +X-AFM--visibility={{#required-permission.@afm_prefix@permission::public:hidden}}hidden{{/required-permission.@afm_prefix@permission::public:hidden}}{{^required-permission.@afm_prefix@permission::public:hidden}}visible{{/required-permission.@afm_prefix@permission::public:hidden}} %nl Requires=afm-user-session@%i.target After=user@%i.service @@ -141,10 +141,10 @@ User=%i Slice=user-%i.slice CapabilityBoundingSet= #AmbientCapabilities= -{{#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}} +{{#required-permission.@afm_prefix@permission::platform:no-oom}}OOMScoreAdjust=-500{{/required-permission.@afm_prefix@permission::platform:no-oom}} +{{#required-permission.@afm_prefix@permission::partner:real-time}}IOSchedulingClass=realtime{{/required-permission.@afm_prefix@permission::partner:real-time}} +{{#required-permission.@afm_prefix@permission::public:display}}SupplementaryGroups=display{{/required-permission.@afm_prefix@permission::public:display}} +{{^required-permission.@afm_prefix@permission::public:syscall:clock}}SystemCallFilter=~@clock{{/required-permission.@afm_prefix@permission::public:syscall:clock}} %nl WorkingDirectory=-/home/%i/app-data/{{:id}} ExecStartPre=/bin/mkdir -p /home/%i/app-data/{{:id}} @@ -180,9 +180,9 @@ ExecStart=/usr/bin/afb-daemon \ {{/content.type=application/vnd.agl.service}}{{^content.type=application/vnd.agl.service}} \ --port={{:#metatarget.http-port}} \ --random-token \ - --roothttp={{#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}} \ + --roothttp={{#required-permission.@afm_prefix@permission::public:no-htdocs}}.{{/required-permission.@afm_prefix@permission::public:no-htdocs}}{{^required-permission.@afm_prefix@permission::public:no-htdocs}}htdocs{{/required-permission.@afm_prefix@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-permission.@afm_prefix@permission::public:applications:read}}--alias=/icons:{{:#metadata.icons-dir}}{{/required-permission.@afm_prefix@permission::public:applications:read}} \ {{#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}} \ @@ -208,14 +208,14 @@ ExecStart=/usr/bin/afb-daemon \ {{#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}} +{{#required-permission.@afm_prefix@permission::system:run-by-default}} ;--------------------------------------------------------------------------------- ; auto start ;--------------------------------------------------------------------------------- [Install] WantedBy=afm-user-session@.target %systemd-unit wanted-by afm-user-session@.target -{{/required-permission.urn:AGL:permission::system:run-by-default}} +{{/required-permission.@afm_prefix@permission::system:run-by-default}} %end systemd-unit ;------------------------------------------------------------------------------- ;---- P R O V I D E D A P I S ---- @@ -263,7 +263,7 @@ SmackLabelIPIn=System SmackLabelIPOut=System ListenStream=@afm_users_rundir@/%i/apis/ws/{{name}} FileDescriptorName={{name}} -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 +Service=afm-{{#required-permission.@afm_prefix@permission::public:hidden}}service{{/required-permission.@afm_prefix@permission::public:hidden}}{{^required-permission.@afm_prefix@permission::public:hidden}}appli{{/required-permission.@afm_prefix@permission::public:hidden}}-{{:id}}--{{:ver}}--{{:#target}}@%i.service %end systemd-unit {{/value=ws|auto}} {{/provided-api}} diff --git a/conf/unit/generate-unit-conf/afm-unit b/conf/unit/generate-unit-conf/afm-unit index 7a47f08..47ba469 100644 --- a/conf/unit/generate-unit-conf/afm-unit +++ b/conf/unit/generate-unit-conf/afm-unit @@ -26,7 +26,7 @@ define( `MUSTACH_IF_NOT', `{{^$1}}pushdef(`ELSE',`{{/$1}}{{#$1}}')pushdef(`ENDIF ----------------------------------------------------------------------- -- -define( `PERM', `urn:AGL:permission:$1') +define( `PERM', `@afm_prefix@permission:$1') define( `REQPERM', `required-permission.PERM($1)') define( `ON_PERM', `MUSTACH_ON(REQPERM($1),$2,$3)') diff --git a/src/afm-binding.c b/src/afm-binding.c index 7716dec..6dcac33 100644 --- a/src/afm-binding.c +++ b/src/afm-binding.c @@ -69,43 +69,43 @@ static const char _update_[] = "update"; static const struct afb_auth auth_perm_widget = { .type = afb_auth_Permission, - .text = "urn:AGL:permission:afm:system:widget" + .text = FWK_PREFIX"permission:afm:system:widget" }, auth_perm_widget_install = { .type = afb_auth_Permission, - .text = "urn:AGL:permission:afm:system:widget:install" + .text = FWK_PREFIX"permission:afm:system:widget:install" }, auth_perm_widget_uninstall = { .type = afb_auth_Permission, - .text = "urn:AGL:permission:afm:system:widget:uninstall" + .text = FWK_PREFIX"permission:afm:system:widget:uninstall" }, auth_perm_widget_preinstall = { .type = afb_auth_Permission, - .text = "urn:AGL:permission:afm:system:widget:preinstall" + .text = FWK_PREFIX"permission:afm:system:widget:preinstall" }, auth_perm_widget_detail = { .type = afb_auth_Permission, - .text = "urn:AGL:permission:afm:system:widget:detail" + .text = FWK_PREFIX"permission:afm:system:widget:detail" }, auth_perm_widget_start = { .type = afb_auth_Permission, - .text = "urn:AGL:permission:afm:system:widget:start" + .text = FWK_PREFIX"permission:afm:system:widget:start" }, auth_perm_widget_view_all = { .type = afb_auth_Permission, - .text = "urn:AGL:permission:afm:system:widget:view-all" + .text = FWK_PREFIX"permission:afm:system:widget:view-all" }, auth_perm_runner = { .type = afb_auth_Permission, - .text = "urn:AGL:permission:afm:system:runner" + .text = FWK_PREFIX"permission:afm:system:runner" }, auth_perm_runner_state = { .type = afb_auth_Permission, - .text = "urn:AGL:permission:afm:system:runner:state" + .text = FWK_PREFIX"permission:afm:system:runner:state" }, auth_perm_runner_kill = { .type = afb_auth_Permission, - .text = "urn:AGL:permission:afm:system:runner:kill" + .text = FWK_PREFIX"permission:afm:system:runner:kill" }, auth_install = { diff --git a/src/wgtpkg-install.c b/src/wgtpkg-install.c index f994b8f..bbeb2fe 100644 --- a/src/wgtpkg-install.c +++ b/src/wgtpkg-install.c @@ -300,7 +300,7 @@ static int for_all_content(const struct wgt_desc *desc, int (*action)(const char rc = action(desc->content_src, desc->content_type); feat = desc->features; while (feat) { - if (!strcmp(feat->name, "urn:AGL:widget:provided-unit")) { + if (!strcmp(feat->name, FWK_PREFIX"widget:provided-unit")) { src = wgt_info_param(feat, "content.src"); type = wgt_info_param(feat, "content.type"); rc2 = action(src, type); @@ -447,7 +447,7 @@ static int install_file_properties(const struct wgt_desc *desc) rc = 0; feat = desc->features; while (feat) { - if (!strcmp(feat->name, "urn:AGL:widget:file-properties")) { + if (!strcmp(feat->name, FWK_PREFIX"widget:file-properties")) { param = feat->params; while (param) { if (!strcmp(param->value, "executable")) { -- cgit 1.2.3-korg