summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2005-06-13 05:34:30 +0000
committerPascal Rigaux <pixel@mandriva.com>2005-06-13 05:34:30 +0000
commit236b47f5fcf5b70a6156b495dfc2e517d4d21abc (patch)
tree5e87a891cf5058d8c52021370c0ef79697a182fe
parent0935fb7e249568209af72cce0094feee6a11036c (diff)
downloaddrakx-236b47f5fcf5b70a6156b495dfc2e517d4d21abc.tar
drakx-236b47f5fcf5b70a6156b495dfc2e517d4d21abc.tar.gz
drakx-236b47f5fcf5b70a6156b495dfc2e517d4d21abc.tar.bz2
drakx-236b47f5fcf5b70a6156b495dfc2e517d4d21abc.tar.xz
drakx-236b47f5fcf5b70a6156b495dfc2e517d4d21abc.zip
fsedit::is_same_hd is now fs:get::is_same_hd
-rw-r--r--perl-install/fs.pm4
-rw-r--r--perl-install/fs/get.pm16
-rw-r--r--perl-install/fsedit.pm14
-rw-r--r--perl-install/install_any.pm2
-rwxr-xr-xperl-install/standalone/drakupdate_fstab2
5 files changed, 19 insertions, 19 deletions
diff --git a/perl-install/fs.pm b/perl-install/fs.pm
index 766a2e702..ce037a7af 100644
--- a/perl-install/fs.pm
+++ b/perl-install/fs.pm
@@ -104,7 +104,7 @@ sub merge_fstabs {
my ($loose, $fstab, @l) = @_;
foreach my $p (@$fstab) {
- my ($l1, $l2) = partition { fsedit::is_same_hd($_, $p) } @l;
+ my ($l1, $l2) = partition { fs::get::is_same_hd($_, $p) } @l;
my ($p2) = @$l1 or next;
@l = @$l2;
@@ -274,7 +274,7 @@ sub merge_info_from_fstab {
my @l = grep {
if ($uniq) {
my $part = fs::get::mntpoint2part($_->{mntpoint}, $fstab);
- !$part || fsedit::is_same_hd($part, $_); #- keep it only if it is the mountpoint AND the same device
+ !$part || fs::get::is_same_hd($part, $_); #- keep it only if it is the mountpoint AND the same device
} else {
1;
}
diff --git a/perl-install/fs/get.pm b/perl-install/fs/get.pm
index dca0a5aa9..5ea9071a8 100644
--- a/perl-install/fs/get.pm
+++ b/perl-install/fs/get.pm
@@ -71,7 +71,7 @@ sub hds_fstab_and_holes {
sub device2part {
my ($dev, $fstab) = @_;
my $subpart = fs::subpart_from_wild_device_name($dev);
- my $part = find { fsedit::is_same_hd($subpart, $_) } @$fstab;
+ my $part = find { is_same_hd($subpart, $_) } @$fstab;
log::l("fs::get::device2part: unknown device <<$dev>>") if !$part;
$part;
}
@@ -126,4 +126,18 @@ sub up_mount_point {
}
}
+sub is_same_hd {
+ my ($hd1, $hd2) = @_;
+ if ($hd1->{major} && $hd2->{major}) {
+ $hd1->{major} == $hd2->{major} && $hd1->{minor} == $hd2->{minor};
+ } elsif (my ($s1) = $hd1->{device} =~ m|https?://(.+?)/*$|) {
+ my ($s2) = $hd2->{device} =~ m|https?://(.+?)/*$|;
+ $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} && $hd2->{device} && $hd1->{device} eq $hd2->{device};
+ }
+}
+
1;
diff --git a/perl-install/fsedit.pm b/perl-install/fsedit.pm
index 6b10c9503..555b339d0 100644
--- a/perl-install/fsedit.pm
+++ b/perl-install/fsedit.pm
@@ -244,20 +244,6 @@ Do you agree to lose all the partitions?
$all_hds;
}
-sub is_same_hd {
- my ($hd1, $hd2) = @_;
- if ($hd1->{major} && $hd2->{major}) {
- $hd1->{major} == $hd2->{major} && $hd1->{minor} == $hd2->{minor};
- } elsif (my ($s1) = $hd1->{device} =~ m|https?://(.+?)/*$|) {
- my ($s2) = $hd2->{device} =~ m|https?://(.+?)/*$|;
- $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} && $hd2->{device} && $hd1->{device} eq $hd2->{device};
- }
-}
-
#- are_same_partitions() do not look at the device name since things may have changed
sub are_same_partitions {
my ($part1, $part2) = @_;
diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm
index 7c7ec4605..11412abd2 100644
--- a/perl-install/install_any.pm
+++ b/perl-install/install_any.pm
@@ -1569,7 +1569,7 @@ sub use_root_part {
my @from_fstab = fs::read_fstab($handle->{dir}, '/etc/fstab', 'keep_default');
my $root_from_fstab = fs::get::root_(\@from_fstab);
- if (!fsedit::is_same_hd($root_from_fstab, $part)) {
+ if (!fs::get::is_same_hd($root_from_fstab, $part)) {
$migrate_device_names = 1;
log::l("from_fstab contained: $_->{device} $_->{mntpoint}") foreach @from_fstab;
migrate_device_names($all_hds, \@from_fstab, $part, $root_from_fstab, $o_in);
diff --git a/perl-install/standalone/drakupdate_fstab b/perl-install/standalone/drakupdate_fstab
index e0bf20861..b36b7d162 100755
--- a/perl-install/standalone/drakupdate_fstab
+++ b/perl-install/standalone/drakupdate_fstab
@@ -148,7 +148,7 @@ sub main {
}
my $fstab = [ fs::read_fstab('', '/etc/fstab', 'keep_freq_passno', 'keep_devfs_name', 'verbatim_credentials') ];
- my ($existing_fstab_entries, $fstab_) = partition { fsedit::is_same_hd($_, $part) } @$fstab;
+ my ($existing_fstab_entries, $fstab_) = partition { fs::get::is_same_hd($_, $part) } @$fstab;
if ($debug) {
require Data::Dumper;