package install2; # $Id$ use diagnostics; use strict; use vars qw($o $version); #-###################################################################################### #- misc imports #-###################################################################################### use steps; use common; use install_any qw(:all); use install_steps; use lang; use keyboard; use mouse; use fsedit; use devices; use partition_table qw(:types); use modules; use detect_devices; use run_program; use any; use log; use fs; #-$::corporate=1; #-####################################################################################### #-$O #-the big struct which contain, well everything (globals + the interactive methods ...) #-if you want to do a kickstart file, you just have to add all the required fields (see for example #-the variable $default) #-####################################################################################### $o = $::o = { # bootloader => { linear => 0, lba32 => 1, message => 1, timeout => 5, restricted => 0 }, mkbootdisk => 0, #- no mkbootdisk if 0 or undef, find a floppy with 1, or fd1 #- packages => [ qw() ], partitioning => { clearall => 0, eraseBadPartitions => 0, auto_allocate => 0 }, #-, readonly => 0 }, security => 2, authentication => { md5 => 1, shadow => 1 }, lang => 'en_US', isUpgrade => 0, toRemove => [], toSave => [], #- simple_themes => 1, timezone => { #- timezone => "Europe/Paris", #- UTC => 1, }, #- superuser => { password => 'a', shell => '/bin/bash', realname => 'God' }, #- user => { name => 'foo', password => 'bar', home => '/home/foo', shell => '/bin/bash', realname => 'really, it is foo' }, #- keyboard => 'de', #- display => "192.168.1.19:1", steps => \%steps::installSteps, orderedSteps => \@steps::orderedInstallSteps, #- for the list of fields available for user and superuser, see @etc_pass_fields in install_steps.pm #- intf => { eth0 => { DEVICE => "eth0", IPADDR => '1.2.3.4', NETMASK => '255.255.255.128' } }, #-step : the current one #-prefix #-mouse #-keyboard #-netc #-methods #-packages compss #-printer haveone entry(cf printer.pm) }; sub installStepsCall { my ($o, $auto, $fun, @args) = @_; $fun = "install_steps::$fun" if $auto; $o->$fun(@args); } #-###################################################################################### #- Steps Functions #- each step function are called with two arguments : clicked(because if you are a #- beginner you can force the the step) and the entered number #-###################################################################################### #------------------------------------------------------------------------------ sub selectLanguage { my ($clicked, $ent_number, $auto) = @_; installStepsCall($o, $auto, 'selectLanguage', $ent_number == 1); } #------------------------------------------------------------------------------ sub selectMouse { my ($clicked, $ent_number, $auto) = @_; require pkgs; my ($first_time) = $ent_number == 1; add2hash($o->{mouse} ||= {}, mouse::read($o->{prefix})) if $o->{isUpgrade} && $first_time; installStepsCall($o, $auto, 'selectMouse', !$first_time || $clicked); addToBeDone { mouse::write($o->{prefix}, $o->{mouse}) } 'installPackages'; } #------------------------------------------------------------------------------ sub setupSCSI { my ($clicked, $ent_number, $auto) = @_; if (!$::live && !$::g_auto_install && !$o->{blank} && !$::testing) { -s modules::cz_file() or die _("Can't access kernel modules corresponding to your kernel (file %s is missing)", modules::cz_file()); } installStepsCall($o, $auto, 'setupSCSI', $clicked); } #------------------------------------------------------------------------------ sub selectKeyboard { my ($clicked, $first_time, $auto) = ($_[0], $_[1] == 1, $_[2]); if ($o->{isUpgrade} && $first_time && $o->{keyboard_unsafe}) { my $keyboard = keyboard::read($o->{prefix}); $keyboard and $o->{keyboard} = $keyboard; } installStepsCall($o, $auto, 'selectKeyboard', $clicked); } #------------------------------------------------------------------------------ sub selectInstallClass { my ($clicked, $ent_number, $auto) = @_; installStepsCall($o, $auto, 'selectInstallClass', $clicked); if ($o->{steps}{choosePackages}{entered} >= 1 && !$o->{steps}{installPackages}{done}) { installStepsCall($o, $auto, 'setPackages'); installStepsCall($o, $auto, 'selectPackagesToUpgrade') if $o->{isUpgrade}; } if ($o->{isUpgrade}) { @{$o->{orderedSteps}} = map { /setupSCSI/ ? ($_, "doPartitionDisks") : $_ } grep { !/doPartitionDisks/ } @{$o->{orderedSteps}}; my $s; foreach (@{$o->{orderedSteps}}) { $s->{next} = $_ if $s; $s = $o->{steps}{$_}; } } } #------------------------------------------------------------------------------ sub doPartitionDisks { my ($clicked, $ent_number, $auto) = @_; $o->{steps}{formatPartitions}{done} = 0; installStepsCall($o, $auto, 'doPartitionDisksBefore'); installStepsCall($o, $auto, 'doPartitionDisks'); installStepsCall($o, $auto, 'doPartitionDisksAfter'); } sub formatPartitions { my ($clicked, $ent_number, $auto) = @_; $o->{steps}{choosePackages}{done} = 0; installStepsCall($o, $auto, 'choosePartitionsToFormat', $o->{fstab}) if !$o->{isUpgrade}; installStepsCall($o, $auto, 'formatMountPartitions', $o->{fstab}) if !$::testing; mkdir "$o->{prefix}/$_", 0755 foreach qw(dev etc etc/profile.d etc/rpm etc/sysconfig etc/sysconfig/console etc/sysconfig/network-scripts etc/sysconfig/console/consolefonts etc/sysconfig/console/consoletrans home mnt tmp var var/tmp var/lib var/lib/rpm var/lib/urpmi); mkdir "$o->{prefix}/$_", 0700 foreach qw(root root/tmp); any::rotate_logs($o->{prefix}); require raid; raid::prepare_prefixed($o->{all_hds}{raids}, $o->{prefix}); } #------------------------------------------------------------------------------ sub choosePackages { my ($clicked, $ent_number, $auto) = @_; require pkgs; #- always setPackages as it may have to copy hdlist files and depslist file. installStepsCall($o, $auto, 'setPackages'); installStepsCall($o, $auto, 'selectPackagesToUpgrade') if $o->{isUpgrade} && $ent_number == 1; installStepsCall($o, $auto, 'choosePackages', $o->{packages}, $o->{compssUsers}, $ent_number == 1); log::l("compssUsersChoice's: ", join(" ", grep { $o->{compssUsersChoice}{$_} } keys %{$o->{compssUsersChoice}})); #- check pre-condition where base backage has to be selected. pkgs::packageFlagSelected(pkgs::packageByName($o->{packages}, 'basesystem')) or die "basesystem package not selected"; #- check if there are package that need installation. $o->{steps}{installPackages}{done} = 0 if $o->{steps}{installPackages}{done} && pkgs::packagesToInstall($o->{packages}) > 0; } #------------------------------------------------------------------------------ sub installPackages { my ($clicked, $ent_number, $auto) = @_; installStepsCall($o, $au* Elsensee/ticket/8228: [ticket/8228] Fix still existing problems with code in firefox [ticket/8228] Fix whitespaces before code in Firefox