Re: Pre-seeding XFree settings for keyboard in Debian Installer
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Ok, I have now finished the infrastructure using version maps, but
before I upload I would like to describe the process, for feedback,
comments etc.
Basically the dir structure is this:
/conffiles.d:
sarge/ woody/ xfree86-kbd.preinst ispell.preinst ispell.postinst
ktouch.postinst kde2.postinst links.postinst
./conffiles.d/sarge:
xfree86-kbd
./conffiles.d/woody:
ispell ktouch xfree86-kbd kde2 links
You might notice that ispell has both preinst and postinst scripts,
this is because skolelinux/woody uses postinstallation configuration,
while ispell in sarge, can be preconfigured using debconf preseeding.
And the process:
update-locale-config is called, if a flag -p is given, then it
executes the .preinst scripts in conffiles.d, otherwise it executes
the .postinst scripts in the same folder. This is to ensure that we
can use configuration in pre- and post- stages of installation.
Each *.{pre,post}inst script has a version map that it uses to decide
which version it should run. I have separated the common routines in
common.pl, and use this to get the appropriate version. Here is a
small part of the conffiles.d/xfree86-kbd.preinst:
- ----------------
require 'common.pl';
getopts("dlp", \%opts);
init();
my %xvermap = ( '4.1.0-1', => { RELEASE => 'woody' },
'4.3.0-1', => { RELEASE => 'sarge' }
);
my $script = "xfree86-kbd";
my $package = "xserver-xfree86";
my $release = get_release($package, %xvermap);
$script = "$release/".$script;
print "Running $script $lang\n";
system ($script, $lang) if -x $script;
- ------------------
Basically, I wanted it small and clean, so that it would be easy to
create new ones. The xvermap array holds the versions and release
names. I just put the minimum versions in which the configuration is
different (4.3.0 introduced some slight differences in XkbOptions).
I then execute the $release/$script file, which is the same script as
it was in locale-config-skolelinux. I prefered this approach as I
really like modularity and dislike huge scripts with lots of if
clauses :-)
If for some reason, an older/newer version has no available method for
{pre,post}-configuration then the script can just be a dummy script
(a link to /bin/true perhaps?).
How does get_release() then works?
If the package exists AND is installed then i compare the currently
installed version to the version map. If it is not installed then I
check -using apt availability list- againsg the latest version.
If the package does not exist or something went wrong with other
methods, I fallback to checking /etc/debian_version (though that
should not happen often).
That's about it, I will have uploaded the package later this day at
http://people.debian.org/~markos/debian/
Feel free to comment.
Konstantinos
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQFA8BuZIU9oQVFfm3QRAghEAJwNB2rPr+5NSpZaOoP4OsH7ktacLwCdFAq9
pYF3meY2qbA0KHIFSeKHycU=
=lRzG
-----END PGP SIGNATURE-----
Reply to: