X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;ds=sidebyside;f=perl%2Flib%2FSys%2FGuestfs%2FLib.pm;h=4f094dea18372c9ac87daf630bb9eaf190e3b4d1;hb=74c3b79e0e518b313eb7a34a743982046170b142;hp=52655003c00267cc58e442ce246b1f94ca4fdc79;hpb=5cab0d6c807d8a3bf9690375c663d11a10e21656;p=libguestfs.git diff --git a/perl/lib/Sys/Guestfs/Lib.pm b/perl/lib/Sys/Guestfs/Lib.pm index 5265500..4f094de 100644 --- a/perl/lib/Sys/Guestfs/Lib.pm +++ b/perl/lib/Sys/Guestfs/Lib.pm @@ -524,12 +524,12 @@ sub _check_linux_root $r->{package_management} = "yum"; } - elsif (/(Red Hat Enterprise Linux|CentOS|Scientific Linux)/) { + elsif (/(Red Hat|CentOS|Scientific Linux)/) { chomp; $r->{product_name} = $_; my $distro = $1; - if($distro eq "Red Hat Enterprise Linux") { + if($distro eq "Red Hat") { $r->{osdistro} = "rhel"; } @@ -867,7 +867,7 @@ sub _assign_mount_points foreach (@fstab) { my ($spec, $file) = @$_; - my ($dev, $fs) = _find_filesystem ($g, $fses, $spec); + my ($dev, $fs) = _find_filesystem ($g, $fses, $spec, $file); if ($dev) { $r->{mounts}->{$file} = $dev; $r->{filesystems}->{$dev} = $fs; @@ -888,12 +888,13 @@ sub _find_filesystem my $g = shift; my $fses = shift; local $_ = shift; + my $file = shift; if (/^LABEL=(.*)/) { my $label = $1; foreach (sort keys %$fses) { if (exists $fses->{$_}->{label} && - $fses->{$_}->{label} =~ /$label/i) { + $fses->{$_}->{label} eq $label) { return ($_, $fses->{$_}); } } @@ -921,6 +922,9 @@ sub _find_filesystem if (m{^/dev/hd(.*)} && exists $fses->{"/dev/sd$1"}) { return ("/dev/sd$1", $fses->{"/dev/sd$1"}); } + if (m{^/dev/vd(.*)} && exists $fses->{"/dev/sd$1"}) { + return ("/dev/sd$1", $fses->{"/dev/sd$1"}); + } if (m{^/dev/xvd(.*)} && exists $fses->{"/dev/sd$1"}) { return ("/dev/sd$1", $fses->{"/dev/sd$1"}); } @@ -928,6 +932,7 @@ sub _find_filesystem return ("/dev/$1/$2", $fses->{"/dev/$1/$2"}); } + return () if $file =~ (/media\/cdrom/); return () if m{/dev/cdrom}; return () if m{/dev/fd0}; @@ -1103,7 +1108,7 @@ sub _find_grub_prefix die(__"Can't find grub on guest") unless($g->exists('/boot/grub/menu.lst')); # Look for the most specific mount point in mounts - foreach my $path qw(/boot/grub /boot /) { + foreach my $path (qw(/boot/grub /boot /)) { if(exists($mounts->{$path})) { return "" if($path eq '/'); return $path;