diff options
Diffstat (limited to 'globetrotter')
0 files changed, 0 insertions, 0 deletions
![]() |
index : drakx | |
Mageia Installer and base platform for many utilities | Thierry Vignaud [tv] |
summaryrefslogtreecommitdiffstats |
package install_interactive; # $Id$
use diagnostics;
use strict;
use common;
use partition_table;
use partition_table::raw;
use fs::type;
use detect_devices;
use install_steps;
use install_any;
use devices;
use fsedit;
use log;
sub tellAboutProprietaryModules {
my ($o) = @_;
my @l = grep { $_ } map { $_->{driver} =~ /^Bad:(.*)/ && $1 } detect_devices::probeall();
$o->ask_warn('', formatAlaTeX(
N("Some hardware on your computer needs ``proprietary'' drivers to work.
You can find some information about them at: %s", join(", ", @l)))) if @l;
}
#- unit of $mb is mega bytes, min and max are in sectors, this
#- function is used to convert back to sectors count the size of
#- a partition ($mb) given from the interface (on Resize or Create).
#- modified to take into account a true bounding with min and max.
sub from_Mb {
my ($mb, $min, $max) = @_;
$mb <= $min >> 11 and return $min;
$mb >= $max >> 11 and return $max;
$mb * 2048;
}
sub partition_with_diskdrake {
my ($o, $all_hds, $nowizard) = @_;
my $ok;
do {
$ok = 1;
my $do_force_reload = sub {
$o->{all_hds} = fs::get::empty_all_hds();
install_any::getHds($o, $o);
$all_hds = $o->{all_hds};
$o->{all_hds};
};
require diskdrake::interactive;
{
local $::expert = $::expert;
diskdrake::interactive::main($o, $all_hds, $nowizard, $do_force_reload, $o->interactive_help_sub_display_id('partition_with_diskdrake'));
}
if (delete $o->{wizard}) {
partitionWizard($o, 'nodiskdrake') or redo;
return 1;
}
my @fstab = fs::get::fstab($all_hds);
unless (fs::get::root_(\@fstab)) {
$ok = 0;
$o->ask_okcancel('', N("You must have a root partition.
For this, create a partition (or click on an existing one).
Then choose action ``Mount point'' and set it to `/'"), 1) or return;
}
if (!any { isSwap($_) } @fstab) {
$ok &&= $o->ask_okcancel('', N("You do not have a swap partition.\n\nContinue anyway?"));
}
if (arch() =~ /ia64/ && !fs::get::has_mntpoint("/boot/efi", $all_hds)) {
$o->ask_warn('', N("You must have a FAT partition mounted in /boot/efi"));
$ok = '';
}
} until $ok;
1;
}
sub partitionWizardSolutions {
my ($o, $all_hds) = @_;
my $hds = $all_hds->{hds};
my $fstab = [ fs::get::fstab($all_hds) ];
my @wizlog;
my (%solutions);
my $min_linux = 400 << 11;
my $max_linux = 2000 << 11;
my $min_swap = 50 << 11;
my $max_swap = 300 << 11;
my $min_freewin = 100 << 11;
# each solution is a [ score, text, function ], where the function retunrs true if succeeded
my @hds_rw = grep { !$_->{readonly} } @$hds;
my @hds_can_add = grep { $_->can_raw_add } @hds_rw;
if (fs::get::hds_free_space(@hds_can_add) > $min_linux) {
$solutions{free_space} = [ 20, N("Use free space"), sub { fsedit::auto_allocate($all_hds, $o->{partitions}); 1 } ];
} else {
push @wizlog, N("Not enough free space to allocate new partitions") . ": " .
(@hds_can_add ?
fs::get::hds_free_space(@hds_can_add) . " < $min_linux" :
"no harddrive on which partitions can be added");
}
if (my @truefs = grep { isTrueLocalFS($_) } @$fstab) {
#- value twice the ext2 partitions
$solutions{existing_part} = [ 6 + @truefs + @$fstab, N("Use existing partitions"), sub { $o->ask_mntpoint_s($fstab) } ];
} else {
push @wizlog, N("There is no existing partition to use");
}
my @fats = grep { $_->{fs_type} eq 'vfat' } @$fstab;
fs::df($_) foreach @fats;
if (my @ok_forloopback = sort { $b->{free} <=> $a->{free} } grep { $_->{free} > $min_linux + $min_swap + $min_freewin } @fats) {
$solutions{loopback} =
[ -10 - @fats, N("Use the Windows partition for loopback"),
sub {
my ($s_root, $s_swap);
my $part = $o->ask_from_listf('', N("Which partition do you want to use for Linux4Win?"), \&partition_table::description, \@ok_forloopback) or return;
$max_swap = $min_swap + 1 if $part->{free} - $max_swap < $min_linux;
$o->ask_from('', N("Choose the sizes"), [
{ label => N("Root partition size in MB: "), val => \$s_root, min => $min_linux >> 11, max => min($part->{free} - $max_swap, $max_linux) >> 11, type => 'range' },