Detect Red Hat Desktop as 'rhel' distro (RHBZ#682979).
[libguestfs.git] / perl / lib / Sys / Guestfs / Lib.pm
index 317c9b7..97d0e8e 100644 (file)
@@ -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} eq $label) {
+                $fses->{$_}->{label} =~ /$label/i) {
                 return ($_, $fses->{$_});
             }
         }
@@ -928,7 +929,9 @@ 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};
 
         warn __x("unknown filesystem {fs}\n", fs => $_);
         return ();