summaryrefslogtreecommitdiffstats
path: root/perl-install/install_any.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2000-08-18 04:32:24 +0000
committerPascal Rigaux <pixel@mandriva.com>2000-08-18 04:32:24 +0000
commit94f257d030c1fd411ec48e438db18c657cd97e40 (patch)
treea4537ad6b19dde305ee0422c7b6a8c4ce104dd9b /perl-install/install_any.pm
parent3441ffe13a56f8b565e950b1c8e40c70b2acd97a (diff)
downloaddrakx-94f257d030c1fd411ec48e438db18c657cd97e40.tar
drakx-94f257d030c1fd411ec48e438db18c657cd97e40.tar.gz
drakx-94f257d030c1fd411ec48e438db18c657cd97e40.tar.bz2
drakx-94f257d030c1fd411ec48e438db18c657cd97e40.tar.xz
drakx-94f257d030c1fd411ec48e438db18c657cd97e40.zip
no_comment
Diffstat (limited to 'perl-install/install_any.pm')
-rw-r--r--perl-install/install_any.pm49
1 files changed, 45 insertions, 4 deletions
diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm
index 25fbdbf79..596f5191a 100644
--- a/perl-install/install_any.pm
+++ b/perl-install/install_any.pm
@@ -535,10 +535,9 @@ sub g_auto_install(;$) {
$_ = { %{$_ || {}} }, delete @$_{qw(oldu oldg password password2)} foreach $o->{superuser}, @{$o->{users} || []};
- local *F;
- open F, ">$f" or log::l("can't output the auto_install script in $f"), return;
- print F "# You should always check the syntax with 'perl -cw auto_inst.cfg.pl' before testing\n";
- print F Data::Dumper->Dump([$o], ['$o']), "\0";
+ output($f,
+ "# You should always check the syntax with 'perl -cw auto_inst.cfg.pl' before testing\n",
+ Data::Dumper->Dump([$o], ['$o']), "\0");
}
sub loadO {
@@ -597,4 +596,46 @@ sub generate_ks_cfg {
$ks;
}
+sub suggest_mount_points {
+ my ($hds, $prefix) = @_;
+ my @parts = grep { isTrueFS($_) } fsedit::get_fstab(@$hds);
+
+ my (%mntpoints, $user);
+
+ my %l = (
+ '/' => 'etc/fstab',
+ '/boot' => 'vmlinuz',
+ '/tmp' => '.X11-unix',
+ '/usr' => 'X11R6',
+ '/var' => 'catman',
+ );
+
+ foreach my $part (@parts) {
+ $part->{mntpoint} 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";
+
+ $part->{mntpoint} = $mnt;
+
+ # try to find other mount points via fstab
+ fs::get_mntpoints_from_fstab(\@parts, $d) if $mnt eq '/';
+ }
+ $_->{mntpoint} and fsedit::suggest_part($_, $hds) foreach @parts;
+}
+
+#- mainly for finding the root partitions for upgrade
+sub find_root_parts {
+ my ($hds, $prefix) = @_;
+ suggest_mount_points($hds, $prefix);
+ grep { delete($_->{mntpoint}) eq '/' } fsedit::get_fstab(@$hds);
+}
+sub use_root_part {
+ my ($fstab, $part, $prefix) = @_;
+ my $handle = any::inspect($part, $prefix) or die;
+ fs::get_mntpoints_from_fstab($fstab, $handle->{dir});
+}
+
1;