Perl help needed for kernel-package mod ... (Was: Bringing the 2.6.13 (and beyond) kernel to sid, solving ramdisk generations issues and stuff.)
On Sat, Oct 15, 2005 at 12:19:04PM +0200, Sven Luther wrote:
> Now that we have a solution for the ramdisk generation tool mess, we can go
> ahead, and outline a plan for bringing 2.6.13 to sid, and then go ahead and do
> the same with 2.6.14 shortly after that, while 2.6.12 is safely in etch.
Oh well, i had a quick look at the needed code in the postinsts, but i have to
admit that i will not be able to do this, perl being like chinese to me :/
The code is :
my $ramdisk = '/usr/sbin/mkinitrd'; # Tool to create initial ram fs.
$ramdisk = "$1" if /ramdisk\s*=\s*(\S+)/ig;
my $ret = system("$ramdisk " .
($mkimage ? "-m '$mkimage' " : "") .
"-o $initrd_path.new $modules_base/$version");
Well, i understand this, but i don't know how to do what is needed, namely :
1) depending on $version, default to /usr/sbin/mkinitrd (for pre-2.6.13
kernels) or mkinitramfs or yaird. Maybe initramfs for now.
2) parse the ramdisk option and put the space-separated entries in some kind
3) for each element in the list, check if :
3.1) it is an executable binary that exists.
3.2) calling it with --supported-host-version=`uname -r`
--supported-target-version=$version and check the return value is 0.
and eliminate all entries which don't verify the above.
4) Take the first in the list and use it to build the ramdisk.
5) if the list is empty, fail and inform the user.
I would be extremely grateful if someone could take the time and implement
this ASAP, as we need this to upload 2.6.13-2 and finish the support.