summaryrefslogtreecommitdiffstats
path: root/perl-install/install_any.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2000-10-04 13:05:07 +0000
committerPascal Rigaux <pixel@mandriva.com>2000-10-04 13:05:07 +0000
commitb355c7624b8c48db238faefe40b59ca8ad886fba (patch)
tree2c1f1038dc33002cc7fea5f4bf826249731a4781 /perl-install/install_any.pm
parent88f4628c4f91a35a0d36dbf55e7bdb47e097dfe9 (diff)
downloaddrakx-b355c7624b8c48db238faefe40b59ca8ad886fba.tar
drakx-b355c7624b8c48db238faefe40b59ca8ad886fba.tar.gz
drakx-b355c7624b8c48db238faefe40b59ca8ad886fba.tar.bz2
drakx-b355c7624b8c48db238faefe40b59ca8ad886fba.tar.xz
drakx-b355c7624b8c48db238faefe40b59ca8ad886fba.zip
no_comment
Diffstat (limited to 'perl-install/install_any.pm')
-rw-r--r--perl-install/install_any.pm43
1 files changed, 25 insertions, 18 deletions
diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm
index fdd52c6a1..4cb1fc98b 100644
--- a/perl-install/install_any.pm
+++ b/perl-install/install_any.pm
@@ -616,11 +616,8 @@ sub generate_ks_cfg {
$ks;
}
-sub suggest_mount_points {
- my ($hds, $prefix, $uniq) = @_;
- my @parts = grep { isTrueFS($_) } fsedit::get_fstab(@$hds);
-
- my (%mntpoints, $user);
+sub guess_mount_point {
+ my ($part, $prefix, $user) = @_;
my %l = (
'/' => 'etc/fstab',
@@ -630,32 +627,42 @@ sub suggest_mount_points {
'/var' => 'catman',
);
- foreach my $part (@parts) {
+ my $handle = any::inspect($part, $prefix) or return;
+ my $d = $handle->{dir};
+ my ($mnt) = grep { -e "$d/$l{$_}" } keys %l;
+ $mnt ||= (stat("$d/.bashrc"))[4] ? '/root' : '/home/user' . ++$$user if -e "$d/.bashrc";
+ $mnt ||= (grep { -d $_ && (stat($_))[4] >= 500 && -e "$_/.bashrc" } glob_("$d")) ? '/home' : '';
+ ($mnt, $handle);
+}
+
+sub suggest_mount_points {
+ my ($hds, $prefix, $uniq) = @_;
+ my @fstab = fsedit::get_fstab(@$hds);
+
+ my $user;
+ foreach my $part (grep { isTrueFS($_) } @fstab) {
$part->{mntpoint} && !$part->{unsafeMntpoint} and next; #- if already found via an fstab
- my $handle = any::inspect($part, $prefix) or return;
- my $d = $handle->{dir};
- my ($mnt) = grep { -e "$d/$l{$_}" } keys %l;
- $mnt ||= (stat("$d/.bashrc"))[4] ? '/root' : '/home/user' . ++$user if -e "$d/.bashrc";
- $mnt ||= (grep { -d $_ && (stat($_))[4] >= 500 && -e "$_/.bashrc" } glob_("$d")) ? '/home' : '';
+ my ($mnt, $handle) = guess_mount_point($part, $prefix, \$user) or next;
- next if $uniq && fsedit::mntpoint2part($mnt, \@parts);
+ next if $uniq && fsedit::mntpoint2part($mnt, \@fstab);
$part->{mntpoint} = $mnt; delete $part->{unsafeMntpoint};
#- try to find other mount points via fstab
- fs::get_mntpoints_from_fstab([ fsedit::get_fstab(@$hds) ], $d, $uniq) if $mnt eq '/';
+ fs::get_mntpoints_from_fstab([ fsedit::get_fstab(@$hds) ], $handle->{dir}, $uniq) if $mnt eq '/';
}
-#- $_->{mntpoint} || fsedit::suggest_part($_, $hds) foreach @parts;
-
- $_->{mntpoint} and log::l("suggest_mount_points: $_->{device} -> $_->{mntpoint}") foreach fsedit::get_fstab(@$hds);
+ $_->{mntpoint} and log::l("suggest_mount_points: $_->{device} -> $_->{mntpoint}") foreach @fstab;
}
#- mainly for finding the root partitions for upgrade
sub find_root_parts {
my ($hds, $prefix) = @_;
log::l("find_root_parts");
- suggest_mount_points($hds, $prefix);
- grep { delete($_->{mntpoint}) eq '/' } fsedit::get_fstab(@$hds);
+ my $user;
+ grep {
+ my ($mnt) = guess_mount_point($_, $prefix, \$user);
+ $mnt eq '/';
+ } fsedit::get_fstab(@$hds);
}
sub use_root_part {
my ($fstab, $part, $prefix) = @_;