[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Kernel-package, fix version 2 ...



On Sat, Oct 22, 2005 at 08:10:09PM +0200, Mattia Dongili wrote:
> On Sat, Oct 22, 2005 at 04:55:39PM +0200, Erik van Konijnenburg wrote:
> > On Sat, Oct 22, 2005 at 04:16:00PM +0200, Sven Luther wrote:
> [...]
> > > Also the postinsts are in perl, and my perl is not all that good, so i dislike
> > > complex modifications of this kind.
> > 
> > Strong argument: you're the one doing the actual coding here,
> > so it's important you feel happy with the approach.
> 
> I'd like to offer my help here if anything is needed, I'll dig into the
> code in the next days to get a better idea of the big picture (last time
> I only literaly implemented what Sven asked) ;)).

Mattia, could you look over this code : 

  chomp (my $hostversion = `uname -r`);
  my @ramdisklist =
    grep {
      my $ret = system ("$_ --supported-host-version=$hostversion --supported-target-version=$version 1>/dev/null 2>&1");
      -x and (
        $ret == 0 or (
          $ret == 1 and (
            (($ramdisk eq "/usr/sbin/mkinitrd") and
             (system ("dpkg", "--compare-versions", "$version", "lt", "2.6.13") == 0)) or
            (($ramdisk eq "/usr/sbin/mkinitramfs") and
             (system ("dpkg", "--compare-versions", "$version", "lt", "2.6.12") == 1)) or
            (($ramdisk eq "/usr/sbin/mkinitrd.yaird") and
             (system ("dpkg", "--compare-versions", "$version", "lt", "2.6.8") == 1) and
             (system ("dpkg", "--compare-versions", "$hostversion", "lt", "2.6.8") == 1))
          )
        )
      )
    }
    (split (/ /, $ramdisk));

  my $ramdiskorig = $ramdisk;
  defined ($ramdisk = shift @ramdisklist)
    or die ("Failed to find suitable ramdisk generation tool for kernel version $version on running kernel $hostversion in $ramdiskorig\n");

  print STDERR "Using $ramdisk to build the ramdisk.";;
  if (@ramdisklist) { print STDERR "Other suitable ramdisk generating tools : @ramdisklist.\n"; }
  print STDERR "Full list of probed ramdisk generating tools : $ramdiskorig.\n";

and tell me if there is any glaring error in it.

The code does the following :

1) tests if the tool exists.
2) tests if the tool returns 0 for the given host and target version.
3) if the tool returns 1, this means --supported-* is not supported, do an explicit check.
  Checks are :
 
  3.1) mkinitrd is ok if target < 2.6.13.
  3.2) mkinitramfs is ok if target >= 2.6.12.
  3.3) mkinitrd.yaird is ok if target >= 2.6.8 and host >= 2.6.8.

Friendly,

Sven Luther



Reply to: