Support reiserfs labels

This commit is contained in:
Jamie Cameron
2007-06-08 05:26:15 +00:00
parent 71f3c9de24
commit c6a042642e
2 changed files with 20 additions and 2 deletions

View 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;
}

View 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) {