160
$ echo "iceweasel xchat" >> config/package-lists/my.list.chroot
158
$ echo "task-lxde-desktop iceweasel xchat" >> config/package-lists/my.list.chroot
164
Per prima cosa, #{--architectures i386}# assicura che sul nostro sistema
165
#{amd64}# costruiamo una versione a 32-bit utilizzabile sulla maggior parte
166
delle macchine. In secondo luogo, usiamo #{--linux-flavours 686-pae}# dato
167
che non prevediamo di usare questa immagine su sistemi troppo vecchi. Terzo,
168
abbiamo scelto la lista di pacchetti /{lxde}/ per avere un desktop
169
minimale. Infine, abbiamo aggiunto due pacchetti preferiti per cominciare:
170
/{iceweasel}/ e /{xchat}/.
162
First, #{--architectures i386}# ensures that on our #{amd64}# build system,
163
we build a 32-bit version suitable for use on most machines. Second, we use
164
#{--linux-flavours 686-pae}# because we don't anticipate using this image on
165
much older systems. Third, we have chosen the /{lxde}/ task metapackage to
166
give us a minimal desktop. And finally, we have added two initial favourite
167
packages: /{iceweasel}/ and /{xchat}/.
172
169
Costruire quindi l'immagine:
256
253
*{Caso d'uso:}* creazione di un'immagine con live-build per avviare direttamente un server VNC.
258
Creare una directory con al suo interno una configurazione scheletrica
259
costruita sulla base dell'elenco di standard-x11, tra cui /{gdm3}/,
260
/{metacity}/ e /{xvnc4viewer}/, disabilitando i raccomandati per ottenere un
255
Make a build directory and create an skeletal configuration inside it,
256
disabling recommends to make a minimal system. And then create two initial
257
package lists: the first one generated with a script provided by live-build
258
named #{Packages}# (see {Generated package lists}#generated-package-lists),
259
and the second one including /{xorg}/, /{gdm3}/, /{metacity}/ and
265
264
$ mkdir vnc_kiosk_client
266
265
$ cd vnc_kiosk_client
267
$ lb config -a i386 -k 686-pae -p standard-x11 \
268
--apt-recommends false
269
$ echo "gdm3 metacity xvnc4viewer" >> config/package-lists/my.list.chroot
273
Creare la directory #{/etc/skel}# e inserirvi un #{.xsession}#
274
personalizzato per l'utente predefinito che lancerà /{metacity}/ e avvierà
275
/{xvncviewer}/, connesso alla porta #{5901}# su un server all'indirizzo
266
$ lb config -a i386 -k 686-pae --apt-recommends false
267
$ echo '! Packages Priority standard' > config/package-lists/standard.list.chroot
268
$ echo "xorg gdm3 metacity xvnc4viewer" > config/package-lists/my.list.chroot
272
As explained in {Tweaking APT to save space}#tweaking-apt-to-save-space you
273
may need to re-add some recommended packages to make your image work
276
An easy way to list recommends is using /{apt-cache}/. For example:
280
$ apt-cache depends live-config live-boot
284
In this example we found out that we had to re-include several packages
285
recommended by live-config and live-boot: #{user-setup}# to make autologin
286
work and #{sudo}# as an essential program to shutdown the system. Besides,
287
it could be handy to add #{live-tools}# to be able to copy the image to RAM
288
and #{eject}# to eventually eject the live media, So:
292
$ echo "live-tools user-setup sudo eject" >
293
config/package-lists/recommends.list.chroot
297
Create the directory #{/etc/skel}# in #{config/includes.chroot}# and put a
298
custom #{.xsession}# in it for the default user that will launch
299
/{metacity}/ and start /{xvncviewer}/, connecting to port #{5901}# on a
300
server at #{192.168.1.2}#:
302
326
2~ Un'immagine base per una chiavetta USB da 128M
304
*{Caso d'uso:}* creazione di un'immagine standard con alcuni componenti rimossi affinché possa stare su una chiavetta USB da 128M, con lo spazio che rimane da usarsi come meglio si crede.
306
Quando si cerca di ottimizzare un'immagine affinché sia contenuta in un
307
supporto, è necessario capire il compromesso che si deve fare tra la
308
dimensione e la funzionalità. In questo esempio, taglieremo solo quanto
309
basta per far sì che il tutto stia in 128M, senza fare nient'altro che
310
distrugga l'integrità dei pacchetti contenuti, come eliminare localizzazioni
311
con il pacchetto /{localepurge}/ o altre ottimizzazioni "intrusive". È da
312
notare che non va usato #{--bootstrap-flavour minimal}# a meno che non si
313
sappia cosa si sta facendo, come omettere la priorità dei pacchetti
314
*{important}* che molto probabilmente produrrà un sistema live danneggiato.
318
$ lb config -k 486 -p minimal --apt-indices false \
319
--memtest none --apt-recommends false --includes none
328
*{Use case:}* Create a standard image with some components removed in order to fit on a 128M USB key with a little space left over to use as you see fit.
330
When optimizing an image to fit a certain media size, you need to understand
331
the tradeoffs you are making between size and functionality. In this
332
example, we trim only so much as to make room for additional material within
333
a 128M media size, but without doing anything to destroy the integrity of
334
the packages contained within, such as the purging of locale data via the
335
/{localepurge}/ package, or other such "intrusive" optimizations. Of
336
particular note, in order to understand what the #{minimal.chroot}# hook
337
does you should take a look at #{/usr/share/doc/live-build/examples/hooks}#
341
$ lb config -k 486 --apt-indices false --apt-recommends false --memtest none
342
$ cp /usr/share/doc/live-build/examples/hooks/minimal.chroot config/hooks
346
To make the image work properly, we must re-add, at least, two recommended
347
packages which are left out by the #{--apt-recommends false}# option. See
348
{Tweaking APT to save space}#tweaking-apt-to-save-space
352
$ echo "user-setup sudo" > config/package-lists/recommends.list.chroot
331
All'autore del sistema al momento di scrivere, la seguente configurazione ha
332
prodotto una immagine di 78Mbyte. Comparabile favorevolmente con i 166Mbyte
333
prodotta dalla configurazione predefinita nel {Tutorial 1}#tutorial-1.
335
Ciò che salva più spazio, comparato alla costruzione di un'immagine standard
336
su un sistema con architettura #{i386}#, è la selezione del solo kernel
337
#{486}# invece che quello predefinito #{-k "486 686-pae"}#. Lasciando fuori
338
anche gli indici di APT con #{--apt-indices false}# si può salvare una certa
339
quantità di spazio, il compromesso è usare #{apt-get update}# prima di usare
340
apt nel sistema live. Scegliendo la lista #{minima}# dei pacchetti si
341
esclude il grosso pacchetto #{locales}# e le utilità associate. Saltare i
342
pacchetti raccomandati con #{--apt-recommends false}# salva altro spazio, a
343
scapito di alcuni pacchetti che ci si aspetta di trovare, come
344
/{firmware-linux-free}/ che potrebbe servire a supportare un certo
345
hardware. Le restanti opzioni limano altre piccole quantità di spazio. Sta a
346
voi decidere se le funzionalità sacrificate con ciascuna ottimizzazione
364
On the author's system at the time of writing this, the above configuration
365
produced a 95Mbyte image. This compares favourably with the 182Mbyte image
366
produced by the default configuration in {Tutorial 1}#tutorial-1.
368
The biggest space-saver here, compared to building a standard image on an
369
#{i386}# architecture system, is to select only the #{486}# kernel flavour
370
instead of the default #{-k "486 686-pae"}#. Leaving off APT's indices with
371
#{--apt-indices false}# also saves a fair amount of space, the tradeoff
372
being that you need to #{apt-get update}# before using apt in the live
373
system. Dropping recommended packages with #{--apt-recommends false}# saves
374
some additional space, at the expense of omitting some packages you might
375
otherwise expect to be there, such as /{firmware-linux-free}/ which may be
376
needed to support certain hardware. #{--memtest none}# prevents the
377
installation of a memory tester. And finally, the execution of the
378
#{minimal.chroot}# hook removes some unused packages and files.
380
Using other hooks, like for example the #{stripped.chroot}# hook found in
381
#{/usr/share/doc/live-build/examples/hooks}#, may shave off additional small
382
amounts of space and produce an image of 76MB. But it is up to you to decide
383
if the functionality that is sacrificed with each size optimization is worth
384
the loss of functionality.
349
386
2~ Un desktop KDE localizzato e l'installer
390
Durante l'avvio verrà generata la localizzazione pt_BR.UTF-8 e selezionato
391
il layout di tastiera pt-latin1. Ci sarà anche bisogno di preconfigurare la
392
nostra scelta desktop, "kde" cosicché tasksel installerà il task corretto,
393
che differisce dal predefinito (vedere {Task per desktop e
394
lingua}#desktop-and-language-tasks). È ora di mettere insieme i pezzi:
427
At boot time we will generate the pt_BR.UTF-8 locale and select the
428
pt-latin1 keyboard layout. Now let's put the pieces together. Recalling from
429
{Using metapackages}#using-metapackages that task metapackages are prefixed
430
#{task-}#, we just specify these language boot parameters, then add standard
431
priority packages and all our discovered task metapackages to our package
403
441
--bootappend-live "locales=pt_BR.UTF-8 keyboard-layouts=pt-latin1" \
404
442
--debian-installer live
405
$ echo kde-desktop brazilian-portuguese brazilian-portuguese-desktop \
406
brazilian-portuguese-kde-desktop >> config/task-lists/my.list.chroot
407
$ echo debian-installer-launcher >> config/package-lists/my.list.chroot
408
$ echo tasksel tasksel/desktop multiselect kde >> config/preseed/my.preseed.chroot
443
$ echo '! Packages Priority standard' > config/package-lists/standard.list.chroot
444
$ echo task-kde-desktop task-brazilian-portuguese task-brazilian-portuguese-desktop \
445
task-brazilian-portuguese-kde-desktop >> config/package-lists/desktop.list.chroot
446
$ echo debian-installer-launcher >> config/package-lists/installer.list.chroot