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, 60 insertions, 39 deletions
diff --git a/perl-install/install/steps.pm b/perl-install/install/steps.pm
index ca9281822..96b40b314 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;
@@ -176,9 +176,10 @@ sub selectInstallClass {
#------------------------------------------------------------------------------
sub doPartitionDisksBefore {
my ($o) = @_;
+ log::l("fdisk before:\n" . `fdisk -l`);
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,6 +191,7 @@ sub doPartitionDisksAfter {
my ($o) = @_;
fs::any::write_hds($o->{all_hds}, $o->{fstab}, !$o->{isUpgrade}, sub { $o->rebootNeeded }, $o);
+ log::l("fdisk after\n" . `fdisk -l`);
if ($::local_install) {
my $p = fs::get::mntpoint2part($::prefix, [ fs::read_fstab('', '/proc/mounts') ]);
@@ -258,6 +260,9 @@ sub selectSupplMedia { '' }
sub choosePackages {
my ($o, $o_compssListLevel) = @_;
+ #- clear the mirror cache before upgrading:
+ eval { rm_rf("$::prefix/var/cache/urpmi/mirrors.cache") };
+
#- now for upgrade, package that must be upgraded are
#- selected first, after is used the same scheme as install.
@@ -274,12 +279,9 @@ sub choosePackages {
$availableCorrected;
}
-sub upgrading_redhat() {
- #- remove weird config files that bother Xconfig::* too much
- unlink "$::prefix/etc/X11/XF86Config";
- unlink "$::prefix/etc/X11/XF86Config-4";
+sub live_patch_URPM() {
- sub prefering_mdv {
+ sub prefering_mga {
my ($lpkg, $rpkg_ver, $c) = @_;
my $lpkg_ver = $lpkg->version . '-' . $lpkg->release;
log::l($lpkg->name . ' ' . ': prefering ' . ($c == 1 ? "$lpkg_ver over $rpkg_ver" : "$rpkg_ver over $lpkg_ver"));
@@ -289,9 +291,9 @@ sub upgrading_redhat() {
undef *URPM::Package::compare_pkg;
*URPM::Package::compare_pkg = sub {
my ($lpkg, $rpkg) = @_;
- my $c = ($lpkg->release =~ /mdv|mnb|mga/ ? 1 : 0) - ($rpkg->release =~ /mdv|mnb|mga/ ? 1 : 0);
+ my $c = ($lpkg->release =~ /mga/ ? 1 : 0) - ($rpkg->release =~ /mga/ ? 1 : 0);
if ($c) {
- prefering_mdv($lpkg, $rpkg->version . '-' . $rpkg->release, $c);
+ prefering_mga($lpkg, $rpkg->version . '-' . $rpkg->release, $c);
$c;
} else {
&$old_compare_pkg;
@@ -302,15 +304,21 @@ sub upgrading_redhat() {
undef *URPM::Package::compare;
*URPM::Package::compare = sub {
my ($lpkg, $rpkg_ver) = @_;
- my $c = ($lpkg->release =~ /mdv|mnb|mga/ ? 1 : 0) - ($rpkg_ver =~ /mdv|mnb|mga/ ? 1 : 0);
+ my $c = ($lpkg->release =~ /mga/ ? 1 : 0) - ($rpkg_ver =~ /mga/ ? 1 : 0);
if ($c) {
- prefering_mdv($lpkg, $rpkg_ver, $c);
+ prefering_mga($lpkg, $rpkg_ver, $c);
return $c;
}
&$old_compare;
};
}
+sub upgrading_redhat() {
+ #- remove weird config files that bother Xconfig::* too much
+ unlink "$::prefix/etc/X11/XF86Config";
+ unlink "$::prefix/etc/X11/XF86Config-4";
+}
+
sub beforeInstallPackages {
my ($o) = @_;
@@ -318,10 +326,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/$_") {
@@ -331,6 +337,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
@@ -342,6 +356,8 @@ sub beforeInstallPackages {
);
rm_rf(@to_remove);
+ live_patch_URPM() if $o->{isUpgrade} !~ /mageia/;
+
if ($o->{isUpgrade} eq 'redhat') {
upgrading_redhat();
}
@@ -355,18 +371,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}");
@@ -417,6 +432,7 @@ 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;
@@ -424,13 +440,14 @@ sub installPackages {
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.
}
@@ -445,7 +462,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.
@@ -468,7 +485,7 @@ Consoles 1,3,4,7 may also contain interesting information";
harddrake::autoconf::cpufreq();
harddrake::autoconf::floppy();
- #- for mageia_firstime
+ #- for mandrake_firstime
touch "$::prefix/var/lock/TMP_1ST";
fs::any::set_cdrom_symlink($o->{all_hds}{raw_hds});
@@ -478,11 +495,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");
@@ -630,7 +642,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
@@ -678,7 +691,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});
@@ -726,7 +746,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 == ();
@@ -745,8 +765,9 @@ sub read_bootloader_config {
sub setupBootloaderBefore {
my ($o) = @_;
+ my $bool = $o->{meta_class} ne 'server';
any::setupBootloaderBefore($o->do_pkgs, $o->{bootloader}, $o->{all_hds}, $o->{fstab}, $o->{keyboard},
- $o->{allowFB}, $o->{vga}, $o->{meta_class} ne 'server');
+ $o->{allowFB}, $o->{vga}, $bool, $bool);
}
sub setupBootloader {
@@ -804,7 +825,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';
}
@@ -824,18 +845,18 @@ 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 { output "$::prefix/root/drakx/README", "This directory contains several installation-related files,
+ 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!).
Beware that some %s tools rely on the contents of some
of these files... so remove any file from here at your own
risk!
-" };
+", "Mageia") };
#- wait for remaining processes.
foreach (@{$o->{waitpids}}) {
waitpid $_, 0;