From fb23be31b3495b8c2ea5210a56977b4e79d96133 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Thu, 20 Feb 2003 01:18:17 +0000 Subject: - simplify check_mntpoint - fix checking mount point in Mount_point() --- perl-install/diskdrake/interactive.pm | 37 +++++++++++------------------------ perl-install/fsedit.pm | 5 +++-- 2 files changed, 14 insertions(+), 28 deletions(-) diff --git a/perl-install/diskdrake/interactive.pm b/perl-install/diskdrake/interactive.pm index 3f0e7d30b..ef10b3a6d 100644 --- a/perl-install/diskdrake/interactive.pm +++ b/perl-install/diskdrake/interactive.pm @@ -587,18 +587,19 @@ sub Mount_point { isLoopback($part) ? N("Where do you want to mount the loopback file %s?", $part->{loopback_file}) : N("Where do you want to mount device %s?", $part->{device}), focus_first => 1, - }, - [ { label => N("Mount point"), val => \$mntpoint, - list => [ uniq(if_($mntpoint, $mntpoint), fsedit::suggestions_mntpoint($all_hds), '') ], - not_edit => 0 } ], - complete => sub { + callbacks => { + complete => sub { !isPartOfLoopback($part) || $mntpoint or $in->ask_warn('', N("Can't unset mount point as this partition is used for loop back. Remove the loopback first")), return 1; $part->{mntpoint} eq $mntpoint || check_mntpoint($in, $mntpoint, $hd, $part, $all_hds) or return 1; $migrate_files = need_migration($in, $mntpoint) or return 1; 0; - } + } }, + }, + [ { label => N("Mount point"), val => \$mntpoint, + list => [ uniq(if_($mntpoint, $mntpoint), fsedit::suggestions_mntpoint($all_hds), '') ], + not_edit => 0 } ], ) or return; $part->{mntpoint} = $mntpoint; @@ -1013,27 +1014,11 @@ sub check_type { sub check_mntpoint { my ($in, $mntpoint, $hd, $part, $all_hds) = @_; eval { fsedit::check_mntpoint($mntpoint, $hd, $part, $all_hds) }; - local $_ = $@; - if (m|/boot ending on cylinder > 1024|) { - $in->ask_warn('', -N("Sorry I won't accept to create /boot so far onto the drive (on a cylinder > 1024). -Either you use LILO and it won't work, or you don't use LILO and you don't need /boot")); - } elsif (m|/ ending on cylinder > 1024|) { - $in->ask_warn('', -N("The partition you've selected to add as root (/) is physically located beyond -the 1024th cylinder of the hard drive, and you have no /boot partition. -If you plan to use the LILO boot manager, be careful to add a /boot partition")); - undef $_; - } elsif (m|raid / with no /boot|) { - $in->ask_warn('', -N("You've selected a software RAID partition as root (/). -No bootloader is able to handle this without a /boot partition. -Please be sure to add a /boot partition")); - undef $_; - } elsif ($_) { - $in->ask_warn('', formatError($_)); + if (my $err = $@) { + $in->ask_warn('', formatError($err)); + return; } - !$_; + 1; } sub check { my ($in, $hd, $part, $all_hds) = @_; diff --git a/perl-install/fsedit.pm b/perl-install/fsedit.pm index 72d87e7d8..10bc974df 100644 --- a/perl-install/fsedit.pm +++ b/perl-install/fsedit.pm @@ -529,8 +529,9 @@ sub check_mntpoint { $mntpoint =~ m|^/| or die \N("Mount points must begin with a leading /"); $mntpoint ne $part->{mntpoint} && has_mntpoint($mntpoint, $all_hds) and die \N("There is already a partition with mount point %s\n", $mntpoint); - die "raid / with no /boot" - if $mntpoint eq "/" && isRAID($part) && !has_mntpoint("/boot", $all_hds); + die \N("You've selected a software RAID partition as root (/). +No bootloader is able to handle this without a /boot partition. +Please be sure to add a /boot partition") if $mntpoint eq "/" && isRAID($part) && !has_mntpoint("/boot", $all_hds); die \N("You can't use a LVM Logical Volume for mount point %s", $mntpoint) if $mntpoint eq '/boot' && isLVM($hd); die \N("This directory should remain within the root filesystem") -- cgit v1.2.1