From da9f593e8715b075d0fb84a81de7909b6881bacb Mon Sep 17 00:00:00 2001 From: Pascal Terjan Date: Tue, 3 Feb 2009 10:41:51 +0000 Subject: allow browsing partitions content to easily select the ones to destroy --- perl-install/NEWS | 1 + perl-install/diskdrake/interactive.pm | 31 ++++++++++++++++++++++++++++++- perl-install/install/NEWS | 1 + 3 files changed, 32 insertions(+), 1 deletion(-) (limited to 'perl-install') diff --git a/perl-install/NEWS b/perl-install/NEWS index f645934e5..379e0d087 100644 --- a/perl-install/NEWS +++ b/perl-install/NEWS @@ -3,6 +3,7 @@ - diskdrake: o don't rewrite label when it did not change (#47186) o rewrite gpt support with libparted + o allow browsing partitions content to easily select the ones to destroy - drakdvb: introduce new DVB channels scanning tool (from Pascal Terjan) - draksound: diff --git a/perl-install/diskdrake/interactive.pm b/perl-install/diskdrake/interactive.pm index eaf2c8db4..8c5445f83 100644 --- a/perl-install/diskdrake/interactive.pm +++ b/perl-install/diskdrake/interactive.pm @@ -395,6 +395,7 @@ sub part_possible_actions { $part or return; my %actions = my @l = ( + N_("View") => '!isSwap && !isNonMountable && maybeFormatted', N_("Mount point") => '$part->{real_mntpoint} || (!isBusy && !isSwap && !isNonMountable)', N_("Type") => '!isBusy && $::expert && (!readonly || $part->{pt_type} == 0x83)', N_("Options") => '!isSwap($part) && !isNonMountable && $::expert', @@ -438,6 +439,34 @@ sub part_possible_actions { } } +sub View { + my ($in, $hd, $part, $all_hds) = @_; + my $old_mountpoint = $part->{mntpoint}; + my $old_real_mountpoint = $part->{real_mntpoint}; + my $was_mounted = $part->{isMounted}; + my $mountpoint; + if(!$was_mounted) { + $part->{mntpoint} = '/tmp/mnt_browse'; + $mountpoint = $part->{mntpoint}; + mkdir_p($part->{mntpoint}); + my $w; + fs::mount::part($part, 0, sub { + my ($msg) = @_; + $w ||= $in->wait_message(N("Please wait"), $msg); + $w->set($msg); + }); + } else { + $mountpoint = $part->{real_mntpoint} || $part->{mntpoint}; + } + $in->ask_directory({'directory'=>$part->{mntpoint}}); + if(!$was_mounted) { + fs::mount::umount($part); + $part->{mntpoint} = $old_mountpoint; + $part->{real_mntpoint} = $old_real_mountpoint; + unlink($mountpoint); + } +} + #- in case someone use diskdrake only to create partitions, #- ie without assigning a mount point, #- do not suggest mount points anymore @@ -698,7 +727,7 @@ sub Resize { $nice_resize{fat} = resize_fat::main->new($part->{device}, devices::make($part->{device})); $min = max($min, $nice_resize{fat}->min_size); $max = min($max, $nice_resize{fat}->max_size); - } elsif (member($part->{fs_type}, qw(ext2 ext3))) { # resize2fs is known to be broken regarding extents with ext4 + } elsif (member($part->{fs_type}, qw(ext2 ext3))) { # resize2fs is known to be broken regarding extents with ext4 write_partitions($in, $hd) or return; require diskdrake::resize_ext2; if ($nice_resize{ext2} = diskdrake::resize_ext2->new($part->{device}, devices::make($part->{device}))) { diff --git a/perl-install/install/NEWS b/perl-install/install/NEWS index a641fcd91..bb5ec74ff 100644 --- a/perl-install/install/NEWS +++ b/perl-install/install/NEWS @@ -1,3 +1,4 @@ +- allow browsing partitions content to easily select the ones to destroy - do not warn about "servers which open ports on outside by default" (the list of servers is not maintained, and the policy for those servers has changed) - use a file selector in text mode too -- cgit v1.2.1