Support reiserfs labels
authorJamie Cameron <jcameron@webmin.com>
Fri, 8 Jun 2007 05:26:15 +0000 (05:26 +0000)
committerJamie Cameron <jcameron@webmin.com>
Fri, 8 Jun 2007 05:26:15 +0000 (05:26 +0000)
fdisk/fdisk-lib.pl
mount/linux-lib.pl

index 83f2bae..33e4316 100644 (file)
@@ -18,6 +18,7 @@ if (&foreign_check("lvm")) {
 $has_e2label = &has_command("e2label");
 $has_xfs_db = &has_command("xfs_db");
 $has_volid = &has_command("vol_id");
+$has_reiserfstune = &has_command("reiserfstune");
 $| = 1;
 
 # list_disks_partitions([include-cds])
@@ -1187,6 +1188,13 @@ if (($? || $label !~ /\S/) && $has_xfs_db) {
        $label = $1 if ($out =~ /label\s*=\s*"(.*)"/ &&
                        $1 ne '(null)');
        }
+if (($? || $label !~ /\S/) && $has_reiserfstune) {
+       $label = undef;
+       local $out = &backquote_command("reiserfstune $_[0]");
+       if ($out =~ /LABEL:\s*(\S+)/) {
+               $label = $1;
+               }
+       }
 return $? || $label !~ /\S/ ? undef : $label;
 }
 
index c8a3824..799dbdb 100644 (file)
@@ -47,6 +47,9 @@ if (&has_command("xfs_db")) {
 if (&has_command("vol_id")) {
        $has_volid = 1;
        }
+if (&has_command("reiserfstune")) {
+       $has_reiserfstune = 1;
+       }
 
 # Return information about a filesystem, in the form:
 #  directory, device, type, options, fsck_order, mount_at_boot
@@ -451,7 +454,8 @@ while(<MTAB>) {
                $p[0] = "proc";
                }
        if (!$_[0] && ($p[2] =~ /^ext[23]$/ && $has_e2label ||
-                      $p[2] eq "xfs" && $has_xfs_db)) {
+                      $p[2] eq "xfs" && $has_xfs_db ||
+                      $p[2] eq "reiserfs" && $has_reiserfstune)) {
                # Check for a label on this partition, and there is one
                # and this filesystem is in fstab with the label, change
                # the device.
@@ -461,6 +465,12 @@ while(<MTAB>) {
                        $label = $1 if ($out =~ /label\s*=\s*"(.*)"/ &&
                                        $1 ne '(null)');
                        }
+               elsif ($p[2] eq "reiserfs") {
+                       local $out = &backquote_command("reiserfstune $p[0]");
+                       if ($out =~ /LABEL:\s*(\S+)/) {
+                               $label = $1;
+                               }
+                       }
                else {
                        $label = &backquote_command("e2label $p[0] 2>&1", 1);
                        chop($label);
@@ -1052,7 +1062,7 @@ else {
                }
 
        # Show label input
-       if ($has_e2label || $has_xfs_db) {
+       if ($has_e2label || $has_xfs_db || $has_reiserfstune) {
                local $l = $_[1] =~ /LABEL=(.*)/ ? $1 : undef;
                local $esel = &fdisk::label_select("lnx_label", $l, \$lfound);
                if ($esel) {