Tags:
create new tag
view all tags

Managing LCFG package lists with Soy

Creating a chroot

The best way to use lcfg-soy is to create a chroot using the debootstrap tool (you may need to install the debootstrap package first).

For example to create a basic install root for Ubuntu Focal Fossa with all components included you should run he following command (note that you have to run this as the root user).

debootstrap --components main,universe,multiverse --arch amd64 focal /srv/focal_chroot http://archive.ubuntu.com/ubuntu

If doing this on a multi-user machine where others might also be using lcfg-soy you probably want to have your own chroot directory, maybe put your username into the path.

Managing packages

In LCFG packages can be included explicitly in a machine source profile or via options which are specified using the profile.pkgcppopts resource. The package options are themselves specified in package lists (e.g. lcfg_ubu2004_options.pkgs). This makes it possible for multiple LCFG headers to require that a set of packages is installed on a machine whilst only actually specifying the list of package names and versions once in a standard location.

In LCFG we aim to have complete control over the versions of packages and their dependencies. This gives administrators full control over when to apply updates or pin a package on a particular version. To help with the management of these lists of packages the lcfg-soy tool can take a simple list of requirements as a YAML file and convert them into a list of packages and versions which can be used as an LCFG packages file.

Example 1: Simple Usage

With soy you just need to specify the name of the required package(s) for each option, for example if we have a /tmp/input.yaml file which looks like:

---
name: debootstrap
packages:
 - debootstrap
...
---
name: gnupg
packages:
 - gnupg
...

  • The option name must be something which is acceptable as a cpp macro (hyphens are not permitted). It will be upper-cased in the output.
  • Each option begins with --- (3 equal signs) on a line and ends with ... (3 periods) on a line.
  • Each package name in the list should be on a line with ' - ' as a prefix, the whitespace indentation must be consistent.

This will create two package options

lcfg-soy -c /srv/squinney_focal_chroot -r deb /tmp/input.yaml 
#ifdef GNUPG
gnupg=2.2.19-3ubuntu2

/* dependencies */
dirmngr=2.2.19-3ubuntu2
gnupg-l10n=2.2.19-3ubuntu2/all
gnupg-utils=2.2.19-3ubuntu2
gpg=2.2.19-3ubuntu2
gpg-agent=2.2.19-3ubuntu2
gpg-wks-client=2.2.19-3ubuntu2
gpg-wks-server=2.2.19-3ubuntu2
gpgconf=2.2.19-3ubuntu2
gpgsm=2.2.19-3ubuntu2
libasn1-8-heimdal=7.7.0+dfsg-1ubuntu1
libassuan0=2.5.3-7ubuntu2
libgssapi3-heimdal=7.7.0+dfsg-1ubuntu1
libhcrypto4-heimdal=7.7.0+dfsg-1ubuntu1
libheimbase1-heimdal=7.7.0+dfsg-1ubuntu1
libheimntlm0-heimdal=7.7.0+dfsg-1ubuntu1
libhx509-5-heimdal=7.7.0+dfsg-1ubuntu1
libkrb5-26-heimdal=7.7.0+dfsg-1ubuntu1
libksba8=1.3.5-2
libldap-2.4-2=2.4.49+dfsg-2ubuntu1
libldap-common=2.4.49+dfsg-2ubuntu1/all
libnpth0=1.6-1
libroken18-heimdal=7.7.0+dfsg-1ubuntu1
libsasl2-2=2.1.27+dfsg-2
libsasl2-modules-db=2.1.27+dfsg-2
libwind0-heimdal=7.7.0+dfsg-1ubuntu1
pinentry-curses=1.1.0-3build1
#endif /* GNUPG */


#ifdef DEBOOTSTRAP
debootstrap=1.0.118ubuntu1-*

/* dependencies */
libpsl5=0.21.0-1ubuntu1
wget=1.20.3-1ubuntu1
#endif /* DEBOOTSTRAP */

  • The -c option specifies the path to the chroot
  • The -r option specifies that we are working with Debian packages
  • By default the output goes to stdout but alternatively you can write it directly to a file using the -o option. That's generally a better way to run the command, as any errors will be sent to stderr it's hard to spot them when you also have all the output in your terminal.

Example 2: Dependencies

Package options will often have dependencies upon other options. lcfg-soy will resolve those just fine but to keep the output smaller and more manageable it can be better to specify the dependencies in the input YAML file. They can also be used to enhance an option by including extra packages which aren't strict package dependencies. They can also be used to create high-level options which pull in many other options.

With the previous example, the debootstrap package recommends gnupg. If we decide that our debootstrap option would be better with gnupg always installed we can express that as a dependency:

---
name: debootstrap
packages:
 - debootstrap
dependencies:
 - gnupg
...
---
name: gnupg
packages:
 - gnupg
...

This creates the following output:

#ifdef DEBOOTSTRAP
debootstrap=1.0.118ubuntu1-*
#ifndef GNUPG
#define GNUPG
#endif

/* dependencies */
libpsl5=0.21.0-1ubuntu1
wget=1.20.3-1ubuntu1
#endif /* DEBOOTSTRAP */


#ifdef GNUPG
gnupg=2.2.19-3ubuntu2

/* dependencies */
...

Note that the DEBOOTSTRAP option now appears above the GNUPG option and ensures that it is enabled.

-- squinney - 2020-05-29

Topic revision: r1 - 2020-05-29 - squinney
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback