aboutsummaryrefslogtreecommitdiffstats
path: root/conf/unit/afm-unit.conf.in
diff options
context:
space:
mode:
Diffstat (limited to 'conf/unit/afm-unit.conf.in')
-rw-r--r--conf/unit/afm-unit.conf.in224
1 files changed, 224 insertions, 0 deletions
diff --git a/conf/unit/afm-unit.conf.in b/conf/unit/afm-unit.conf.in
new file mode 100644
index 0000000..64c2f23
--- /dev/null
+++ b/conf/unit/afm-unit.conf.in
@@ -0,0 +1,224 @@
+;---------------------------------------------------------------------------------
+; File:
+;
+; afm-unit.conf
+;
+; Mode:
+;
+; RELEASE
+;
+; Role:
+;
+; Configure how installation of widget produces unit files for systemd
+;
+; Processing and format:
+;
+; 1. File load
+;
+; Lines beginning with ; are firstly removed
+;
+; 2. File instantiation
+;
+; Mustache (extended) substitutions are applied using JSON
+; data deduced from config.xml file of the widget.
+;
+; 3. Extraction of units
+;
+; Extract produced units, pack it (remove empty lines and directives)
+;
+; Directives:
+;
+; Any directive occupy one whole line starting with %
+;
+; - %nl
+;
+; produce an empty line at the end
+;
+; - %begin systemd-unit
+; - %end systemd-unit
+;
+; delimit the produced unit
+;
+; - %systemd-unit user
+; - %systemd-unit system
+;
+; tells the kind of unit (user/system)
+;
+; - %systemd-unit service NAME
+; - %systemd-unit socket NAME
+;
+; gives the name and type of the unit
+;
+; - %systemd-unit wanted-by NAME
+;
+; tells to install a link to unit in the wants of NAME
+;
+; Setting variables:
+;
+; AFM uses the feature of systemd that completely ignores options prefixed
+; with X-
+;
+; Consequently, options starting with X-AFM- are recorded as public data
+; about the application and options starting starting with X-AFM-- are
+; recorded as private data.
+;
+; Examples:
+;
+; X-AFM-description={{description}}
+;
+; Records the description of the unit in the field "description"
+; of both the public and private object describing the unit.
+;
+; X-AFM--wgtdir={{:#metadata.install-dir}}
+;
+; Records the installation directory path in the field "wgtdir"
+; of the private object only.
+;
+;---------------------------------------------------------------------------------
+{{#targets}}
+;---------------------------------------------------------------------------------
+;---- 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
+%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}}@
+[Unit]
+Description={{description}}
+X-AFM-description={{description}}
+X-AFM-name={{name.content}}
+X-AFM-shortname={{name.short}}
+X-AFM-id={{idaver}}{{^#target=main}}@{{:#target}}{{/#target=main}}
+X-AFM-version={{:version}}
+X-AFM-author={{author.content}}
+X-AFM-author-email={{author.email}}
+X-AFM-width={{width}}
+X-AFM-height={{height}}
+{{#icon}}
+X-AFM-icon={{:#metadata.install-dir}}/{{:src}}
+{{/icon}}
+X-AFM--ID={{:id}}
+X-AFM--target-name={{:#target}}
+X-AFM--content={{content.src}}
+X-AFM--type={{content.type}}
+X-AFM--wgtdir={{:#metadata.install-dir}}
+X-AFM--workdir=/home/%i/app-data/{{:id}}
+%nl
+Wants=afm-user-session@%i.target
+After=afm-user-setup@%i.service
+# Adds check to smack
+ConditionSecurity=smack
+%nl
+# Automatic bound to required api
+{{#required-api}}
+{{#value=auto|ws}}
+BindsTo=afm-api-ws-{{name}}@%i.socket
+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
+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}}
+%nl
+WorkingDirectory=-/home/%i/app-data/{{:id}}
+ExecStartPre=/bin/mkdir -p /home/%i/app-data/{{:id}}
+Environment=AFM_APP_INSTALL_DIR={{:#metadata.install-dir}}
+Environment=PATH=/usr/sbin:/usr/bin:/sbin:/bin:{{:#metadata.install-dir}}
+Environment=XDG_DATA_HOME=/home/%i/app-data/{{:id}}
+Environment=XDG_CONFIG_HOME=/home/%i/app-data/{{:id}}
+Environment=XDG_CACHE_HOME=/home/%i/app-data/{{: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
+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}}
+{{^content.type=application/vnd.agl.service}}
+X-AFM--http-port={{:#metadata.http-port}}
+{{/content.type=application/vnd.agl.service}}
+Type=notify
+ExecStart=/usr/bin/afb-daemon \
+ --name afbd-{{idaver}}{{^#target=main}}@{{:#target}}{{/#target=main}} \
+ --rootdir={{:#metadata.install-dir}} \
+ --workdir=/home/%i/app-data/{{id}} \
+ {{#content.type=application/vnd.agl.service}} \
+ --no-httpd \
+ {{/content.type=application/vnd.agl.service}}{{^content.type=application/vnd.agl.service}} \
+ --port={{:#metadata.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}} \
+ {{/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:/run/user/%i/apis/ws/{{name}}{{/value=auto|ws}} \
+ {{#value=dbus}}--dbus-client={{name}}{{/value=dbus}} \
+ {{#value=link}}--binding=/run/user/%i/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
+;---------------------------------------------------------------------------------
+[Install]
+WantedBy=agl-user-session@.target
+%systemd-unit wanted-by agl-user-session@.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}}@
+[Unit]
+Description=Provides api {{name}} for user %i
+After=afm-user-setup@%i.service
+[Socket]
+SmackLabel=*
+ListenStream=/run/user/%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
+%nl
+[Install]
+WantedBy=agl-user-session@.target
+%systemd-unit wanted-by agl-user-session@.target
+%end systemd-unit
+{{/value=ws|auto}}
+{{/provided-api}}
+{{/targets}}
+;---------------------------------------------------------------------------------
+; End of file afm-unit.conf mode RELEASE
+;---------------------------------------------------------------------------------