summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2017-08-07 18:07:26 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2017-08-07 18:34:40 +0200
commit3adee97248b312fa2e943695a88ff2ab3fc0fba5 (patch)
tree9b53c7e6ded41a33e276bea0d8878b73e7f1d915
parentdb0f29830b95f917029d5b91267e3493c0444d58 (diff)
Handle file-properties for setting eXecutable flag
This commits introduce the feature "urn:AGL:widget:file-properties". This feature actually only allows to set execution flag to files of the widget. Example: <feature name="urn:AGL:widget:file-properties"> <param name="flite" value="executable" /> <param name="jtalk" value="executable" /> </feature> Bug-AGL: SPEC-384 Change-Id: If13ca3b1015576317fd52cb9540b77d0e2675f67 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r--docs/2.2-config.xml.md22
-rw-r--r--src/wgtpkg-install.c34
2 files changed, 56 insertions, 0 deletions
diff --git a/docs/2.2-config.xml.md b/docs/2.2-config.xml.md
index f6c88ab..a7f32dc 100644
--- a/docs/2.2-config.xml.md
+++ b/docs/2.2-config.xml.md
@@ -348,6 +348,28 @@ The value is one of the following values:
- auto:
export the api using the default method(s).
+### file-properties: feature name="urn:AGL:widget:file-properties"
+
+Use this feature for setting properties to files of the widget.
+At this time, this feature only allows to set executable flag
+for making companion program executable explicitly.
+
+Example:
+
+```xml
+ <feature name="urn:AGL:widget:file-properties">
+ <param name="flite" value="executable" />
+ <param name="jtalk" value="executable" />
+ </feature>
+```
+
+#### file-properties: param name="path"
+
+The name is the relative path of the file whose property
+must be set.
+
+The value must be "executable" to make the file executable.
+
## Known content types
The configuration file ***/etc/afm/afm-unit.conf*** defines
diff --git a/src/wgtpkg-install.c b/src/wgtpkg-install.c
index 3f5ab92..79cb7fb 100644
--- a/src/wgtpkg-install.c
+++ b/src/wgtpkg-install.c
@@ -388,6 +388,37 @@ static int install_exec_flag(const struct wgt_desc *desc)
return for_all_content(desc, set_exec_flag);
}
+static int install_file_properties(const struct wgt_desc *desc)
+{
+ int rc, rc2;
+ struct wgt_desc_feature *feat;
+ struct wgt_desc_param *param;
+
+ rc = 0;
+ feat = desc->features;
+ while (feat) {
+ if (!strcmp(feat->name, "urn:AGL:widget:file-properties")) {
+ param = feat->params;
+ while (param) {
+ if (!strcmp(param->value, "executable")) {
+ rc2 = fchmodat(workdirfd, param->name, 0755, 0);
+ if (rc2 < 0)
+ ERROR("can't make executable the file %s: %m", param->name);
+ } else {
+ ERROR("unknown file property %s for %s", param->value, param->name);
+ errno = EINVAL;
+ rc2 = -1;
+ }
+ if (rc2 < 0 && !rc)
+ rc = rc2;
+ param = param->next;
+ }
+ }
+ feat = feat->next;
+ }
+ return rc;
+}
+
static int install_security(const struct wgt_desc *desc)
{
char path[PATH_MAX], *head;
@@ -502,6 +533,9 @@ struct wgt_info *install_widget(const char *wgtfile, const char *root, int force
if (install_exec_flag(desc))
goto error4;
+ if (install_file_properties(desc))
+ goto error4;
+
port = get_port();
if (port < 0)
goto error4;