X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=perl%2Flib%2FSys%2FGuestfs%2FLib.pm;h=d5dfb4eaf500ef0805a2dd7ebdc08f6ff0f6e2e2;hb=4e444d5c09d78b0d292d95d1f97de12f26cc139d;hp=27a7b9ee246c67adfbddc7c3c6306c83eff5f24c;hpb=335a8e3b0efa4c9dee01591134aeeb2b17ae22f5;p=libguestfs.git diff --git a/perl/lib/Sys/Guestfs/Lib.pm b/perl/lib/Sys/Guestfs/Lib.pm index 27a7b9e..d5dfb4e 100644 --- a/perl/lib/Sys/Guestfs/Lib.pm +++ b/perl/lib/Sys/Guestfs/Lib.pm @@ -1208,14 +1208,20 @@ sub _check_for_initrd my $version = $1; my @modules; - eval { - @modules = $g->initrd_list ("/boot/$initrd"); - }; - unless ($@) { - @modules = grep { m,([^/]+)\.ko$, || m,([^/]+)\.o$, } @modules; - $initrd_modules{$version} = \@modules - } else { - warn "/boot/$initrd: could not read initrd format" + # Disregard old-style compressed ext2 files, since cpio + # takes ages to (fail to) process these. + if ($g->file ("/boot/$initrd") !~ /gzip compressed/ || + $g->zfile ("gzip", "/boot/$initrd") !~ /ext2 filesystem/) { + eval { + @modules = $g->initrd_list ("/boot/$initrd"); + }; + unless ($@) { + @modules = grep { m,([^/]+)\.ko$, || m,([^/]+)\.o$, } + @modules; + $initrd_modules{$version} = \@modules + } else { + warn "/boot/$initrd: could not read initrd format"; + } } } }