6
6
creation, through successive revisions and successive releases of both the
7
7
live-build software and the live image itself.
9
2~ Use auto to manage configuration changes
11
Live configurations rarely are perfect on the first try. You'll likely need
12
to make a series of revisions until you are satisfied. However,
13
inconsistencies can creep into your configuration from one revision to the
14
next if you aren't careful. The main problem is, once a variable is given a
15
default value, that value will not be recomputed from other variables that
16
may change in later revisions.
18
For example, when the distribution is first set, many 'dependent' variables
19
are given default values that suit that distribution. However, if you later
20
decide to change the distribution, those dependent variables continue to
21
retain old values that are no longer appropriate.
23
A second, related problem is that if you run #{lb config}# and then upgrade
24
to a new version of live-build that has changed one of the variable names,
25
you will discover this only by manual review of the variables in your
26
#{config/*}# files, which you will then need to use to set the appropriate
29
All of this would be a terrible nuisance if it weren't for auto/* scripts,
30
simple wrappers to the #{lb config}#, #{lb build}# and #{lb clean}# commands
31
that are designed to help you manage your configuration. Simply create an
32
auto/config script containing #{lb config}# command with all desired
33
options, and an auto/clean that removes the files containing configuration
34
variable values, and each time you run #{lb config}# and #{lb clean}#, these
35
files will be executed. This will ensure that your configuration is kept
36
internally consistent from one revision to the next and from one live-build
37
release to the next (Although you will still have to take care and read the
38
documentation when you upgrade live-build and make adjustments as needed).
40
2~ Example auto scripts
42
Use auto script examples such as the following as the starting point for
43
your new live-build configuration. Take note that when you call the #{lb}#
44
command that the auto script wraps, you must specify #{noauto}# as its
45
parameter to ensure that the auto script isn't called again,
46
recursively. Also, don't forget to ensure the scripts are executable
47
(e.g. #{chmod 755 auto/*}#).
9
2~ Dealing with configuration changes
11
Live configurations rarely are perfect on the first try. It may be fine to
12
pass #{lb config}# options from the command-line to perform a single build,
13
but it is more typical to revise those options and build again until you are
14
satisfied. To support these changes, you will need auto scripts which ensure
15
your configuration is kept in a consistent state.
17
3~ Why use auto scripts? What do they do?
19
The #{lb config}# command stores the options you pass to it in #{config/*}#
20
files along with many other options set to default values. If you run #{lb
21
config}# again, it will not reset any option that was defaulted based on
22
your initial options. So, for example, if you run #{lb config}# again with a
23
new value for #{--distribution}#, any dependent options that were defaulted
24
for the old distribution may no longer work with the new. Nor are these
25
files intended to be read or edited. They store values for over a hundred
26
options, so nobody, let alone yourself, will be able to see in these which
27
options you actually specified. And finally, if you run #{lb config}#, then
28
upgrade live-build and it happens to rename an option, #{config/*}# would
29
still contain variables named after the old option that are no longer valid.
31
For all these reasons, #{auto/*}# scripts will make your life easier. They
32
are simple wrappers to the #{lb config}#, #{lb build}# and #{lb clean}#
33
commands that are designed to help you manage your configuration. The
34
#{auto/config}# script stores your #{lb config}# command with all desired
35
options, the #{auto/clean}# script removes the files containing
36
configuration variable values, and the #{auto/build}# script keeps a
37
#{build.log}# of each build. Each of these scripts is run automatically
38
every time you run the corresponding #{lb}# command. By using these scripts,
39
your configuration is easier to read and is kept internally consistent from
40
one revision to the next. Also, it will be much easier for you identify and
41
fix options which need to change when you upgrade live-build after reading
42
the updated documentation.
44
3~ Use example auto scripts
46
For your convenience, live-build comes with example auto shell scripts to
47
copy and edit. Start a new, default configuration, then copy the examples
52
$ mkdir mylive && cd mylive && lb config
53
$ cp /usr/share/doc/live-build/examples/auto/* auto/
57
Edit #{auto/config}#, adding any options as you see fit. For instance:
55
--package-lists "standard" \
63
--architectures i386 \
64
--linux-flavours 686-pae \
66
--mirror-bootstrap http://ftp.es.debian.org/debian/ \
67
--mirror-binary http://ftp.es.debian.org/debian/ \
65
lb clean noauto "${@}"
66
rm -f config/binary config/bootstrap \
67
config/chroot config/common config/source
77
lb build noauto "${@}" 2>&1 | tee build.log
81
We now ship example auto scripts with live-build based on the examples
82
above. You may copy those as your starting point.
86
$ cp /usr/share/doc/live-build/examples/auto/* auto/
90
Edit #{auto/config}#, changing or adding any options as you see fit. In the
91
example above, #{--package-lists standard}# is set to the default
92
value. Change this to an appropriate value for your image (or delete it if
93
you want to use the default) and add any additional options in continuation
72
Now, each time you use #{lb config}#, #{auto/config}# will reset the
73
configuration based on these options. When you want to make changes to them,
74
edit the options in this file instead of passing them to #{lb config}#. When
75
you use #{lb clean}#, #{auto/clean}# will clean up the #{config/*}# files
76
along with any other build products. And finally, when you use #{lb build}#,
77
a log of the build will be written by #{auto/build}# in #{build.log}#.
79
Note: A special #{noauto}# parameter is used here to suppress another call
80
to #{auto/config}#, thereby preventing infinite recursion. Make sure you
81
don't accidentally remove it when making edits. Also, take care to ensure
82
when you split the #{lb config}# command across multiple lines for
83
readability, as shown in the example above, that you don't forget the
84
backslash (\) at the end of each line that continues to the next.
86
2~ Clone a configuration published via Git
88
Use the #{lb config --config}# option to clone a Git repository that
89
contains a Debian Live configuration. If you would like to base your
90
configuration on one maintained by the Debian Live project, look at
91
http://live.debian.net/gitweb for the repositories prefixed with
94
For example, to build a rescue image, use the #{config-rescue}# repository
99
$ mkdir live-rescue && cd live-rescue
100
$ lb config --config git://live.debian.net/git/config-rescue.git
104
Edit #{auto/config}# and any other things you need in the #{config}# tree to
107
You may optionally define a shortcut in your Git configuration by adding the
108
following to your #{${HOME}/.gitconfig}#:
112
[url "git://live.debian.net/git/"]
117
This enables you to use #{ldn:}# anywhere you need to specify the address of
118
a #{live.debian.net}# git repository. If you also drop the optional #{.git}#
119
suffix, starting a new image using this configuration is as easy as:
123
$ lb config --config ldn:config-rescue