How do I generate update.rdf for the firefox addon-sdk?

firefox-addon-sdk

Solution

Use the `cfx` tool with the `--update-link` and `--update-url` flags. This will generate `<addon name>.update.rdf`, ready to be uploaded to your server.

See https://developer.mozilla.org/en-US/Add-ons/SDK/Tools/cfx#updateURL_and_updateLink:

updateURL and updateLink

If you choose to host the XPI yourself you should enable the host application to find new versions of your add-on.

To do this, include a URL in the XPI called the updateURL: the host application will go here to get information about updates. At the updateURL you host a file in the update RDF format: among other things, this includes another URL called updateLink which points to the updated XPI itself.

The `--update-link` and `--update-url` options simplify this process. Both options take a URL as an argument.

The `--update-link` option builds an update RDF alongside the XPI, and embeds the supplied URL in the update RDF as the value of updateLink.

The `--update-url` option embeds the supplied URL in the XPI file, as the value of updateURL.

Note that as the add-on documentation explains, you should make sure the update procedure for your add-on is secure, and this usually involves using HTTPS for the links.

So if we run the following command:

 cfx xpi --update-link https://example.com/addon/latest/pluginName.xpi --update-url https://example.com/addon/update_rdf/pluginName.update.rdf

`cfx` will create two files:

- an XPI file which embeds `https://example.com/addon/update_rdf/pluginName.update.rdf` as the value of updateURL

- an RDF file which embeds `https://example.com/addon/latest/pluginName.xpi` as the value of updateLink.

Problem

To provide auto updates for my plugin on my server, I need to create a `update.rdf` file. How do I generate such a file? The documentation is quite overwhelming: https://developer.mozilla.org/en-US/docs/Extension_Versioning,_Update_and_Compatibility#Update_RDF_Format

Original source