summaryrefslogtreecommitdiffstats
path: root/perl-install/diskdrake
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/diskdrake')
-rw-r--r--perl-install/diskdrake/hd_gtk.pm4
-rw-r--r--perl-install/diskdrake/interactive.pm26
-rw-r--r--perl-install/diskdrake/smbnfs_gtk.pm1
3 files changed, 26 insertions, 5 deletions
diff --git a/perl-install/diskdrake/hd_gtk.pm b/perl-install/diskdrake/hd_gtk.pm
index 95860d7e5..7de290b89 100644
--- a/perl-install/diskdrake/hd_gtk.pm
+++ b/perl-install/diskdrake/hd_gtk.pm
@@ -11,8 +11,6 @@ use detect_devices;
use diskdrake::interactive;
use run_program;
use devices;
-use raid;
-use any;
use log;
use fsedit;
@@ -108,7 +106,7 @@ sub try {
sub try_ {
my ($name, $f, @args) = @_;
- fsedit::undo_prepare($all_hds) if $name ne 'Undo';
+ diskdrake::interactive::undo_prepare($all_hds) if $name ne 'Undo';
my $v = eval { $f->($in, @args, $all_hds) };
if (my $err = $@) {
diff --git a/perl-install/diskdrake/interactive.pm b/perl-install/diskdrake/interactive.pm
index 080bb375d..ca5b8f4d4 100644
--- a/perl-install/diskdrake/interactive.pm
+++ b/perl-install/diskdrake/interactive.pm
@@ -7,6 +7,7 @@ use common;
use fs::type;
use fs::loopback;
use fs::format;
+use fs::mount_options;
use fs;
use partition_table;
use partition_table::raw;
@@ -258,7 +259,7 @@ sub general_possible_actions {
sub Undo {
my ($_in, $all_hds) = @_;
- fsedit::undo($all_hds);
+ undo($all_hds);
}
sub Wizard {
@@ -1313,3 +1314,26 @@ sub update_bootloader_for_renumbered_partitions {
require bootloader;
bootloader::update_for_renumbered_partitions($in, \@renumbering, $all_hds);
}
+
+sub undo_prepare {
+ my ($all_hds) = @_;
+ require Data::Dumper;
+ $Data::Dumper::Purity = 1;
+ foreach (@{$all_hds->{hds}}) {
+ my @h = @$_{@partition_table::fields2save};
+ push @{$_->{undo}}, Data::Dumper->Dump([\@h], ['$h']);
+ }
+}
+sub undo {
+ my ($all_hds) = @_;
+ foreach (@{$all_hds->{hds}}) {
+ my $code = pop @{$_->{undo}} or next;
+ my $h; eval $code;
+ @$_{@partition_table::fields2save} = @$h;
+
+ if ($_->{hasBeenDirty}) {
+ partition_table::will_tell_kernel($_, 'force_reboot'); #- next action needing write_partitions will force it. We can not do it now since more undo may occur, and we must not needReboot now
+ }
+ }
+
+}
diff --git a/perl-install/diskdrake/smbnfs_gtk.pm b/perl-install/diskdrake/smbnfs_gtk.pm
index 69c9517a6..f30857ce0 100644
--- a/perl-install/diskdrake/smbnfs_gtk.pm
+++ b/perl-install/diskdrake/smbnfs_gtk.pm
@@ -3,7 +3,6 @@ package diskdrake::smbnfs_gtk; # $Id$
use diagnostics;
use strict;
-use any;
use fs::get;
use diskdrake::interactive;
use common;