1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
:B~ Personalizando conteúdo
1~customizing-contents Customizing contents
This chapter discusses fine-tuning customization of the live system contents
beyond merely choosing which packages to include. Includes allow you to add
or replace arbitrary files in your live system image, hooks allow you to
execute arbitrary commands at different stages of the build and at boot
time, and preseeding allows you to configure packages when they are
installed by supplying answers to debconf questions.
2~includes Includes
While ideally a live system would include files entirely provided by
unmodified packages, it is sometimes convenient to provide or modify some
content by means of files. Using includes, it is possible to add (or
replace) arbitrary files in your live system image. live-build provides two
mechanisms for using them:
_* Chroot local includes: These allow you to add or replace files to the
chroot/Live filesystem. Please see {Live/chroot local
includes}#live-chroot-local-includes for more information.
_* Binary local includes: These allow you to add or replace files in the
binary image. Please see {Binary local includes}#binary-local-includes for
more information.
Please see {Terms}#terms for more information about the distinction between
the "Live" and "binary" images.
3~live-chroot-local-includes Live/chroot local includes
Chroot local includes can be used to add or replace files in the chroot/Live
filesystem so that they may be used in the Live system. A typical use is to
populate the skeleton user directory (#{/etc/skel}#) used by the Live system
to create the live user's home directory. Another is to supply configuration
files that can be simply added or replaced in the image without processing;
see {Live/chroot local hooks}#live-chroot-local-hooks if processing is
needed.
To include files, simply add them to your #{config/includes.chroot}#
directory. This directory corresponds to the root directory #{/}# of the
live system. For example, to add a file #{/var/www/index.html}# in the live
system, use:
code{
$ mkdir -p config/includes.chroot/var/www
$ cp /path/to/my/index.html config/includes.chroot/var/www
}code
Your configuration will then have the following layout:
code{
-- config
[...]
|-- includes.chroot
| `-- var
| `-- www
| `-- index.html
[...]
}code
Chroot local includes are installed after package installation so that files
installed by packages are overwritten.
3~binary-local-includes Binary local includes
To include material such as documentation or videos on the medium filesystem
so that it is accessible immediately upon insertion of the medium without
booting the Live system, you can use binary local includes. This works in a
similar fashion to chroot local includes. For example, suppose the files
#{~/video_demo.*}# are demo videos of the live system described by and
linked to by an HTML index page. Simply copy the material to
#{config/includes.binary/}# as follows:
code{
$ cp ~/video_demo.* config/includes.binary/
}code
These files will now appear in the root directory of the live medium.
2~hooks Hooks
Hooks allow commands to be performed in the chroot and binary stages of the
build in order to customize the image.
3~live-chroot-local-hooks Live/chroot local hooks
To run commands in the chroot stage, create a hook script with a
#{.hook.chroot}# suffix containing the commands in the #{config/hooks/}#
directory. The hook will run in the chroot after the rest of your chroot
configuration has been applied, so remember to ensure your configuration
includes all packages and files your hook needs in order to run. See the
example chroot hook scripts for various common chroot customization tasks
provided in #{/usr/share/doc/live-build/examples/hooks}# which you can copy
or symlink to use them in your own configuration.
3~boot-time-hooks Boot-time hooks
To execute commands at boot time, you can supply live-config hooks as
explained in the "Customization" section of its man page. Examine
live-config's own hooks provided in #{/lib/live/config/}#, noting the
sequence numbers. Then provide your own hook prefixed with an appropriate
sequence number, either as a chroot local include in
#{config/includes.chroot/lib/live/config/}#, or as a custom package as
discussed in {Installing modified or third-party
packages}#installing-modified-or-third-party-packages.
3~ Binary local hooks
To run commands in the binary stage, create a hook script with a
#{.hook.binary}# suffix containing the commands in the #{config/hooks/}#
directory. The hook will run after all other binary commands are run, but
before binary_checksums, the very last binary command. The commands in your
hook do not run in the chroot, so take care to not modify any files outside
of the build tree, or you may damage your build system! See the example
binary hook scripts for various common binary customization tasks provided
in #{/usr/share/doc/live-build/examples/hooks}# which you can copy or
symlink to use them in your own configuration.
2~ Preseeding Debconf questions
Files in the #{config/preseed/}# directory suffixed with #{.cfg}# followed
by the stage (#{.chroot}# or #{.binary}#) are considered to be debconf
preseed files and are installed by live-build using
#{debconf-set-selections}# during the corresponding stage.
For more information about debconf, please see #{debconf(7)}# in the
/{debconf}/ package.
|