diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2005-06-10 07:38:18 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2005-06-10 07:38:18 +0000 |
commit | a655b0e1e07efb3fd057f726b85887908d970ba6 (patch) | |
tree | 5c22433d00fef31132d1ce790939093b0e3956a2 /perl-install/diskdrake | |
parent | b026d0fd87157061e0f8e5a31247bec7d08a8394 (diff) | |
download | drakx-a655b0e1e07efb3fd057f726b85887908d970ba6.tar drakx-a655b0e1e07efb3fd057f726b85887908d970ba6.tar.gz drakx-a655b0e1e07efb3fd057f726b85887908d970ba6.tar.bz2 drakx-a655b0e1e07efb3fd057f726b85887908d970ba6.tar.xz drakx-a655b0e1e07efb3fd057f726b85887908d970ba6.zip |
- move functions using /proc/partitions out of fsedit to fs::proc_partitions
- remove unneeded "use xxx"
- add some "use xxx" (nb: not completly needed because some other modules may do it)
Diffstat (limited to 'perl-install/diskdrake')
-rw-r--r-- | perl-install/diskdrake/hd_gtk.pm | 4 | ||||
-rw-r--r-- | perl-install/diskdrake/interactive.pm | 26 | ||||
-rw-r--r-- | perl-install/diskdrake/smbnfs_gtk.pm | 1 |
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; |