~ubuntu-core-dev/livecd-rootfs/trunk

« back to all changes in this revision

Viewing changes to live-build/ubuntu-cpc/README.cpc.md

  • Committer: Balint Reczey
  • Date: 2019-01-31 08:14:49 UTC
  • Revision ID: balint.reczey@canonical.com-20190131081449-ptfnz0r4c2emh0nt
Moved to git at https://git.launchpad.net/livecd-rootfs

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# TL;DR
2
 
 
3
 
In order to generate the hooks for a specific image target set, call the
4
 
`make-hooks` script, located in `hooks.d` as
5
 
 
6
 
    ./make-hooks --hooks-dir ../hooks <image_set>
7
 
 
8
 
where `image_set` is the name of a series file (e.g. "vagrant") without leading
9
 
path components. Do *not* check in the `hooks` folder, it is automatically
10
 
generated by `auto/config` during Live Build runs.
11
 
 
12
 
 
13
 
# Hook placement and ordering
14
 
 
15
 
Scripts live in subfolders below the `hooks.d` folder. Currently the folders
16
 
`chroot` and `base` exist. The folder with the name `extra` is reserved for
17
 
private scripts, which are not included in the source of livecd-rootfs. The
18
 
scripts are not numbered, instead the order of their execution depends on the
19
 
order in which they are listed in a *series* file.
20
 
 
21
 
Series files are placed in subfolders `hooks.d/base/series` or
22
 
`hooks.d/extra/series`. Each series file contains a list of scripts to be
23
 
executed. Empty lines and lines starting with a `#` are ignored.
24
 
 
25
 
Series files in `extra/series` override files in `base/series` with the same
26
 
name. For example, if a series file `base/series/cloudA` exists and a series
27
 
file `extra/series/cloudA`, then the latter will be preferred.
28
 
 
29
 
A series file in `extra/series` may also list scripts that are located in the
30
 
`chroot` and `base` folders. In addition, series files can *depend* on other
31
 
series files. For example, the series files for most custom images look similar
32
 
to this:
33
 
 
34
 
    depends disk-image
35
 
    depends extra-settings
36
 
    extra/cloudB.binary
37
 
 
38
 
Where `disk-image` and `extra-settings` may list scripts and dependencies which
39
 
are to be processed before the script `extra/cloudB.binary` is called.
40
 
 
41
 
ACHTUNG: live build runs scripts with the suffix ".chroot" in a batch separate
42
 
from scripts ending in ".binary". Even if you arrange them interleaved in your
43
 
series files, the chroot scripts will be run before the binary scripts.
44
 
 
45
 
# Image set selection for Live Build
46
 
 
47
 
During a Live Build, enumerated symbolic links are generated based on the
48
 
contents of one or more series files. The series files are selected according
49
 
to the contents of the `IMAGE_TARGETS` environment variable. For example, in
50
 
order to trigger the build of `squashfs` and `vagrant`, list them in the
51
 
`IMAGE_TARGETS` variable as `squashfs,vagrant`. The separator can be a comma,
52
 
a semi-colon or whitespace.
53
 
 
54
 
The generation of the symbolic links is triggered from the `auto/config` script,
55
 
from where the contents of the `IMAGE_TARGETS` environment variable are passed
56
 
on to the `make-hooks` script.
57
 
 
58
 
 
59
 
# Symlink generation
60
 
 
61
 
Since Live Build itself does not know about series files, a traditional `hooks`
62
 
folder is generated using the `make-hooks` script. The script takes as arguments
63
 
the names of the series files to be processed.
64
 
 
65
 
The script parses the series files and generates enumerated symbolic links for
66
 
all entries. Per default, these are placed into a directory named `hooks` next
67
 
to the `hooks.d` directory. This can be changed using the `--hooks-dir`
68
 
parameter.