Added the section about update responses authored by Pier Angelo Vendrame's avatar Pier Angelo Vendrame
......@@ -129,6 +129,8 @@ In addition, you must [create a new public key pair](https://gitlab.torproject.o
Testing the `nightly` channel is easiest. The URL can be modified in the [build](https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/blob/main/projects/firefox/build#L105) script. If you are testing `release` or `alpha` then a more complicated patch will be needed.
The URL you are setting will contain the update responses, that are some XML files that the Firefox updater polls with a certain frequency, to check if any update is available.
## Signature Public Certificate
After creating the new testing key pair, add the new certificate into tor-browser by overwriting the appropriate secondary key. For `nightly`, you can achieve this with a patch
......@@ -206,3 +208,65 @@ mkdir signed
$mar_tools/signmar -d $nssdb -n marsigner -v signed/$marfile
```
## Prepare the update responses
As written above, we need to create the XML files to tell Firefox where it can find our mar files.
In production, we use a few tools in `tor-browser-build` to create the update responses, let's use them also for our test!
They are located in `tools/update-responses`.
### Create/update the `config.yml`
`config.yml` is a non-versioned file that is generated automatically at a certain point during the usual builds, so you might have already one, and you can adapt it to your test needs.
If you do not have one already, you can copy `tools/signing/nightly/update-responses-base-config.yml` to it and start from there.
You should update at least the `mars_url` property and replace occurrences of `nightly_version` with the actual version you have built. You might need to update `platformVersion`, too.
For example (only the changes, not the full file):
```yaml
download:
mars_url: https://tb-build-05.torproject.org/~pierov/torbrowser/nightly
channels:
nightly: tbb-nightly.2023.03.06
versions:
tbb-nightly.2023.03.06:
platformVersion: 102.8.0
incremental_from:
- tbb-nightly.2022.03.05
```
`~/public_html/torbrowser` in this case is a link to the `torbrowser` directory in the clone of `tor-browser-build` when I ran the build.
If you have used a build server, but are creating the update responses locally, you can use the `releases_dir` property to tell the scripts where they can find your builds.
It must contain at least the `.mar` archives and the `mar-tools`.
Finally, if you want to generate incrementals, you need to create a `versions/$yourVersion/incremental_from` array, with the version(s) you want to generate incrementals from.
### Generate the incrementals (optional)
Normally, we would generate the incrementals with some `make` command.
However, we do not have a recipe for that in the `Makefile`, so you will need to run this command:
```sh
NO_CODESIGNATURE=1 ./gen_incrementals nightly
```
`NO_CODESIGNATURE=1` is needed only on macOS (unless you signed your nightly build for some reason).
The resulting incremental mars are not signed (maybe we could add a `config.yml` entry to specify the nssdb path and the nickname of the key to use), so you will need to sign them with the instructions you can find above.
### Generate the update responses
Finally, creating the update responses is very easy, just run this command:
```sh
./update_responses
```
When it is done, copy the content of the `htdocs` directory to the URL you provided to the build (e.g., `~/public_html/update_3`).
At this point, Firefox should find the update automatically, download it, and apply it.
\ No newline at end of file