summaryrefslogtreecommitdiffstats
path: root/perl-install/install/steps.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/install/steps.pm')
-rw-r--r--perl-install/install/steps.pm99
1 files changed, 64 insertions, 35 deletions
diff --git a/perl-install/install/steps.pm b/perl-install/install/steps.pm
index c9d2dde5c..0319a6575 100644
--- a/perl-install/install/steps.pm
+++ b/perl-install/install/steps.pm
@@ -1,4 +1,4 @@
-package install::steps; # $Id: steps.pm 268013 2010-04-29 15:02:04Z pterjan $
+package install::steps;
use diagnostics;
use strict;
@@ -126,7 +126,13 @@ sub selectLanguage {
$o->charsetChanged;
addToBeDone {
- lang::write_langs($o->{locale}{langs});
+ if ($o->{isUpgrade}) {
+ #- preserve existing locale settings (mga#24671)
+ $o->{locale} = lang::read();
+ $o->{locale}{langs}{$o->{locale}{lang}} = 1;
+ } else {
+ lang::write_langs($o->{locale}{langs});
+ }
} 'formatPartitions';
addToBeDone {
lang::write_and_install($o->{locale}, $o->do_pkgs);
@@ -176,9 +182,10 @@ sub selectInstallClass {
#------------------------------------------------------------------------------
sub doPartitionDisksBefore {
my ($o) = @_;
+ log::l("fdisk before:\n" . any::fdisk());
eval {
+ eval { fs::mount::umount("$::prefix/sys/kernel/debug/usb") };
eval { fs::mount::umount("$::prefix/sys") };
- eval { fs::mount::umount("$::prefix/proc/bus/usb") };
eval { fs::mount::umount("$::prefix/proc") };
eval { fs::mount::umount_all($o->{fstab}) };
eval { sleep 1; fs::mount::umount_all($o->{fstab}) } if $@; #- HACK
@@ -190,16 +197,19 @@ sub doPartitionDisksAfter {
my ($o) = @_;
fs::any::write_hds($o->{all_hds}, $o->{fstab}, !$o->{isUpgrade}, sub { $o->rebootNeeded }, $o);
+ log::l("fdisk after\n" . any::fdisk());
if ($::local_install) {
- my $p = fs::get::mntpoint2part($::prefix, [ fs::read_fstab('', '/proc/mounts') ]);
- my $part = find { fs::get::is_same_hd($p, $_) } @{$o->{fstab}};
- $part ||= $o->{fstab}[0];
+ #- We skipped the setupSCSI step, so $o->{fstab} will be empty. We need to
+ #- add a fake entry, to satisfy the following check for a root partition.
+ my $fstab = [ fs::read_fstab('', '/proc/mounts') ];
+ my $part = fs::get::mntpoint2part($::prefix, $fstab) || $fstab->[0];
$part->{mntpoint} = '/';
$part->{isMounted} = 1;
+ $o->{fstab} = [ $part ];
}
- fs::any::check_hds_boot_and_root($o->{all_hds}, $o->{fstab});
+ fs::any::check_hds_boot_and_root($o->{all_hds}, $o->{fstab}, $o->{isUpgrade}, $o->{match_all_hardware});
if ($o->{partitioning}{use_existing_root}) {
#- ensure those partitions are mounted so that they are not proposed in choosePartitionsToFormat
@@ -324,10 +334,8 @@ sub beforeInstallPackages {
if ($o->{isUpgrade}) {
$o->{modules_conf}->merge_into(modules::any_conf->read);
- }
- #- save these files in case of upgrade failure.
- if ($o->{isUpgrade}) {
+ #- save these files in case of upgrade failure.
foreach (@filesToSaveForUpgrade) {
unlink "$::prefix/$_.mdkgisave";
if (-e "$::prefix/$_") {
@@ -337,6 +345,14 @@ sub beforeInstallPackages {
foreach (@filesNewerToUseAfterUpgrade) {
unlink "$::prefix/$_.rpmnew";
}
+
+ log::l("converting filesystem for usrmove");
+ if (!run_program::run('/usr/lib/dracut/modules.d/30convertfs/convertfs.sh', $::prefix)) {
+ mkdir_p("$::prefix/root/drakx") if ! -d "$::prefix/root/drakx";
+ # logs are only copied to $::prefix/root/drakx at the end of each step, so do it manually now
+ eval { cp_af("/tmp/ddebug.log", "$::prefix/root/drakx") };
+ die "Unable to convert filesystem prior to upgrade. Check ddebug.log for details";
+ }
}
#- mainly for upgrading redhat packages, but it can help other
@@ -363,18 +379,17 @@ sub beforeInstallPackages {
#- some packages need such files for proper installation.
install::any::write_fstab($o);
- require network::network;
- network::network::add2hosts("localhost", "127.0.0.1");
-
#- resolv.conf will be modified at boot time
#- the following will ensure we have a working DNS during install
if (-e "/etc/resolv.conf" && ! -e "$::prefix/etc/resolv.conf") {
cp_af("/etc/resolv.conf", "$::prefix/etc");
}
- if (-e '/tmp/.X11-unix') {
- mkdir "$::prefix/tmp/.X11-unix";
- run_program::run('mount', '--bind', '/tmp/.X11-unix', "$::prefix/tmp/.X11-unix");
+ foreach ('/run', '/tmp/.X11-unix') {
+ if (-e $_) {
+ mkdir "$::prefix/$_";
+ run_program::run('mount', '--bind', $_, "$::prefix/$_");
+ }
}
log::l("setting excludedocs to $o->{excludedocs}");
@@ -425,20 +440,23 @@ sub installPackages {
#- small transaction will be built based on this selection and depslist.
my @toInstall = install::pkgs::packagesToInstall($packages);
+ my $exit_code;
my $time = time();
{
local $ENV{DURING_INSTALL} = 1;
+ local $ENV{LOCAL_INSTALL} = 1 if $::local_install;
local $ENV{TMPDIR} = '/tmp';
local $ENV{TMP} = '/tmp';
local $ENV{HOME};
local $packages->{options}{auto} = !$o_interactive;
- install::pkgs::install($o->{isUpgrade}, \@toInstall, $packages, \&installCallback);
+ $exit_code = install::pkgs::install($o->{isUpgrade}, \@toInstall, $packages, \&installCallback);
}
any::writeandclean_ldsoconf($::prefix);
- run_program::rooted_or_die($::prefix, 'ldconfig');
-
log::l("Install took: ", formatTimeRaw(time() - $time));
+ run_program::rooted_or_die($::prefix, 'ldconfig') if !$o->{justdb};
+
+ $exit_code and die "Installation failed";
install::media::log_sizes();
scalar(@toInstall); #- return number of packages installed.
}
@@ -453,7 +471,7 @@ Either your cdrom drive or your cdrom is defective.
Check the cdrom on an installed computer using \"rpm -qpl media/main/*.rpm\"
") if any { m|read failed: Input/output error| } cat_("$::prefix/root/drakx/install.log");
- if (arch() !~ /^sparc/) { #- TODO restore it as may be needed for sparc
+ if (!$o->{justdb}) {
-x "$::prefix/usr/bin/dumpkeys" or $::testing or die
"Some important packages did not get installed properly.
@@ -476,7 +494,15 @@ Consoles 1,3,4,7 may also contain interesting information";
harddrake::autoconf::cpufreq();
harddrake::autoconf::floppy();
- #- for mageia_firstime
+ # prevent slow boot on first boot:
+ my $cfg_file = "$::prefix/etc/sysconfig/harddrake2/kernel";
+ if (-f $cfg_file) {
+ my %kernel_config = getVarsFromSh($cfg_file);
+ $kernel_config{IS_LAPTOP} = bool2text(detect_devices::isLaptop());
+ setVarsInSh($cfg_file, \%kernel_config);
+ }
+
+ #- for mandrake_firstime
touch "$::prefix/var/lock/TMP_1ST";
fs::any::set_cdrom_symlink($o->{all_hds}{raw_hds});
@@ -486,11 +512,6 @@ Consoles 1,3,4,7 may also contain interesting information";
#- else if eth0 is not existing, glibc segfaults.
substInFile { s/\s*wins// if /^\s*hosts\s*:/ } "$::prefix/etc/nsswitch.conf";
- #- make sure some services have been enabled (or a catastrophic restart will occur).
- #- these are normally base package post install scripts or important services to start.
- run_program::rooted($::prefix, "chkconfig", "--add", $_) foreach
- qw(netfs network rawdevices sound kheader keytable syslog crond portmap);
-
if ($o->{mouse}{device} =~ /ttyS/) {
log::l("disabling gpm for serial mice (does not get along nicely with X)");
run_program::rooted($::prefix, "chkconfig", "--del", "gpm");
@@ -638,7 +659,8 @@ sub configureNetwork {
my ($o) = @_;
require network::network;
network::network::configure_network($o->{net}, $o, $o->{modules_conf});
- configure_firewall($o) if !$o->{isUpgrade};
+
+ configure_firewall($o) if !$o->{isUpgrade} && !$o->{justdb};
#- only a http proxy can be used by stage1
#- the method is http even for ftp connections through a http proxy
@@ -686,7 +708,14 @@ sub configureTimezone {
my ($o) = @_;
install::any::preConfigureTimezone($o);
- $o->pkg_install('ntp') if $o->{timezone}{ntp};
+ if ($o->{timezone}{ntp}) {
+ # We prefer chrony, but we'll deal with ntpd for the sake of upgrades
+ my $pkg = install::pkgs::packageByName($o->{packages}, 'chrony');
+ unless ($pkg && $pkg->flag_installed) {
+ $pkg = install::pkgs::packageByName($o->{packages}, 'ntp');
+ $o->pkg_install('chrony') unless $pkg && $pkg->flag_installed;
+ }
+ }
require timezone;
timezone::write($o->{timezone});
@@ -734,7 +763,7 @@ sub addUser {
$autologin->{user} = $o->{autologin};
$autologin->{desktop} = $o->{desktop} if $o->{desktop};
$autologin->{dm} = $o->{dm} if $o->{dm};
- any::set_autologin($o->do_pkgs, $autologin);
+ any::set_autologin($o->do_pkgs, $autologin, $o->{step}{auto});
}
install::any::disable_user_view() if @$users == ();
@@ -813,7 +842,7 @@ sub miscellaneousAfter {
addToBeDone {
addVarsInSh("$::prefix/etc/sysconfig/system", { META_CLASS => $o->{meta_class} });
- eval { install::any::set_security($o) };
+ eval { install::any::set_security($o) } if !$o->{isUpgrade};
} 'installPackages';
}
@@ -833,11 +862,11 @@ sub exitInstall {
my $report = '/root/drakx/report.bug';
unlink "$::prefix$report", "$::prefix$report.gz";
output "$::prefix$report", install::any::report_bug();
- run_program::rooted($::prefix, 'gzip', $report);
+ run_program::rooted($::prefix, 'xz', $report);
};
output("$::prefix/root/drakx/package_list.pl", install::any::selected_leaves_pl($o));
- eval { install::any::getAndSaveAutoInstallFloppies($o, 1) } if arch() !~ /^ppc/;
+ eval { install::any::getAndSaveAutoInstallFloppies($o, 1) };
eval { output "$::prefix/root/drakx/README", sprintf("This directory contains several installation-related files,
mostly log files (very useful if you ever report a bug!).
@@ -896,8 +925,8 @@ sub upNetwork {
start_network_interface($o);
return 1;
} elsif (!$b_pppAvoided) {
- log::l("starting network (ppp: $o->{net}{type})");
- eval { modules::load(qw(serial ppp bsd_comp ppp_deflate)) };
+ log::l("starting network (PPP: $o->{net}{type})");
+ eval { modules::load(qw(serial bsd_comp ppp_deflate)) };
run_program::rooted($::prefix, "/etc/rc.d/init.d/syslog", "start");
start_network_interface($o);
return 1;
@@ -921,7 +950,7 @@ sub downNetwork {
} elsif (!network_is_cheap($o)) {
stop_network_interface($o);
run_program::rooted($::prefix, "/etc/rc.d/init.d/syslog", "stop");
- eval { modules::unload(qw(ppp_deflate bsd_comp ppp serial)) };
+ eval { modules::unload(qw(ppp_deflate bsd_comp serial)) };
return 1;
}
}