diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2002-07-06 12:22:50 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2002-07-06 12:22:50 +0000 |
commit | a698efb76706f47b014f54e52337b88d7f895e88 (patch) | |
tree | ea3430af2b136933cef2841deec8b179980cc2fa | |
parent | 07ee1140ee1a93ed71bc93e309f62bf58d036c6a (diff) | |
download | drakx-backup-do-not-use-a698efb76706f47b014f54e52337b88d7f895e88.tar drakx-backup-do-not-use-a698efb76706f47b014f54e52337b88d7f895e88.tar.gz drakx-backup-do-not-use-a698efb76706f47b014f54e52337b88d7f895e88.tar.bz2 drakx-backup-do-not-use-a698efb76706f47b014f54e52337b88d7f895e88.tar.xz drakx-backup-do-not-use-a698efb76706f47b014f54e52337b88d7f895e88.zip |
(as suggested by Alexander Skwar)
- in interactive::check_type, check if the package (like jfsprogs) is installed
- use interactive::check_type where usefull
- cleanup
-rw-r--r-- | perl-install/diskdrake/hd_gtk.pm | 4 | ||||
-rw-r--r-- | perl-install/diskdrake/interactive.pm | 31 |
2 files changed, 24 insertions, 11 deletions
diff --git a/perl-install/diskdrake/hd_gtk.pm b/perl-install/diskdrake/hd_gtk.pm index 89dd91deb..0755d9b42 100644 --- a/perl-install/diskdrake/hd_gtk.pm +++ b/perl-install/diskdrake/hd_gtk.pm @@ -110,7 +110,7 @@ sub try_ { fsedit::undo_prepare($all_hds) if $name ne 'Undo'; - my $v = eval { $f->($in, @args, $all_hds); }; + my $v = eval { $f->($in, @args, $all_hds) }; if (my $err = $@) { $err =~ /setstep/ and die ''; $in->ask_warn(_("Error"), formatError($err)); @@ -347,7 +347,7 @@ sub createOrChangeType { return if $type == $part->{type}; isBusy($part) and $in->ask_warn('', _("Use ``Unmount'' first")), return; diskdrake::interactive::ask_alldatawillbelost($in, $part, __("After changing type of partition %s, all data on this partition will be lost")) or return; - fsedit::change_type($type, $hd, $part); + check_type($in, $type, $hd, $part) and fsedit::change_type($type, $hd, $part); } else { $part->{type} = $type; diskdrake::interactive::Create($in, $hd, $part, $all_hds); diff --git a/perl-install/diskdrake/interactive.pm b/perl-install/diskdrake/interactive.pm index 31be03443..fd4bd3af2 100644 --- a/perl-install/diskdrake/interactive.pm +++ b/perl-install/diskdrake/interactive.pm @@ -494,15 +494,17 @@ sub Type { #- for ext2, warn after choosing as ext2->ext3 can be achieved without loosing any data :) isExt2($part) or $warn->() or return; - my $type = type2name($part->{type}); + my $type_name = type2name($part->{type}); $in->ask_from(_("Change partition type"), _("Which filesystem do you want?"), - [ { label => _("Type"), val => \$type, list => [ partition_table::important_types() ], sort => 0, not_edit => !$::expert } ]) or return; + [ { label => _("Type"), val => \$type_name, list => [ partition_table::important_types() ], sort => 0, not_edit => !$::expert } ]) or return; + + my $type = $type_name && name2type($type_name); - if (isExt2($part) && isThisFs('ext3', { type => name2type($type) })) { + if (isExt2($part) && isThisFs('ext3', { type => $type })) { my $w = $in->wait_message('', _("Switching from ext2 to ext3")); if (run_program::run("tune2fs", "-j", devices::make($part->{device}))) { - $part->{type} = name2type($type); + $part->{type} = $type; $part->{isFormatted} = 1; #- assume that if tune2fs works, partition is formatted #- disable the fsck (don't do it together with -j in case -j fails?) @@ -514,8 +516,7 @@ sub Type { !isExt2($part) or $warn->() or return; if (defined $type) { - my $i_type = name2type($type); - fsedit::change_type(name2type($type), $hd, $part); + check_type($in, $type, $hd, $part) and fsedit::change_type($type, $hd, $part); } } @@ -920,9 +921,21 @@ sub partitions_suggestions { sub check_type { my ($in, $type, $hd, $part) = @_; eval { fsedit::check_type($type, $hd, $part) }; - my $err = $@; - $in->ask_warn('', $err) if $err; - !$err; + if (my $err = $@) { + $in->ask_warn('', $err); + return; + } + if ($::isStandalone) { + if (my $pkg = fsedit::package_needed_for_partition_type({ type => $type })) { + my $fs = type2fs({ type => $type }); + if (!-x "/sbin/mkfs.$fs") { + $in->ask_yesorno('', _("The package %s is needed. Install it?", $pkg), 1) or return; + $in->do_pkgs->install($pkg); + } + -x "/sbin/mkfs.$fs" or $in->ask_warn('', "Mandatory package $pkg is missing"), return; + } + } + 1; } sub check_mntpoint { my ($in, $mntpoint, $hd, $part, $all_hds) = @_; |