package install::steps; # $Id$
use diagnostics;
use strict;
use vars qw(@filesToSaveForUpgrade @filesNewerToUseAfterUpgrade);
#-######################################################################################
#- misc imports
#-######################################################################################
use common;
use install::any 'addToBeDone';
use partition_table;
use detect_devices;
use fs::any;
use fs::type;
use fs::partitioning;
use modules;
use run_program;
use lang;
use keyboard;
use fsedit;
use do_pkgs;
use install::pkgs;
use any;
use log;
our @ISA = qw(do_pkgs);
@filesToSaveForUpgrade = qw(
/etc/ld.so.conf /etc/fstab /etc/hosts /etc/conf.modules /etc/modules.conf
);
@filesNewerToUseAfterUpgrade = qw(
/etc/profile
);
#-######################################################################################
#- OO Stuff
#-######################################################################################
sub new($$) {
my ($type, $o) = @_;
bless $o, ref($type) || $type;
return $o;
}
sub charsetChanged {
my ($_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 "$::prefix/root/drakx") {
eval { cp_af("/tmp/ddebug.log", "$::prefix/root/drakx") };
output(install::any::auto_inst_file(), install::any::g_auto_install(1));
}
foreach my $s (@{$o->{orderedSteps}}) {
#- 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() };
if (my $err = $@) {
$o->ask_warn(N("Error"), [
N("An error occurred, but I do not know how to handle it nicely.
Continue at your own risk."), formatError($err) || $err ]);
}
}
}
sub errorInStep {
my ($_o, $err) = @_;
print "error :(\n";
print "$err\n\n";
c::_exit(1);
}
sub kill_action {}
#-######################################################################################
#- Steps Functions
#-######################################################################################
#------------------------------------------------------------------------------
sub selectLanguage {
my ($o) = @_;
#- for auto_install compatibility with old $o->{lang}
$o->{locale} = lang::system_locales_to_ourlocale($o->{lang}, $o->{lang}) if $o->{lang};
$o->{locale}{langs} ||= { $o->{locale}{lang} => 1 };
if (!exists $o->{locale}{country}) {
lang::lang_changed($o->{locale});
}
add2hash_($o->{locale}, { utf8 => lang::utf8_should_be_needed($o->{locale}) });
lang::set($o->{locale}, !$o->isa('interactive::gtk'));
|