|
|
![]() |
![]() |
![]() |
|
|
|
![]() |
![]() |
![]() |
Questo capitolo tratta la personalizzazione dei contenuti del sistema live che va oltre la semplice scelta dei pacchetti da includere. Gli include permettono di aggiungere o sostituire file nell'immagine di Debian Live, gli hook permettono di eseguire comandi in fasi differenti della creazione e all'avvio, e la preconfigurazione permette di configurare i pacchetti quando vengono installati fornendo risposte alle domande di debconf.
Anche se idealmente un sistema live Debian dovrebbe includere file forniti interamente dal pacchetti Debian non modificati, a volte è conveniente fornire o modificare parte del contenuto per mezzo di file. Utilizzando gli include, si può aggiungere (o sostituire) file arbitrari nell'immagine di Debian Live. Per usarli, live-build mette a disposizione tre meccanismi:
Si consulti il Glossario per ulteriori informazioni sulla distinzione tra immagini "Live" e "binarie".
Gli include locali del chroot possono essere usati per aggiungere o sostituire file nel filesystem chroot/Live in modo che possano essere utilizzati nel sistema live. Un utilizzo tipico è popolare la directory scheletro dell'utente (/etc/skel) che il sistema impiega per creare la home dell'utente. Un altro è quello di fornire file di configurazione che possono essere semplicemente aggiunti o sostituiti nell'immagine senza elaborazione; si veda Live/chroot hook locali se è necessaria l'elaborazione.
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:
$ mkdir -p config/includes.chroot/var/www
$ cp /path/to/my/index.html config/includes.chroot/var/www
La configurazione avrà quindi il seguente schema:
-- config
[...]
|-- includes.chroot
| `-- var
| `-- www
| `-- index.html
[...]
`-- templates
Gli include locali del chroot vengono installati dopo l'installazione dei pacchetti in modo che tali file vengano in seguito sovrascitti.
To include material such as documentation or videos on the media filesystem so that it is accessible immediately upon insertion of the media 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:
$ cp ~/video_demo.* config/includes.binary/
Questi file appariranno nella directory principale del supporto live.
live-build ha alcuni file standard (come la documentazione) inclusi nella configurazione predefinita di ogni supporto live. Ciò può essere disabilitato con:
$ lb config --includes none
In caso contrario il materiale verrà installato da live-build nella directory /includes/ del filesystem in modo predefinito, oppure è possibile specificare un percorso alternativo con --includes.
Gli hook permettono di eseguire comandi nel chroot e nelle fasi binarie della creazione al fine di personalizzare l'immagine.
To run commands in the chroot stage, create a hook script with a .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/live/build/examples/hooks which you can copy or symlink to use them in your own configuration.
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.
To run commands in the binary stage, create a hook script with a .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/live/build/examples/hooks which you can copy or symlink to use them in your own configuration.
Files in the config/preseed/ directory suffixed with .preseed 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.
Per ulteriori informazioni su debconf, vedere debconf(7) nel pacchetto debconf.