← Back to team overview

curtin-dev team mailing list archive

[Merge] ~tiago.pasqualini/curtin:fix_doc into curtin:master

 

Tiago Pasqualini da Silva has proposed merging ~tiago.pasqualini/curtin:fix_doc into curtin:master.

Commit message:
Add documentation section about APT templates

Curtin supports the usage of templates for APT configuration, but
currently there is no mention of it in the documentation. This
patch adds a section explaining how to use it.

Requested reviews:
  curtin developers (curtin-dev)
  Server Team CI bot (server-team-bot): continuous-integration

For more details, see:
https://code.launchpad.net/~tiago.pasqualini/curtin/+git/curtin/+merge/473674
-- 
Your team curtin developers is requested to review the proposed merge of ~tiago.pasqualini/curtin:fix_doc into curtin:master.
diff --git a/doc/topics/apt_source.rst b/doc/topics/apt_source.rst
index 2a4616e..27ca1d8 100644
--- a/doc/topics/apt_source.rst
+++ b/doc/topics/apt_source.rst
@@ -205,6 +205,55 @@ This is a collection of additional ideas people can use the feature for customiz
          Suites: $RELEASE $RELEASE-updates $RELEASE-security $RELEASE-proposed
          Components: main restricted universe multiverse
 
+Using templates
+~~~~~~~~~~~~~~~
+
+Curtin supports the usage of custom templates for rendering ``sources.list`` or ``ubuntu.sources``.
+If a template is not provided, curtin will try to modify the ``sources.list`` (or ``ubuntu.sources`` in the case of deb822) in the target at
+``/etc/apt/sources.list`` (or ``/etc/apt/sources.list.d/ubuntu.sources`` in the case of deb822). Within these templates you can use the following
+replacement variables: ``$RELEASE, $MIRROR, $PRIMARY, $SECURITY``.
+
+The following example uses a template to change the GPG key for a particular mirror (in this case what is defined as ``$PRIMARY``):
+
+::
+
+ apt:
+   primary:
+     - arches: [amd64, i386, default]
+       uri: http://mymirror.local/ubuntu
+   sources_list: |
+     Types: deb
+     URIs: $PRIMARY
+     Suites: $RELEASE $RELEASE-updates $RELEASE-security $RELEASE-proposed
+     Components: main
+     key: | # full key as block
+       -----BEGIN PGP PUBLIC KEY BLOCK-----
+       Version: GnuPG v1
+       mQGiBEFEnz8RBAC7LstGsKD7McXZgd58oN68KquARLBl6rjA2vdhwl77KkPPOr3O
+       RwIbDAAKCRBAl26vQ30FtdxYAJsFjU+xbex7gevyGQ2/mhqidES4MwCggqQyo+w1
+       Twx6DKLF+3rF5nf1F3Q=
+       =PBAe
+       -----END PGP PUBLIC KEY BLOCK-----
+
+The template above will result in the following ``ubuntu.sources`` file:
+
+::
+
+ Types: deb
+ URIs: http://mymirror.local/ubuntu
+ Suites: noble noble-updates noble-security noble-backports
+ Components: main
+ Signed-By: | # full key as block
+   -----BEGIN PGP PUBLIC KEY BLOCK-----
+   Version: GnuPG v1
+   mQGiBEFEnz8RBAC7LstGsKD7McXZgd58oN68KquARLBl6rjA2vdhwl77KkPPOr3O
+   RwIbDAAKCRBAl26vQ30FtdxYAJsFjU+xbex7gevyGQ2/mhqidES4MwCggqQyo+w1
+   Twx6DKLF+3rF5nf1F3Q=
+   =PBAe
+   -----END PGP PUBLIC KEY BLOCK-----
+
+The file ``apt-source.yaml`` holds more examples on how to use templates.
+
 Timing
 ~~~~~~
 The feature is implemented at the stage of curthooks_commands, which runs just after curtin has extracted the image to the target.

Follow ups