diff options
Diffstat (limited to 'perl-install/printer')
0 files changed, 0 insertions, 0 deletions
![]() |
index : drakx | |
Mageia Installer and base platform for many utilities | Thierry Vignaud [tv] |
summaryrefslogtreecommitdiffstats |
package install_steps;
use diagnostics;
use strict;
use vars qw(@filesToSaveForUpgrade);
#-######################################################################################
#- misc imports
#-######################################################################################
use common qw(:file :system :common :functional);
use install_any qw(:all);
use partition_table qw(:types);
use detect_devices;
use modules;
use run_program;
use lang;
use raid;
use keyboard;
use log;
use fsedit;
use loopback;
use commands;
use network;
use any;
use fs;
@filesToSaveForUpgrade = qw(
/etc/ld.so.conf /etc/fstab /etc/hosts /etc/conf.modules /etc/modules.conf
);
#-######################################################################################
#- OO Stuff
#-######################################################################################
sub new($$) {
my ($type, $o) = @_;
bless $o, ref $type || $type;
return $o;
}
#-######################################################################################
#- In/Out Steps Functions
#-######################################################################################
sub enteringStep {
my ($o, $step) = @_;
log::l("starting step `$step'");
}
sub leavingStep {
my ($o, $step) = @_;
log::l("step `$step' finished");
if (-d "$o->{prefix}/root") {
eval { commands::cp('-f', "/tmp/ddebug.log", "$o->{prefix}/root") };
install_any::g_auto_install();
}
for (my $s = $o->{steps}{first}; $s; $s = $o->{steps}{$s}{next}) {
#- the reachability property must be recomputed each time to take
#- into account failed step.
next if $o->{steps}{$s}{done} && !$o->{steps}{$s}{redoable};
my $reachable = 1;
if (my $needs = $o->{steps}{$s}{needs}) {
my @l = ref $needs ? @$needs : $needs;
$reachable = min(map { $o->{steps}{$_}{done} || 0 } @l);
}
$o->{steps}{$s}{reachable} = 1 if $reachable;
}
$o->{steps}{$step}{reachable} = $o->{steps}{$step}{redoable};
while (my $f = shift @{$o->{steps}{$step}{toBeDone} || []}) {
eval { &$f() };
$o->ask_warn(_("Error"), [
_("An error occurred, but I don't know how to handle it nicely.
Continue at your own risk."), $@ ]) if $@;
}
}
sub errorInStep($$) { print "error :(\n"; c::_exit(1) }
sub kill_action {}
sub set_help { 1 }
#-######################################################################################
#- Steps Functions
#-######################################################################################
#------------------------------------------------------------------------------
sub selectLanguage {
my ($o) = @_;
lang::set($o->{lang});
$o->{langs} ||= [ $o->{lang} ];
lang::load_console_font($o->{lang});
if ($o->{keyboard_unsafe} || !$o->{keyboard}) {
$o->{keyboard_unsafe} = 1;
$o->{keyboard} = keyboard::lang2keyboard($o->{lang});
selectKeyboard($o);
}
}
#------------------------------------------------------------------------------
sub selectKeyboard {
my ($o) = @_;
keyboard::setup($o->{keyboard});
lang::set_langs($o->{langs});
}
#------------------------------------------------------------------------------
sub selectPath {}
#------------------------------------------------------------------------------
sub selectInstallClass($@) {
my ($o) = @_;
$o->{installClass} ||= $::corporate ? "corporate" : "normal";
$o->{security} ||= ${{
normal => 2,
developer => 3,
corporate => 3,
server => 4,
}}{$o->{installClass}};
}
#------------------------------------------------------------------------------
sub setupSCSI {
modules::load_ide();
modules::load_thiskind('scsi|raid');
}
#------------------------------------------------------------------------------
sub doPartitionDisks {
my ($o, $hds) = @_;
if ($o->{lnx4win}) {
my @l = sort { $a->{device_windobe} cmp $b->{device_windobe} }
grep { isFat($_) } fsedit::get_fstab(@{$o->{hds}}) or die "wow, lnx4win with no fat partitions! hard times :(";
my $real_part = @l > 1 && $o->doPartitionDisksLnx4winDev(\@l) || $l[0];
my $handle = loopback::inspect($real_part, '', 'rw') or die _("This partition can't be used for loopback");
my $size = loopback::getFree($handle->{dir}, $real_part);
my $max_linux = 1000 << 11; $max_linux *= 10 if $::expert;
my $min_linux = 300 << 11; $min_linux /= 3 if $::expert;
my $min_freewin = 100 << 11; $min_freewin /= 10 if $::expert;
my $swap = { type => 0x82, loopback_file => '/lnx4win/swapfile', mntpoint => 'swap', size => 64 << 11, device => $real_part, notFormatted => 1 };
my $root = { type => 0x83, loopback_file => '/lnx4win/linuxsys.img', mntpoint => '/', size => 0, device => $real_part, notFormatted => 1 };
$root->{size} = min($size - $swap->{size} - $min_freewin, $max_linux);
log::l("lnx4win $root->{size} <= $min_linux (minlinux), $size (minavail) - $swap->{size} (swapsize) - $min_freewin (minfreewin), $max_linux (maxlinux)");
$root->{size} > $min_linux or die "not enough room on that partition for lnx4win";
$o->doPartitionDisksLnx4winSize(\$root->{size}, \$swap->{size}, $size - 2 * $swap->{size}, 2 * $swap->{size});
unlink "$handle->{dir}$_" foreach "/lnx4win/swapfile", "/lnx4win/linuxsys.img";
push @{$real_part->{loopback}}, $root, $swap;
} else {
unless ($::testing) {