summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perl-install/c/stuff.xs.pl17
-rw-r--r--perl-install/diskdrake/interactive.pm5
-rw-r--r--perl-install/fs.pm20
-rw-r--r--perl-install/fsedit.pm10
-rwxr-xr-xperl-install/standalone/drakupdate_fstab2
5 files changed, 44 insertions, 10 deletions
diff --git a/perl-install/c/stuff.xs.pl b/perl-install/c/stuff.xs.pl
index 26e6ce413..4573cdc3f 100644
--- a/perl-install/c/stuff.xs.pl
+++ b/perl-install/c/stuff.xs.pl
@@ -219,6 +219,23 @@ is_ext3(device_name)
OUTPUT:
RETVAL
+char *
+get_ext2_label(device_name)
+ char * device_name
+ CODE:
+ {
+ ext2_filsys fs;
+ int retval = ext2fs_open (device_name, 0, 0, 0, unix_io_manager, &fs);
+ if (retval) {
+ RETVAL = 0;
+ } else {
+ RETVAL = fs->super->s_volume_name;
+ ext2fs_close(fs);
+ }
+ }
+ OUTPUT:
+ RETVAL
+
void
setlocale()
CODE:
diff --git a/perl-install/diskdrake/interactive.pm b/perl-install/diskdrake/interactive.pm
index cb5d3bb9c..19b59fa99 100644
--- a/perl-install/diskdrake/interactive.pm
+++ b/perl-install/diskdrake/interactive.pm
@@ -29,6 +29,8 @@ struct part {
string device # 'hda5', 'sdc1' ...
string devfs_device # 'ide/host0/bus0/target0/lun0/part5', ...
string prefer_devfs_name # should the {devfs_device} or the {device} be used in fstab
+ string device_LABEL # volume label. LABEL=xxx can be used in fstab instead of
+ string prefer_device_LABEL # should the {device_LABEL} or the {device} be used in fstab
string rootDevice # 'sda', 'hdc' ... (can also be a VG_name)
string real_mntpoint # directly on real /, '/tmp/hdimage' ...
string mntpoint # '/', '/usr' ...
@@ -36,6 +38,7 @@ struct part {
string device_windobe # 'C', 'D' ...
string encrypt_key # [0-9A-Za-z./]{20,}
string comment # comment to have in fstab
+ string volume_label #
bool isMounted
@@ -1150,6 +1153,8 @@ sub format_part_info {
$info .= N("Mount point: ") . "$part->{mntpoint}\n" if $part->{mntpoint};
$info .= N("Device: ") . "$part->{device}\n" if $part->{device} && !isLoopback($part);
+ $info .= N("Devfs name: ") . "$part->{devfs_device}\n" if $part->{devfs_device} && $::expert;
+ $info .= N("Volume label: ") . "$part->{device_LABEL}\n" if $part->{device_LABEL} && $::expert;
$info .= N("DOS drive letter: %s (just a guess)\n", $part->{device_windobe}) if $part->{device_windobe};
if (arch() eq "ppc") {
my $new_value = $part->{pType};
diff --git a/perl-install/fs.pm b/perl-install/fs.pm
index 65c630f6c..ce31f1afc 100644
--- a/perl-install/fs.pm
+++ b/perl-install/fs.pm
@@ -20,6 +20,10 @@ use loopback;
sub read_fstab {
my ($prefix, $file, @reading_options) = @_;
+ if (member('keep_default', @reading_options)) {
+ push @reading_options, 'freq_passno', 'keep_devfs_name', 'keep_device_LABEL';
+ }
+
my %comments;
my $comment;
my @l = grep {
@@ -71,11 +75,9 @@ sub read_fstab {
if_(member('keep_freq_passno', @reading_options), freq => $freq, passno => $passno),
};
- if ($dev =~ /^LABEL=/) {
- if (my $e = find { $_->{mntpoint} eq $mntpoint } read_fstab('', '/proc/mounts')) {
- $h->{device_LABEL} = $dev;
- $dev = $h->{device} = $e->{device};
- }
+ if ($dev =~ /^LABEL=(.*)/) {
+ $h->{device_LABEL} = $1;
+ $h->{prefer_device_LABEL} = 1 if member('keep_device_LABEL', @reading_options);
}
if ($dev =~ m,^/(tmp|dev)/,) {
($h->{major}, $h->{minor}) = unmakedev((stat "$prefix$dev")[6]);
@@ -197,7 +199,7 @@ sub merge_info_from_fstab {
} else {
1;
}
- } read_fstab($prefix, '/etc/fstab', 'keep_freq_passno', 'keep_devfs_name');
+ } read_fstab($prefix, '/etc/fstab', 'keep_default');
merge_fstabs($loose, $fstab, @l);
}
@@ -205,7 +207,7 @@ sub merge_info_from_fstab {
# - when using "$loose", it does not merge in type&options from the fstab
sub get_info_from_fstab {
my ($all_hds, $prefix) = @_;
- my @l = read_fstab($prefix, '/etc/fstab', 'keep_freq_passno', 'keep_devfs_name');
+ my @l = read_fstab($prefix, '/etc/fstab', 'keep_default');
add2all_hds($all_hds, @l)
}
@@ -250,7 +252,7 @@ sub prepare_write_fstab {
my $type = type2fs($_, 'auto');
my $dev =
- $_->{device_LABEL} ? $_->{device_LABEL} :
+ $_->{prefer_device_LABEL} ? 'LABEL=' . $_->{device_LABEL} :
$_->{device_alias} ? "/dev/$_->{device_alias}" : $device;
$mntpoint =~ s/ /\\040/g;
@@ -558,7 +560,7 @@ sub get_raw_hds {
get_major_minor(@{$all_hds->{raw_hds}});
- my @fstab = read_fstab($prefix, '/etc/fstab', 'keep_freq_passno', 'keep_devfs_name');
+ my @fstab = read_fstab($prefix, '/etc/fstab', 'keep_default');
$all_hds->{nfss} = [ grep { isThisFs('nfs', $_) } @fstab ];
$all_hds->{smbs} = [ grep { isThisFs('smbfs', $_) } @fstab ];
$all_hds->{davs} = [ grep { isThisFs('davfs', $_) } @fstab ];
diff --git a/perl-install/fsedit.pm b/perl-install/fsedit.pm
index 9f6874ce9..69b9bf826 100644
--- a/perl-install/fsedit.pm
+++ b/perl-install/fsedit.pm
@@ -229,6 +229,15 @@ sub hds {
my $type = typeOfPart($_->{device});
$_->{type} = $type if ($type & 0xff) == $wanted_type || $type && $hd->isa('partition_table::gpt');
}
+
+ foreach (partition_table::get_normal_parts($hd)) {
+ my $label =
+ member(type2fs($_), qw(ext2 ext3)) ?
+ c::get_ext2_label(devices::make($_->{device})) :
+ '';
+ $_->{device_LABEL} = $label if $label;
+ }
+
push @hds, $hd;
}
@@ -321,6 +330,7 @@ sub is_same_hd {
$s1 eq $s2;
} else {
$hd1->{devfs_device} && $hd2->{devfs_device} && $hd1->{devfs_device} eq $hd2->{devfs_device}
+ || $hd1->{device_LABEL} && $hd2->{device_LABEL} && $hd1->{device_LABEL} eq $hd2->{device_LABEL}
|| $hd1->{device} eq $hd2->{device};
}
}
diff --git a/perl-install/standalone/drakupdate_fstab b/perl-install/standalone/drakupdate_fstab
index ab7878adc..12f3d959c 100755
--- a/perl-install/standalone/drakupdate_fstab
+++ b/perl-install/standalone/drakupdate_fstab
@@ -130,7 +130,7 @@ sub main {
cp_af('/etc/fstab', $fstab_file = '/tmp/fstab');
}
- my $fstab = [ fs::read_fstab('', '/etc/fstab', 'keep_freq_passno', 'keep_devfs_name', 'verbatim_credentials') ];
+ my $fstab = [ fs::read_fstab('', '/etc/fstab', 'keep_default', 'verbatim_credentials') ];
my ($existing_fstab_entries, $fstab_) = partition { $_->{device} eq $part->{device} || $_->{device} eq $part->{devfs_device} } @$fstab;
if ($action eq 'add') {