package install_steps; # $Id$ use diagnostics; use strict; use vars qw(@filesToSaveForUpgrade @filesNewerToUseAfterUpgrade); #-###################################################################################### #- misc imports #-###################################################################################### use common; use install_any qw(:all); use partition_table; use detect_devices; use fs::type; use modules; use run_program; use lang; use keyboard; use fsedit; use loopback; use do_pkgs; use 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 "$o->{prefix}/root/drakx") { eval { cp_af("/tmp/ddebug.log", "$o->{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() }; $o->ask_warn(N("Error"), [ N("An error occurred, but I don't know how to handle it nicely. Continue at your own risk."), formatError($@) ]) if $@; } } 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}) { my $h = lang::analyse_locale_name(lang::l2locale($o->{locale}{lang})); $o->{locale}{country} = $h->{country} if $h->{country}; $o->{locale}{IM} = lang::get_default_im($o->{locale}{lang}); } lang::set($o->{locale}, !$o->isa('interactive::gtk')); add2hash_($o->{locale}, { utf8 => lang::utf8_should_be_needed($o->{locale}) }); log::l("selectLanguage: pack_langs: ", lang::pack_langs($o->{locale}{langs}), " utf8-flag: ", to_bool($o->{locale}{utf8})); #- for auto_install compatibility with old $o->{keyboard} containing directly $o->{keyboard}{KEYBOARD} $o->{keyboard} = { KEYBOARD => $o->{keyboard} } if $o->{keyboard} && !ref($o->{keyboard}); if (!$o->{keyboard} || $o->{keyboard}{unsafe}) { $o->{keyboard} = keyboard::from_usb() || keyboard::lang2keyboard($o->{locale}{lang}); $o->{keyboard}{unsafe} = 1; keyboard::setup($o->{keyboard}); } $o->charsetChanged; addToBeDone { lang::write_langs($o->{locale}{langs}); } 'formatPartitions'; addToBeDone { lang::write($o->{locale}); } 'installPackages'; } #------------------------------------------------------------------------------ sub selectKeyboard { my ($o) = @_; $o->{keyboard}{KBCHARSET} = lang::l2charset($o->{locale}{lang}); keyboard::setup($o->{keyboard}); addToBeDone { keyboard::write($o->{keyboard}); } 'installPackages' if !$o->{isUpgrade} || !$o->{keyboard}{unsafe}; if ($o->{raw_X}) { require Xconfig::default; Xconfig::default::config_keyboard($o->{raw_X}, $o->{keyboard}); $o->{raw_X}->write; } } #------------------------------------------------------------------------------ sub acceptLicense {} #------------------------------------------------------------------------------ sub setupSCSI { my ($o) = @_; install_any::configure_pcmcia($o->{modules_conf}, $o-IBM Hard Drive Active Protection System (HDAPS) driver