Pacchettizzare un tema per Bootsplash
Da Guide@Debianizzati.Org.
Tutte le versioni supportate di Debian |
Indice |
Introduzione
Il pacchetto bootsplash per Debian, presente nei repository:
deb http://debian.bootsplash.de unstable main deb-src http://debian.bootsplash.de unstable main
è molto comodo per la gestione dei temi, ma ha un difetto: utilizza debconf per la gestione dei temi. Questo porta ad un effetto collaterale: i temi installati manualmente non saranno riconosciuti e per poterli usare si dovranno eseguire operazioni scomode (rispetto ad un semplice dpkg-reconfigure bootsplash :-) ).
Vedremo, ora, come creare un pacchetto Debian contenente un tema, e come gestire il template di debconf per aggiornare la lista dei temi.
| Nota Bene: gli script qui descritti non sono opera mia, ma di Oliver Sorge, che mantiene i temi presenti nel repository sopra riportato |
Requisiti
Per poter creare un pacchetto Debian dobbiamo installare i seguenti pacchetti:
- build-essential
- dpkg-dev
- dh-make
- debhelper
Creazione del pacchetto
Estraiamo il pacchetto contenente il tema, e rinominiamo la directory contenente il tema in un formato del tipo bootsplash-theme-<nometema>-<versione>.
La directory deve contenere le directory images, ...
Una volta completato, lanciamo il comando:
$ dh_make --copyright GPL
ovviamente dopo aver verificato la licenza del tema.
Alla domanda:
Type of package: single binary, multiple binary, library, or kernel module? [s/m/l/k]rispondiamo con una s.
Controlliamo i dati riportati (per il nome e l'email possiamo usare le variabili d'ambiente $DEBEMAIL e $DEBFULLNAME); se tutto è corretto è possibile andare avanti.
Verrà così creata la directory debian/, contenente tutto il necessario per il nostro pacchetto.
La directory debian/*
Rimozione dei file non necessari
La directory debian/ contiene molti file non necessari, che possiamo tranquillamente rimuovere:
$ cd debian $ rm conffiles.ex cron.d.ex emacsen* init.d.ex manpage* matrix* menu.ex watch*
.templates
Dobbiamo creare il template utilizzato da debconf. Creiamo, quindi, un file del tipo bootsplash-theme-<nometema>.template con il seguente contenuto:
Template: shared/bootsplash-theme
Type: select
Choices: ${choices}
Description: Please select theme bootsplash should use.
Please select the theme bootsplash should use. If you wish to
change it at a later date, just run dpkg-reconfigure bootsplash.
Template: bootsplash-theme-<nometema>/resolutions
Type: multiselect
Choices: 1024x768
Default: 1024x768
Description: Select the resoultion you would like to enable bootsplash for.
You need to select which resolutions bootsplash should be enabled for, also
remember to include the proper (vga=???) line in your lilo.conf.
Ricordandoci di sostituire a <nometema> il nome del nostro tema ed eventualmente sistemare i valori delle risoluzioni.
rules
Il file debian/rules necessita di molte modifiche. Conviene, quindi, sostituire il contenuto con questo:
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.
# Uncomment this to turn on verbose mode.
# export DH_VERBOSE=1
# Edit these lines!!!
THEME_DIRS = images config animations bootloader
THEME_SUFFIX = <nometema>
configure: configure-stamp
configure-stamp:
dh_testdir
touch configure-stamp
build: build-stamp
build-stamp: configure-stamp
dh_testdir
touch build-stamp
clean:
dh_testdir
dh_testroot
rm -f build-stamp configure-stamp
dh_clean
install: build
dh_testdir
dh_testroot
dh_clean -k
dh_installdirs
-cp -a $(THEME_DIRS) \
"$(CURDIR)/debian/bootsplash-theme-$(THEME_SUFFIX)/etc/bootsplash/themes/$(THEME_SUFFIX)/"
binary-indep: build install
# We have nothing to do by default.
# Build architecture-dependent files here.
binary-arch: build install
dh_testdir
dh_testroot
dh_installchangelogs
dh_installdocs
dh_installdebconf
dh_link
dh_strip
dh_compress
dh_fixperms
dh_installdeb
dh_shlibdeps
dh_gencontrol
dh_md5sums
dh_builddeb
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure
ricordando le seguenti cose:
- fare attenzione ad usare la tabulazioni (tasto
<tab>) al posto degli spazi per le indentazioni (obbligatorie)! - modificare la variabile
THEME_DIRSriportando solo le directory presenti all'interno della directory<nometema>-<versione>ad eccezione didebian. - modificare la variabile
THEME_SUFFIXcon il nome del tema.
control
Il file debian/control necessita di alcune modifiche:
-
Sectiondovrebbe essere modificata ingraphics -
Architecturepuò essere modificato inall, visto che il pacchetto non sarà dipendente dall'architettura -
Dependspuò essere modificato inbootsplash (>= 3.0.0), debconf (>= 0.5) | debconf-2.0 - deve essere aggiunta la riga
Provides: bootsplash-theme - la descrizione deve essere modificata nel seguente modo (in linea coi pacchetti di http://www.bootsplash.de ):
Description: The bootsplash theme <nometema> This is another bootsplash theme packaged for the Debian GNU/Linux Operating System. . Resolutions: 1280x1024
dirs
Dovrà contenere:
etc/bootsplash/themes/<nometema>
docs
Dovrà contenere:
docs/*
se la directory è presente nei sorgenti del tema (altrimenti si può omettere questo file).
postinst
Usiamo direttamente quelli creati per i pacchetti dei temi presenti su http://www.bootsplash.org:
#! /bin/sh
# postinst script for test
#
# see: dh_installdeb(1)
set -e
. /usr/share/debconf/confmodule
THEME_SUFFIX=<nometema>
# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
# <new-version>
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
# <failed-install-package> <version> `removing'
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
#
case "$1" in
configure)
db_register shared/bootsplash-theme bootsplash-theme-$THEME_SUFFIX
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
gettext -s "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0
postrm
#! /bin/sh
# postrm script for bootsplash-theme-newtux
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <postrm> `remove'
# * <postrm> `purge'
# * <old-postrm> `upgrade' <new-version>
# * <new-postrm> `failed-upgrade' <old-version>
# * <new-postrm> `abort-install'
# * <new-postrm> `abort-install' <old-version>
# * <new-postrm> `abort-upgrade' <old-version>
# * <disappearer's-postrm> `disappear' <r>overwrit>r> <new-version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
# Theme variables
THEME_SUFFIX=<nometema>
case "$1" in
remove)
# This only applies to the remove process.
# By default the directory of the theme under
# /etc/bootsplash/themes will not be removed.
# However, this postrm script will do this if
# a directory exists.
if [ -d /etc/bootsplash/themes/$THEME_SUFFIX ]
then
gettext -s "Deleting orphaned files under /etc/bootsplash/themes/$THEME_SUFFIX ... "
rm -rf /etc/bootsplash/themes/$THEME_SUFFIX || gettext -s "ERROR: Couldn't delete directory /etc/bootsplash/themes/$THEME_SUFFIX."
fi
;;
purge|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
;;
*)
gettext -s "postrm called with unknown argument \`$1'" >&2
exit 1
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
# Automatically added by dh_installdebconf
if [ "$1" = purge ] && [ -e /usr/share/debconf/confmodule ]; then
. /usr/share/debconf/confmodule
db_purge
fi
# End automatically added section
exit 0
prerm
#! /bin/sh
# prerm script for bootsplash-theme-debblue
#
# see: dh_installdeb(1)
set -e
. /usr/share/debconf/confmodule
# summary of how this script can be called:
# * <prerm> `remove'
# * <old-prerm> `upgrade' <new-version>
# * <new-prerm> `failed-upgrade' <old-version>
# * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
# * <deconfigured's-prerm> `deconfigure' `in-favour'
# <package-being-installed> <version> `removing'
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
remove|upgrade|deconfigure)
# I no longer claim this question.
db_unregister shared/bootsplash-theme
# See if the shared question still exists.
if db_get shared/bootsplash-theme; then
db_metaget shared/bootsplash-theme owners
db_subst shared/bootsplash-theme choices $RET
db_metaget shared/bootsplash-theme value
if [ "<package>" = "$RET" ] ; then
db_fset shared/bootsplash-theme seen false
db_input high shared/bootsplash-theme || true
db_go || true
fi
fi
;;
failed-upgrade)
;;
*)
gettext -s "prerm called with unknown argument \`$1'" >&2
exit 1
;;
esac
exit 0
Compilazione
La compilazione di un pacchetto è semplicissima: nella directory contenente i sorgenti diamo il seguente comando:
$ dpkg-buildpackage
se tutto va a buon fine, verrà creato un pacchetto Debian nella directory superiore.
Test del pacchetto
L'unico modo per testare il pacchetto è installarlo (dpkg -i pacchetto.deb) e riconfigurare il pacchetto bootsplash (dpkg-reconfigure bootsplash): se tutto è stato fatto correttamente, nella lista apparirà il nuovo tema.
Conclusioni
La guida qui riportata è frutto dell'analisi dei pacchetti bootsplash-theme-* presenti nel repository di http://www.bootsplash.de ;)
| Guida scritta da: MaXeR |
|
| Verificata da: | |
| Estesa da: | |
|
Verificare ed estendere la guida | Cos'è una guida Debianized | |
Debianized 20%