6
6
dalla creazione iniziale, attraverso le successive revisioni e rilasci sia
7
7
del software live-build che della stessa immagine.
9
2~ Utilizzare auto per gestire i cambiamenti di configurazione
11
Le configurazioni live raramente sono perfette da riuscire al primo colpo,
12
servono una serie di revisioni prima di essere soddisfatti. Tuttavia, se non
13
si presta attenzione, possono verificarsi delle incoerenze tra una revisione
14
e l'altra se non si presta attenzione. Il problema principale è che una
15
volta assegnato un valore predefinito ad una variabile, tale valore non sarà
16
ricalcolato da altre variabili che possono cambiare in altre revisioni.
18
Per esempio, durante la prima configurazione della distribuzione, a molte
19
variabili 'dipendenti' vengono dati valori predefiniti che si adattino.Per
20
cui se in seguito si decide di cambiare distribuzione, quelle variabili
21
continueranno a mantenere vecchi valori non più appropriati.
23
Un secondo problema correlato è l'eseguire #{lb config}# e aggiornare alla
24
nuova versione di live-build il quale ha cambiato il nome di una delle
25
variabili, lo si può scoprire solamente con una revisione manuale delle
26
variabili nei file #{config/*}#, che sarà necessario utilizzare per
27
impostare nuovamente le opzioni appropriate.
29
Tutto ciò potrebbe essere un fastidio terribile se non fosse per gli script
30
auto/*, semplici wrapper ai comandi #{lb config}#, #{lb build}# e #{lb
31
clean}#, designati per aiutare nella gestione della propria
32
configurazione. Basta creare uno script auto/config che contenga il comando
33
#{lb config}# con le opzioni desiderate e un auto/clean che rimuove i file
34
contenenti valori delle variabili di configurazione, così ogni volta che si
35
usano #{lb config}# e #{lb clean}# questi file saranno eseguiti. Ciò fà sì
36
che la configurazione sia coerente da una revisione all'altra e tra i
37
rilasci delle varie versioni di live-build (sebbene si dovrà comunque fare
38
attenzione aggiornando live-build, leggendo la documentazione e facendo le
39
modifiche necessarie).
41
2~ Esempi di script automatici
43
Usare esempi di script automatici come il seguente come punto di partenza
44
per una nuova configurazione di live-build. Si noti che quando si invoca il
45
comando #{lb}# incluso nello script, si deve specificare il parametro
46
#{noauto}# per essere certi che lo script stesso non venga richiamato
47
ricorsivamente. Non dimenticare, inoltre, di accertarsi che gli script siano
48
eseguibili (es. #{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:
56
--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/ \
66
lb clean noauto "${@}"
67
rm -f config/binary config/bootstrap \
68
config/chroot config/common config/source
78
lb build noauto "${@}" 2>&1 | tee build.log
82
Facciamo un esempio di script automatico per live-build basato sugli esempi
83
precedenti; si possono copiare come punto di partenza.
87
$ cp /usr/share/doc/live-build/examples/auto/* auto/
91
Modificare #{auto/config}# aggiungendo o togliendo le opzioni come meglio
92
credi. Nel precedente esempio, #{--package-lists standard}# è impostato al
93
valore predefinito; cambiarlo in un valore appropriato per l'immagine (o
94
cancellarlo se si desidera utilizzare un valore predefinito) e aggiungere
95
eventuali opzioni ulteriori in continuazione delle righe che seguono.
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