From c12e1ed0e54193a0b287a14544e65bd6d81702a3 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Sat, 1 May 2004 12:17:45 +0000 Subject: fix drakupdate_fstab adding twice an entry in fstab, one with the old name, one with the devfs name --- perl-install/diskdrake/interactive.pm | 2 ++ perl-install/fs.pm | 7 ++++++- perl-install/fsedit.pm | 3 ++- perl-install/standalone/drakupdate_fstab | 6 +++++- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/perl-install/diskdrake/interactive.pm b/perl-install/diskdrake/interactive.pm index a037c4fe4..cb5d3bb9c 100644 --- a/perl-install/diskdrake/interactive.pm +++ b/perl-install/diskdrake/interactive.pm @@ -27,6 +27,8 @@ struct part { int size # in sectors int type # 0x82, 0x83, 0x6 ... 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 rootDevice # 'sda', 'hdc' ... (can also be a VG_name) string real_mntpoint # directly on real /, '/tmp/hdimage' ... string mntpoint # '/', '/usr' ... diff --git a/perl-install/fs.pm b/perl-install/fs.pm index 3adce3cea..ab0822ddb 100644 --- a/perl-install/fs.pm +++ b/perl-install/fs.pm @@ -89,6 +89,11 @@ sub read_fstab { } else { $h->{device} = $dev; } + + if ($h->{device} =~ m!/(disc|part\d+)$!) { + $h->{devfs_device} = $h->{device}; + $h->{prefer_devfs_name} = 1; + } } if ($h->{options} =~ /credentials=/ && !member('verbatim_credentials', @reading_options)) { @@ -214,7 +219,7 @@ sub prepare_write_fstab { my $device = isLoopback($_) ? ($_->{mntpoint} eq '/' ? "/initrd/loopfs" : $_->{loopback_device}{mntpoint}) . $_->{loopback_file} : - part2device($o_prefix, $_->{device}, $_->{type}); + part2device($o_prefix, $_->{prefer_devfs_name} ? $_->{devfs_device} : $_->{device}, $_->{type}); my $real_mntpoint = $_->{mntpoint} || ${{ '/tmp/hdimage' => '/mnt/hd' }}{$_->{real_mntpoint}}; mkdir_p("$o_prefix$real_mntpoint") if $real_mntpoint =~ m|^/|; diff --git a/perl-install/fsedit.pm b/perl-install/fsedit.pm index 87c50de6d..9f6874ce9 100644 --- a/perl-install/fsedit.pm +++ b/perl-install/fsedit.pm @@ -320,7 +320,8 @@ sub is_same_hd { my ($s2) = $hd2->{device} =~ m|https?://(.+?)/*$|; $s1 eq $s2; } else { - $hd1->{device} eq $hd2->{device}; + $hd1->{devfs_device} && $hd2->{devfs_device} && $hd1->{devfs_device} eq $hd2->{devfs_device} + || $hd1->{device} eq $hd2->{device}; } } diff --git a/perl-install/standalone/drakupdate_fstab b/perl-install/standalone/drakupdate_fstab index 17ace8761..4a12f4461 100755 --- a/perl-install/standalone/drakupdate_fstab +++ b/perl-install/standalone/drakupdate_fstab @@ -78,7 +78,11 @@ sub device_name_to_entry { $e->{device} = ($e->{prefix} || $e->{device}) . $nb; } $e ||= {}; - $e->{device} = $name; #- keeping the exact name given (often is the devfs name) + if ($e->{devfs_device} eq $name) { + $e->{prefer_devfs_name} = 1; + } else { + $e->{device} = $name; #- keeping the exact name given (often is the devfs name) + } $e; } -- cgit v1.2.1