diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2003-02-10 13:51:01 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2003-02-10 13:51:01 +0000 |
commit | 3beacab73f90f4db572d24a92f54bde446e350e8 (patch) | |
tree | f674a1d7c05bd56a9dfc967d97beb04db469b1e2 /perl-install | |
parent | 65e1d3f778faaff8a1755251118ae9e00ecd0d82 (diff) | |
download | drakx-3beacab73f90f4db572d24a92f54bde446e350e8.tar drakx-3beacab73f90f4db572d24a92f54bde446e350e8.tar.gz drakx-3beacab73f90f4db572d24a92f54bde446e350e8.tar.bz2 drakx-3beacab73f90f4db572d24a92f54bde446e350e8.tar.xz drakx-3beacab73f90f4db572d24a92f54bde446e350e8.zip |
- more precise message when formatting / fsck'ing / mounting partitions
- hide passwords (for smb)
Diffstat (limited to 'perl-install')
-rw-r--r-- | perl-install/diskdrake/interactive.pm | 26 | ||||
-rw-r--r-- | perl-install/fs.pm | 31 | ||||
-rw-r--r-- | perl-install/install_steps_interactive.pm | 8 |
3 files changed, 40 insertions, 25 deletions
diff --git a/perl-install/diskdrake/interactive.pm b/perl-install/diskdrake/interactive.pm index 8dc8b4179..2656f06b6 100644 --- a/perl-install/diskdrake/interactive.pm +++ b/perl-install/diskdrake/interactive.pm @@ -761,7 +761,12 @@ sub Format { sub Mount { my ($in, $hd, $part) = @_; write_partitions($in, $hd) or return; - fs::mount_part($part); + my $w; + fs::mount_part($part, sub { + my ($msg) = @_; + $w ||= $in->wait_message('', $msg); + $w->set($msg); + }); } sub Add2RAID { my ($in, $_hd, $part, $all_hds) = @_; @@ -866,7 +871,7 @@ sub Loopback { sub Options { my ($in, $hd, $part, $all_hds) = @_; - my @simple_options = qw(user noauto supermount); + my @simple_options = qw(user noauto supermount username= password=); my (undef, $user_implies) = fs::mount_options(); my ($options, $unknown) = fs::mount_options_unpack($part); @@ -877,7 +882,7 @@ sub Options { '', [ (map { - { label => $_, text => scalar warp_text(formatAlaTeX($help{$_})), val => \$options->{$_}, + { label => $_, text => scalar warp_text(formatAlaTeX($help{$_})), val => \$options->{$_}, hidden => scalar(/password/), advanced => !$part->{rootDevice} && !member($_, @simple_options), if_(!/=$/, type => 'bool'), } } keys %$options), { label => N("Various"), val => \$unknown, advanced => 1 }, @@ -1054,10 +1059,12 @@ sub format_ { write_partitions($in, $_) or return foreach isRAID($part) ? @{$all_hds->{hds}} : $hd; ask_alldatawillbelost($in, $part, N_("After formatting partition %s, all data on this partition will be lost")) or return; $part->{isFormatted} = 0; #- force format; - my $_w = $in->wait_message(N("Formatting"), - isLoopback($part) ? N("Formatting loopback file %s", $part->{loopback_file}) : - N("Formatting partition %s", $part->{device})); - fs::format_part($all_hds->{raids}, $part); + my $w; + fs::format_part($all_hds->{raids}, sub { + my ($msg) = @_; + $w ||= $in->wait_message('', $msg); + $w->set($msg); + }); 1; } @@ -1198,7 +1205,10 @@ sub format_raw_hd_info { my $type = substr(type2name($raw_hd->{type}), 0, 40); # limit the length $info .= N("Type: ") . $type . "\n"; } - $info .= N("Options: %s", $raw_hd->{options}) if $raw_hd->{options}; + if (my $s = $raw_hd->{options}) { + $s =~ s/password=([^\s,]*)/'password=' . ('x' x length($1))/e; + $info .= N("Options: %s", $s); + } $info; } diff --git a/perl-install/fs.pm b/perl-install/fs.pm index 48a66c265..a1758d57c 100644 --- a/perl-install/fs.pm +++ b/perl-install/fs.pm @@ -605,13 +605,16 @@ sub real_format_part { $part->{isFormatted} = 1; } sub format_part { - my ($raids, $part, $prefix) = @_; + my ($raids, $part, $prefix, $wait_message) = @_; if (isRAID($part)) { + $wait_message->(N("Formatting partition %s", $part->{device})) if $wait_message; require raid; raid::format_part($raids, $part); } elsif (isLoopback($part)) { + $wait_message->(N("Creating and formatting file %s", $part->{loopback_file})) if $wait_message; loopback::format_part($part, $prefix); } else { + $wait_message->(N("Formatting partition %s", $part->{device})) if $wait_message; real_format_part($part); } } @@ -628,27 +631,26 @@ sub set_loop { } sub formatMount_part { - my ($part, $raids, $fstab, $prefix, $callback) = @_; + my ($part, $raids, $fstab, $prefix, $wait_message) = @_; if (isLoopback($part)) { - formatMount_part($part->{loopback_device}, $raids, $fstab, $prefix, $callback); + formatMount_part($part->{loopback_device}, $raids, $fstab, $prefix, $wait_message); } if (my $p = up_mount_point($part->{mntpoint}, $fstab)) { - formatMount_part($p, $raids, $fstab, $prefix, $callback) unless loopback::carryRootLoopback($part); + formatMount_part($p, $raids, $fstab, $prefix, $wait_message) unless loopback::carryRootLoopback($part); } if ($part->{encrypt_key}) { set_loop($part); } if ($part->{toFormat}) { - $callback->($part) if $callback; - format_part($raids, $part, $prefix); + format_part($raids, $part, $prefix, $wait_message); } - mount_part($part, $prefix); + mount_part($part, $prefix, 0, $wait_message); } sub formatMount_all { - my ($raids, $fstab, $prefix, $callback) = @_; - formatMount_part($_, $raids, $fstab, $prefix, $callback) + my ($raids, $fstab, $prefix, $wait_message) = @_; + formatMount_part($_, $raids, $fstab, $prefix, $wait_message) foreach sort { isLoopback($a) ? 1 : isSwap($a) ? -1 : 0 } grep { $_->{mntpoint} } @$fstab; #- ensure the link is there @@ -664,7 +666,7 @@ sub formatMount_all { } sub mount { - my ($dev, $where, $fs, $rdonly, $options) = @_; + my ($dev, $where, $fs, $rdonly, $options, $wait_message) = @_; log::l("mounting $dev on $where as type $fs, options $options"); -d $where or mkdir_p($where); @@ -674,6 +676,7 @@ sub mount { my @fs_modules = qw(vfat hfs romfs ufs reiserfs xfs jfs ext3); if (member($fs, 'smb', 'smbfs', 'nfs', 'davfs', 'ntfs') && $::isStandalone) { + $wait_message->(N("Mounting partition %s", $dev)) if $wait_message; system('mount', '-t', $fs, $dev, $where, if_($options, '-o', $options)) == 0 or die N("mounting partition %s in directory %s failed", $dev, $where); return; #- do not update mtab, already done by mount(8) } elsif (member($fs, 'ext2', 'proc', 'usbdevfs', 'iso9660', @fs_modules)) { @@ -691,6 +694,7 @@ sub mount { # if $where =~ m|/(boot)?$|; $mount_opt = 'notail'; #- notail in any case } elsif ($fs eq 'jfs' && !$rdonly) { + $wait_message->(N("Checking %s", $dev)) if $wait_message; #- needed if the system is dirty otherwise mounting read-write simply fails run_program::raw({ timeout => 60 * 60 }, "fsck.jfs", $dev) or do { my $err = $?; @@ -698,6 +702,7 @@ sub mount { }; } elsif ($fs eq 'ext2' || $fs eq 'ext3' && $::isInstall) { if (!$rdonly) { + $wait_message->(N("Checking %s", $dev)) if $wait_message; foreach ('-a', '-y') { run_program::raw({ timeout => 60 * 60 }, "fsck.ext2", $_, $dev); my $err = $?; @@ -721,6 +726,7 @@ sub mount { eval { modules::load('isofs') }; } log::l("calling mount($dev, $where, $fs, $flag, $mount_opt)"); + $wait_message->(N("Mounting partition %s", $dev)) if $wait_message; syscall_('mount', $dev, $where, $fs, $flag, $mount_opt) or die N("mounting partition %s in directory %s failed", $dev, $where) . " ($!)"; } else { log::l("skipping mounting $fs partition"); @@ -742,7 +748,7 @@ sub umount { } sub mount_part { - my ($part, $prefix, $rdonly) = @_; + my ($part, $prefix, $rdonly, $wait_message) = @_; #- root carrier's link can't be mounted loopback::carryRootCreateSymlink($part, $prefix); @@ -767,6 +773,7 @@ sub mount_part { unless ($::testing) { if (isSwap($part)) { + $wait_message->(N("Enabling swap partition %s", $part->{device})) if $wait_message; swap::swapon($part->{device}); } else { $part->{mntpoint} or die "missing mount point for partition $part->{device}"; @@ -778,7 +785,7 @@ sub mount_part { $mntpoint = "/initrd/loopfs"; } my $dev = $part->{real_device} || $part->{device}; - mount($dev, $mntpoint, type2fs($part), $rdonly, $part->{options}); + mount($dev, $mntpoint, type2fs($part), $rdonly, $part->{options}, $wait_message); rmdir "$mntpoint/lost+found"; } } diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm index 9df720bf9..2ea0cc363 100644 --- a/perl-install/install_steps_interactive.pm +++ b/perl-install/install_steps_interactive.pm @@ -332,11 +332,9 @@ sub formatMountPartitions { my $w; catch_cdie { fs::formatMount_all($o->{all_hds}{raids}, $o->{fstab}, $o->{prefix}, sub { - my ($part) = @_; - $w ||= $o->wait_message('', N("Formatting partitions")); - $w->set(isLoopback($part) ? - N("Creating and formatting file %s", $part->{loopback_file}) : - N("Formatting partition %s", $part->{device})); + my ($msg) = @_; + $w ||= $o->wait_message('', $msg); + $w->set($msg); }); } sub { $@ =~ /fsck failed on (\S+)/ or return; |