Resource Specification

The json file resource is used to specify a package's required resources, and it should be placed in the conf folder. After package installation, this file will be located at /var/packages/${package}/conf/resource. The content of the file should be something like:

{
  "<resource-id>": <specification>,
  ...
}
  • <resource-id>
    String, represents the resource's ID.
  • <specification>
    Json object, describes the resource requirements.

Take the below /usr/local linker worker for example:

{
  "usr-local-linker": {
    "lib": ["lib/foo"],
    "bin": ["bin/foo"],
    "etc": ["etc/foo"],
  }
}

"usr-local-linker" is the resource ID and the correponding Json object is the specification, which specifies what files should be installed into the DSM.

Data from Wizard

As mentioned in WIZARD_UIFILES, installation scripts can optain user's input from the UI wizard, some workers are also capable of doing this. In the resource file, variables surrounded by {{}} will be replaced by the user input.

Take the below Data Share worker for example:

"data-share": {
  "name": "{{pkgwizard_share_name}}",
  "permission": {
    "ro": ["admin"]
  }
}

{{pkgwizard_share_name}} will be replaced by WIZARD_UIFILES/install_uifile's or WIZARD_UIFILES/upgrade_uifiles's pkgwizard_share_name