summaryrefslogtreecommitdiffstats
path: root/perl-install/install_any.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/install_any.pm')
-rw-r--r--perl-install/install_any.pm708
1 files changed, 503 insertions, 205 deletions
diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm
index e768c1b06..2ac679a16 100644
--- a/perl-install/install_any.pm
+++ b/perl-install/install_any.pm
@@ -16,8 +16,8 @@ use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK $boot_medium $current_medium $asked_med
use MDK::Common::System;
use common;
use run_program;
-use partition_table qw(:types);
-use partition_table::raw;
+use fs::type;
+use partition_table;
use devices;
use fsedit;
use modules;
@@ -25,13 +25,14 @@ use detect_devices;
use lang;
use any;
use log;
-use fs;
#- boot medium (the first medium to take into account).
$boot_medium = 1;
$current_medium = $boot_medium;
$asked_medium = $boot_medium;
+our $global_ftp_prefix;
+
#-######################################################################################
#- Media change variables&functions
#-######################################################################################
@@ -54,8 +55,8 @@ sub useMedium($) {
$asked_medium = $_[0];
}
sub changeMedium($$) {
- my ($method, $medium) = @_;
- log::l("change to medium $medium for method $method (refused by default)");
+ my ($method, $medium_name) = @_;
+ log::l("change to medium $medium_name for method $method (refused by default)");
0;
}
sub relGetFile($) {
@@ -63,17 +64,18 @@ sub relGetFile($) {
if (my ($arch) = m|\.([^\.]*)\.rpm$|) {
$_ = "$::o->{packages}{mediums}{$asked_medium}{rpmsdir}/$_";
s/%{ARCH}/$arch/g;
+ s,^/+,,g;
}
$_;
}
sub askChangeMedium($$) {
- my ($method, $medium) = @_;
+ my ($method, $medium_name) = @_;
my $allow;
do {
- local $::o->{method} = $method = 'cdrom' if $medium =~ /^\d+s$/; #- Suppl CD
- eval { $allow = changeMedium($method, $medium) };
+ local $::o->{method} = $method = 'cdrom' if $medium_name =~ /^\d+s$/; #- Suppl CD
+ eval { $allow = changeMedium($method, $medium_name) };
} while $@; #- really it is not allowed to die in changeMedium!!! or install will cores with rpmlib!!!
- log::l($allow ? "accepting medium $medium" : "refusing medium $medium");
+ log::l($allow ? "accepting medium $medium_name" : "refusing medium $medium_name");
$allow;
}
@@ -94,7 +96,8 @@ sub look_for_ISO_images() {
my $get_iso_ids = sub {
my ($F) = @_;
my ($vol_id, $app_id) = c::get_iso_volume_ids(fileno $F);
- my ($cd_set) = $vol_id =~ /^(.*)-[0-9]+$/;
+ #- the ISO volume names must end in -Disc\d+
+ my ($cd_set) = $vol_id =~ /^(.*)-Disc\d+$/;
$cd_set && { cd_set => $cd_set, app_id => $app_id };
};
@@ -103,7 +106,7 @@ sub look_for_ISO_images() {
my $iso_dir = $ENV{ISOPATH};
#- strip old root and remove iso file from path if present
- $iso_dir =~ s!^/sysroot!!; $iso_dir =~ s![^/]*.iso$!!;
+ $iso_dir =~ s!^/sysroot!!; $iso_dir =~ s![^/]*\.iso$!!;
foreach my $iso_file (glob("$iso_dir/*.iso")) {
my $iso_dev = devices::set_loop($iso_file) or return;
@@ -143,25 +146,27 @@ sub errorOpeningFile($) {
my ($file) = @_;
$file eq 'XXX' and return; #- special case to force closing file after rpmlib transaction.
$current_medium eq $asked_medium and log::l("errorOpeningFile $file"), return; #- nothing to do in such case.
- $::o->{packages}{mediums}{$asked_medium}{selected} or return; #- not selected means no need for worying about.
+ $::o->{packages}{mediums}{$asked_medium}{selected} or return; #- not selected means no need to worry about.
+ my $current_method = $::o->{packages}{mediums}{$asked_medium}{method} || $::o->{method};
my $max = 32; #- always refuse after $max tries.
- if ($::o->{method} eq "cdrom") {
- cat_("/proc/mounts") =~ m,(/(?:dev|tmp)/\S+)\s+(?:/mnt/cdrom|/tmp/image), and $cdrom = $1;
+ if ($current_method eq "cdrom") {
+ cat_("/proc/mounts") =~ m,(/(?:dev|tmp)/\S+)\s+(/mnt/cdrom|/tmp/image),
+ and ($cdrom, my $mountpoint) = ($1, $2);
return unless $cdrom;
- ejectCdrom($cdrom);
- while ($max > 0 && askChangeMedium($::o->{method}, $asked_medium)) {
+ ejectCdrom($cdrom, $mountpoint);
+ while ($max > 0 && askChangeMedium($current_method, $asked_medium)) {
$current_medium = $asked_medium;
mountCdrom("/tmp/image");
my $getFile = getFile($file);
$getFile && @advertising_images and copy_advertising($::o);
$getFile and return $getFile;
$current_medium = 'unknown'; #- don't know what CD is inserted now.
- ejectCdrom($cdrom);
+ ejectCdrom($cdrom, $mountpoint);
--$max;
}
} else {
- while ($max > 0 && askChangeMedium($::o->{method}, $asked_medium)) {
+ while ($max > 0 && askChangeMedium($current_method, $asked_medium)) {
$current_medium = $asked_medium;
my $getFile = getFile($file); $getFile and return $getFile;
$current_medium = 'unknown'; #- don't know what CD image has been copied.
@@ -177,14 +182,15 @@ sub errorOpeningFile($) {
$::o->{packages}{mediums}{$asked_medium}{selected} = undef;
#- on cancel, we can expect the current medium to be undefined too,
- #- this enable remounting if selecting a package back.
+ #- this enables remounting if selecting a package back.
$current_medium = 'unknown';
return;
}
sub getFile {
my ($f, $o_method, $o_altroot) = @_;
- log::l("getFile $f:$o_method");
+ my $current_method = ($asked_medium ? $::o->{packages}{mediums}{$asked_medium}{method} : '') || $::o->{method};
+ log::l("getFile $f:$o_method ($asked_medium:$current_method)");
my $rel = relGetFile($f);
do {
if ($f =~ m|^http://|) {
@@ -193,26 +199,26 @@ sub getFile {
} elsif ($o_method =~ /crypto|update/i) {
require crypto;
crypto::getFile($f);
- } elsif ($::o->{method} eq "ftp") {
+ } elsif ($current_method eq "ftp") {
require ftp;
- ftp::getFile($rel);
- } elsif ($::o->{method} eq "http") {
+ ftp::getFile($rel, @{ $::o->{packages}{mediums}{$asked_medium}{ftp_prefix} || $global_ftp_prefix || [] });
+ } elsif ($current_method eq "http") {
require http;
- http::getFile("$ENV{URLPREFIX}/$rel");
+ http::getFile(($ENV{URLPREFIX} || $o_altroot) . "/$rel");
} else {
#- try to open the file, but examine if it is present in the repository,
#- this allows handling changing a media when some of the files on the
#- first CD have been copied to other to avoid media change...
my $f2 = "$postinstall_rpms/$f";
$o_altroot ||= '/tmp/image';
- $f2 = "$o_altroot/$rel" if !$postinstall_rpms || !-e $f2;
- $f2 = $rel if $rel =~ m!^/! && !-e $f2; #- not a relative path
- my $F; open($F, $f2) && $F;
+ $f2 = "$o_altroot/$rel" if $rel !~ m,^/, && (!$postinstall_rpms || !-e $f2);
+ #- $f2 = "/$rel" if !$::o->{packages}{mediums}{$asked_medium}{rpmsdir} && !-e $f2; #- not a relative path, should not be necessary with new media layout
+ my $F; open($F, $f2) ? $F : do { $f2 !~ /XXX/ and log::l("Can't open $f2: $!"); undef }
}
} || errorOpeningFile($f);
}
sub getAndSaveFile {
- my ($file, $local) = @_ == 1 ? ("Mandrake/mdkinst$_[0]", $_[0]) : @_;
+ my ($file, $local) = @_ == 1 ? ("install/stage2/live$_[0]", $_[0]) : @_;
local $/ = \ (16 * 1024);
my $f = ref($file) ? $file : getFile($file) or return;
open(my $F, ">$local") or log::l("getAndSaveFile(opening $local): $!"), return;
@@ -358,58 +364,250 @@ sub preConfigureTimezone {
add2hash_($o->{timezone}, { UTC => $utc, ntp => $ntp });
}
-sub setPackages {
- my ($o, $rebuild_needed) = @_;
+sub deselectFoundMedia {
+ #- group by CD
+ my ($o, $hdlists) = @_;
+ my %cdlist;
+ my @hdlist2;
+ my @corresp;
+ my $i = 0;
+ foreach (@$hdlists) {
+ (my $cd) = $_->[3] =~ /\bCD ?(\d+)\b/;
+ if (!$cd || !@{$cdlist{$cd} || []}) {
+ push @hdlist2, $_;
+ $corresp[$i] = [ $i ];
+ } else {
+ $corresp[$i] = [];
+ push @{$corresp[$cdlist{$cd}[0]]}, $i;
+ }
+ if ($cd) {
+ $cdlist{$1} ||= [];
+ push @{$cdlist{$1}}, $i;
+ }
+ ++$i;
+ }
+ my $l = $o->ask_many_from_list('',
+N("The following installation media have been found.
+If you want to skip some of them, you can unselect them now."),
+ {
+ list => \@hdlist2,
+ value => sub { 1 },
+ label => sub { $_[0][3] },
+ },
+ );
+ my @l2; $i = 0;
+ foreach my $c (@$l) {
+ ++$i while $hdlists->[$i][3] ne $c->[3];
+ push @l2, $hdlists->[$_] foreach @{$corresp[$i]};
+ }
+ log::l("keeping media " . join ',', map { $_->[1] } @l2);
+ @l2;
+}
- require pkgs;
- if (!$o->{packages} || is_empty_array_ref($o->{packages}{depslist})) {
- my $cdrom;
- ($o->{packages}, my $suppl_CDs) = pkgs::psUsingHdlists($o->{prefix}, $o->{method});
-
- #- ask whether there are supplementary CDs
- SUPPL: {
- if ($suppl_CDs && !$o->{isUpgrade}
- && $o->ask_yesorno('', N("Do you have a supplementary CD to install?"), 0))
- {
- #- by convention, the media names for suppl. CDs match /^\d+s$/
- my $medium = '1s'; #- supplement 1
- local $::isWizard = 0;
- local $o->{method} = 'cdrom';
- (my $cdromdev) = detect_devices::cdroms();
- last SUPPL if !$cdromdev;
- $cdrom = $cdromdev->{device};
- devices::make($cdrom);
- ejectCdrom($cdrom);
- if ($o->ask_okcancel('', N("Insert the CD"), 1)) {
- mountCdrom("/mnt/cdrom", $cdrom);
+sub ask_if_suppl_media {
+ my ($o) = @_;
+ our $suppl_already_asked;
+ my $msg = $suppl_already_asked
+ ? N("Do you have further supplementary media?")
+ : formatAlaTeX(
+#-PO: keep the double empty lines between sections, this is formatted a la LaTeX
+ N("The following media have been found and will be used during install: %s.
+
+
+Do you have a supplementary installation media to configure?",
+ join ", ", uniq(map { $_->{descr} } values %{$o->{packages}{mediums}})));
+ my $suppl = $o->ask_from_list_(
+ '', $msg, [ N_("None"), N_("CD-ROM"), N_("Network (http)"), N_("Network (ftp)") ], 'None'
+ );
+ $suppl_already_asked = 1;
+ return $suppl;
+}
+
+#- if the supplementary media is networked, but not the main one, network
+#- support must be installed and network started.
+sub prep_net_suppl_media {
+ return if our $net_suppl_media_configured;
+ $net_suppl_media_configured = 1;
+ my ($o) = @_;
+ #- install basesystem now
+ $::o->do_pkgs->ensure_is_installed('basesystem', undef, 1);
+ #- from install_steps_interactive:
+ local $::expert = $::expert;
+ require network::netconnect;
+ network::netconnect::main($o->{prefix}, $o->{netcnx} ||= {}, $o, $o->{modules_conf}, $o->{netc}, $o->{mouse}, $o->{intf}, 0, 1);
+ require install_interactive;
+ install_interactive::upNetwork($o);
+ sleep(3);
+}
+
+sub selectSupplMedia {
+ my ($o, $suppl_method) = @_;
+ #- ask whether there are supplementary media
+ my $prev_asked_medium = $asked_medium;
+ if ($suppl_method && (my $suppl = ask_if_suppl_media($o)) ne 'None') {
+ #- translate to method name
+ $suppl_method = {
+ 'CD-ROM' => 'cdrom',
+ 'Network (http)' => 'http',
+ 'Network (ftp)' => 'ftp',
+ }->{$suppl};
+ #- by convention, the media names for suppl. CDs match /^\d+s$/
+ my $medium_name = $suppl_method eq 'cdrom'
+ ? (max(map { $_->{medium} =~ /^(\d+)s$/ ? $1 : 0 } values %{$o->{packages}{mediums}}) + 1) . "s"
+ : int(keys %{$o->{packages}{mediums}}) + 1;
+ #- configure network if needed
+ prep_net_suppl_media($o) if !scalar keys %{$o->{intf}} && $suppl_method !~ /^(?:cdrom|disk)/;
+ local $::isWizard = 0;
+ my $main_method = $o->{method};
+ local $o->{method} = $suppl_method;
+ if ($suppl_method eq 'cdrom') {
+ (my $cdromdev) = detect_devices::cdroms();
+ $o->ask_warn('', N("No device found")), return 'error' if !$cdromdev;
+ $cdrom = $cdromdev->{device};
+ devices::make($cdrom);
+ ejectCdrom($cdrom);
+ if ($o->ask_okcancel('', N("Insert the CD"), 1)) {
+ #- mount suppl CD in /mnt/cdrom to avoid umounting /tmp/image
+ mountCdrom("/mnt/cdrom", $cdrom);
+ log::l($@) if $@;
+ useMedium($medium_name);
+
+ #- probe for an hdlists file and then look for all hdlists listed herein
+ eval { pkgs::psUsingHdlists($o, $suppl_method, "/mnt/cdrom", $o->{packages}, $medium_name) };
+ log::l("psUsingHdlists failed: $@") if $@;
+
+ #- copy latest compssUsers.pl and rpmsrate somewhere locally
+ getAndSaveFile("/mnt/cdrom/media/media_info/compssUsers.pl", "/tmp/compssUsers.pl");
+ getAndSaveFile("/mnt/cdrom/media/media_info/rpmsrate", "/tmp/rpmsrate");
+
+ #- umount supplementary CD. Will re-ask for it later
+ getFile("XXX"); #- close still opened filehandles
+ log::l("Umounting suppl. CD, back to medium 1");
+ eval { fs::umount("/mnt/cdrom") };
+ #- re-mount CD 1 if this was a cdrom install
+ if ($main_method eq 'cdrom') {
+ eval {
+ my $dev = detect_devices::tryOpen($cdrom);
+ ioctl($dev, c::CDROMEJECT(), 1);
+ };
+ $o->ask_warn('', N("Insert the CD 1 again"));
+ mountCdrom("/tmp/image", $cdrom);
log::l($@) if $@;
- useMedium($medium);
- my $supplmedium = pkgs::psUsingHdlist(
- $o->{prefix}, # /mnt
- 'cdrom',
- $o->{packages},
- "hdlist$medium.cz",
- $medium,
- 'Mandrake/RPMS',
- "Supplementary CD $medium",
- 1, # selected
- "/mnt/cdrom/Mandrake/base/hdlist$medium.cz",
- );
- if ($supplmedium) {
- log::l("read suppl hdlist");
- $supplmedium->{prefix} = "removable://mnt/cdrom"; #- pour install_urpmi
- $supplmedium->{selected} = 1;
- $supplmedium->{method} = 'cdrom';
- } else {
- log::l("no suppl hdlist");
- }
- #- TODO loop if there are several supplementary CDs
- # ++$medium; $medium .= "s";
+ $asked_medium = 1;
}
+ }
+ } else {
+ my $url;
+ local $global_ftp_prefix;
+ if ($suppl_method eq 'ftp') { #- mirrors are ftp only (currently)
+ $url = $o->askSupplMirror(N("URL of the mirror?")) or return 'error';
+ $url =~ m!^ftp://(?:(.*?)(?::(.*?))?@)?([^/]+)/(.*)!
+ and $global_ftp_prefix = [ $3, $4, $1, $2 ]; #- for getFile
} else {
- $suppl_CDs = 0;
+ $url = $o->ask_from_entry('', N("URL of the mirror?")) or return 'error';
+ $url =~ s!/+\z!!;
+ }
+ useMedium($medium_name);
+ require http if $suppl_method eq 'http';
+ require ftp if $suppl_method eq 'ftp';
+ #- first, try to find an hdlists file
+ eval { pkgs::psUsingHdlists($o, $suppl_method, $url, $o->{packages}, $medium_name, \&setup_suppl_medium) };
+ if ($@) {
+ log::l("psUsingHdlists failed: $@");
+ } else {
+ #- copy latest compssUsers.pl and rpmsrate somewhere locally
+ if ($suppl_method eq 'ftp') {
+ getAndSaveFile("media/media_info/compssUsers.pl", "/tmp/compssUsers.pl");
+ getAndSaveFile("media/media_info/rpmsrate", "/tmp/rpmsrate");
+ } else {
+ getAndSaveFile("$url/media/media_info/compssUsers.pl", "/tmp/compssUsers.pl");
+ getAndSaveFile("$url/media/media_info/rpmsrate", "/tmp/rpmsrate");
+ }
+ useMedium($prev_asked_medium); #- back to main medium
+ return $suppl_method;
+ }
+ #- then probe for an hdlist.cz
+ my $f = eval {
+ if ($suppl_method eq 'http') {
+ http::getFile("$url/media_info/hdlist.cz");
+ } elsif ($suppl_method eq 'ftp') {
+ getFile("media_info/hdlist.cz");
+ } else { undef }
+ };
+ if (!defined $f) {
+ log::l($@) if $@;
+ $o->ask_warn('', N("Can't find hdlist file on this mirror"));
+ useMedium($prev_asked_medium);
+ return 'error';
+ }
+ my $supplmedium = pkgs::psUsingHdlist(
+ $o->{prefix},
+ $suppl_method,
+ $o->{packages},
+ "hdlist$medium_name.cz", #- hdlist
+ $medium_name,
+ '', #- rpmsdir
+ "Supplementary media $medium_name", #- description
+ 1, # selected
+ $f,
+ );
+ close $f;
+ if ($supplmedium) {
+ log::l("read suppl hdlist (via $suppl_method)");
+ setup_suppl_medium($supplmedium, $url, $suppl_method);
+ } else {
+ log::l("no suppl hdlist");
+ $suppl_method = 'error';
}
}
+ } else {
+ $suppl_method = '';
+ }
+ useMedium($prev_asked_medium); #- back to main medium
+ return $suppl_method;
+}
+
+sub setup_suppl_medium {
+ my ($supplmedium, $url, $suppl_method) = @_;
+ $supplmedium->{prefix} = $url; #- for install_urpmi
+ if ($suppl_method eq 'ftp') {
+ $url =~ m!^ftp://(?:(.*?)(?::(.*?))?@)?([^/]+)/(.*)!
+ and $supplmedium->{ftp_prefix} = [ $3, $4, $1, $2 ]; #- for getFile
+ }
+ $supplmedium->{selected} = 1;
+ $supplmedium->{method} = $suppl_method;
+ $supplmedium->{with_hdlist} = 'media_info/hdlist.cz'; #- for install_urpmi
+}
+
+sub _media_rank {
+ my ($x) = @_;
+ my ($y, $s) = $x =~ /(\d+)(s?)\)\.cz/;
+ $s and $y += 100;
+ $y;
+}
+
+sub load_rate_files {
+ my ($o) = @_;
+ #- must be done after getProvides
+ #- if there is a supplementary media, the rpmsrate/compssUsers are overridable
+ pkgs::read_rpmsrate(
+ $o->{packages},
+ getFile(-e "/tmp/rpmsrate" ? "/tmp/rpmsrate" : "media/media_info/rpmsrate")
+ );
+ ($o->{compssUsers}, $o->{gtk_display_compssUsers}) = pkgs::readCompssUsers(
+ $o->{meta_class},
+ -e '/tmp/compssUsers.pl' ? '/tmp/compssUsers.pl' : 'media/media_info/compssUsers.pl'
+ );
+}
+
+sub setPackages {
+ my ($o, $rebuild_needed) = @_;
+
+ require pkgs;
+ if (!$o->{packages} || is_empty_array_ref($o->{packages}{depslist})) {
+ ($o->{packages}, my $suppl_method) = pkgs::psUsingHdlists($o, $o->{method});
+
+ 1 while $suppl_method = $o->selectSupplMedia($suppl_method);
#- open rpm db according to right mode needed.
$o->{packages}{rpmdb} ||= pkgs::rpmDbOpen($o->{prefix}, $rebuild_needed);
@@ -422,37 +620,12 @@ sub setPackages {
pkgs::selectPackage($o->{packages},
pkgs::packageByName($o->{packages}, 'basesystem') || die("missing basesystem package"), 1);
- #- must be done after getProvides
- #- if there is a supplementary CD, override the rpmsrate/compssUsers
- pkgs::read_rpmsrate(
- $o->{packages},
- getFile($suppl_CDs ? "/mnt/cdrom/Mandrake/base/rpmsrate" : "Mandrake/base/rpmsrate")
- );
- ($o->{compssUsers}, $o->{compssUsersSorted}) = pkgs::readCompssUsers(
- $o->{meta_class},
- $suppl_CDs ? "/mnt/cdrom/Mandrake/base/compssUsers" : "",
- );
-
- #- preselect default_packages and compssUsersChoices.
+ load_rate_files($o);
+
+ #- preselect default_packages and compssUsers selected.
setDefaultPackages($o);
pkgs::selectPackage($o->{packages}, pkgs::packageByName($o->{packages}, $_) || next) foreach @{$o->{default_packages}};
- #- umount supplementary CD. Will re-ask for it later
- if ($suppl_CDs) {
- getFile("XXX"); #- close still opened filehandles
- log::l("Umounting suppl. CD");
- eval { fs::umount("/mnt/cdrom") };
- #- re-mount CD 1 if this was a cdrom install
- if ($o->{method} eq 'cdrom') {
- eval {
- my $dev = detect_devices::tryOpen($cdrom);
- ioctl($dev, c::CDROMEJECT(), 1);
- };
- $o->ask_warn('', N("Insert the CD 1 again"));
- mountCdrom("/tmp/image", $cdrom);
- $asked_medium = 1;
- }
- }
} else {
#- this has to be done to make sure necessary files for urpmi are
#- present.
@@ -467,72 +640,69 @@ sub setDefaultPackages {
my ($o, $b_clean) = @_;
if ($b_clean) {
- delete $o->{$_} foreach qw(default_packages compssUsersChoice); #- clean modified variables.
+ delete $o->{default_packages}; #- clean modified variables.
}
push @{$o->{default_packages}}, "brltty" if cat_("/proc/cmdline") =~ /brltty=/;
push @{$o->{default_packages}}, "nfs-utils-clients" if $o->{method} eq "nfs";
push @{$o->{default_packages}}, "numlock" if $o->{miscellaneous}{numlock};
- push @{$o->{default_packages}}, "raidtools" if !is_empty_array_ref($o->{all_hds}{raids});
+ push @{$o->{default_packages}}, "mdadm" if !is_empty_array_ref($o->{all_hds}{raids});
push @{$o->{default_packages}}, "lvm2" if !is_empty_array_ref($o->{all_hds}{lvms});
- push @{$o->{default_packages}}, "alsa", "alsa-utils" if any { modules::get_alias("sound-slot-$_") =~ /^snd-/ } 0 .. 4;
- push @{$o->{default_packages}}, "grub" if isLoopback(fsedit::get_root($o->{fstab}));
- push @{$o->{default_packages}}, uniq(grep { $_ } map { fsedit::package_needed_for_partition_type($_) } @{$o->{fstab}});
+ push @{$o->{default_packages}}, "alsa", "alsa-utils" if any { $o->{modules_conf}->get_alias("sound-slot-$_") =~ /^snd-/ } 0 .. 4;
+ push @{$o->{default_packages}}, "grub" if isLoopback(fs::get::root($o->{fstab}));
+ push @{$o->{default_packages}}, uniq(grep { $_ } map { fs::format::package_needed_for_partition_type($_) } @{$o->{fstab}});
#- if no cleaning needed, populate by default, clean is used for second or more call to this function.
unless ($b_clean) {
- if ($::auto_install && ($o->{compssUsersChoice} || {})->{ALL}) {
- $o->{compssUsersChoice}{$_} = 1 foreach map { @{$o->{compssUsers}{$_}{flags}} } @{$o->{compssUsersSorted}};
+ if ($::auto_install && ($o->{rpmsrate_flags_chosen} || {})->{ALL}) {
+ $o->{rpmsrate_flags_chosen}{$_} = 1 foreach map { @{$_->{flags}} } @{$o->{compssUsers}};
}
- if (!$o->{compssUsersChoice} && !$o->{isUpgrade}) {
+ if (!$o->{rpmsrate_flags_chosen} && !$o->{isUpgrade}) {
#- use default selection seen in compssUsers directly.
- foreach (keys %{$o->{compssUsers}}) {
- $o->{compssUsers}{$_}{selected} or next;
- log::l("looking for default selection on $_");
- member($o->{meta_class} || 'default', @{$o->{compssUsers}{$_}{selected}}) ||
- member('all', @{$o->{compssUsers}{$_}{selected}}) or next;
- log::l(" doing selection on $_");
- $o->{compssUsersChoice}{$_} = 1 foreach @{$o->{compssUsers}{$_}{flags}};
+ foreach (@{$o->{compssUsers}}) {
+ $_->{selected} = $_->{default_selected} or next;
+ $o->{rpmsrate_flags_chosen}{$_} = 1 foreach @{$_->{flags}};
}
}
}
- $o->{compssUsersChoice}{uc($_)} = 1 foreach grep { modules::probe_category("multimedia/$_") } modules::sub_categories('multimedia');
- $o->{compssUsersChoice}{uc($_)} = 1 foreach map { $_->{driver} =~ /Flag:(.*)/ } detect_devices::probeall();
- $o->{compssUsersChoice}{SYSTEM} = 1;
- $o->{compssUsersChoice}{DOCS} = !$o->{excludedocs};
- $o->{compssUsersChoice}{UTF8} = $o->{locale}{utf8};
- $o->{compssUsersChoice}{BURNER} = 1 if detect_devices::burners();
- $o->{compssUsersChoice}{DVD} = 1 if detect_devices::dvdroms();
- $o->{compssUsersChoice}{USB} = 1 if modules::get_probeall("usb-interface");
- $o->{compssUsersChoice}{PCMCIA} = 1 if detect_devices::hasPCMCIA();
- $o->{compssUsersChoice}{HIGH_SECURITY} = 1 if $o->{security} > 3;
- $o->{compssUsersChoice}{BIGMEM} = 1 if !$::oem && availableRamMB() > 800 && arch() !~ /ia64|x86_64/;
- $o->{compssUsersChoice}{SMP} = 1 if detect_devices::hasSMP();
- $o->{compssUsersChoice}{CDCOM} = 1 if any { $_->{descr} =~ /commercial/i } values %{$o->{packages}{mediums}};
- $o->{compssUsersChoice}{'3D'} = 1 if
- detect_devices::matching_desc('Matrox.* G[245][05]0') ||
- detect_devices::matching_desc('Rage X[CL]') ||
- detect_devices::matching_desc('3D Rage (?:LT|Pro)') ||
- detect_devices::matching_desc('Voodoo [35]') ||
- detect_devices::matching_desc('Voodoo Banshee') ||
- detect_devices::matching_desc('8281[05].* CGC') ||
- detect_devices::matching_desc('Rage 128') ||
- detect_devices::matching_desc('Radeon ') || #- all Radeon card are now 3D with 4.3.0
- detect_devices::matching_desc('[nN]Vidia.*T[nN]T2') || #- TNT2 cards
- detect_devices::matching_desc('[nN][vV]idia.*NV[56]') ||
- detect_devices::matching_desc('[nN][vV]idia.*Vanta') ||
- detect_devices::matching_desc('[nN][vV]idia.*[gG]e[fF]orce') || #- GeForce cards
- detect_devices::matching_desc('[nN][vV]idia.*NV1[15]') ||
- detect_devices::matching_desc('[nN][vV]idia.*Quadro');
+ $o->{rpmsrate_flags_chosen}{uc($_)} = 1 foreach grep { modules::probe_category("multimedia/$_") } modules::sub_categories('multimedia');
+ $o->{rpmsrate_flags_chosen}{uc($_)} = 1 foreach map { $_->{driver} =~ /Flag:(.*)/ } detect_devices::probeall();
+ $o->{rpmsrate_flags_chosen}{SYSTEM} = 1;
+ $o->{rpmsrate_flags_chosen}{DOCS} = !$o->{excludedocs};
+ $o->{rpmsrate_flags_chosen}{UTF8} = $o->{locale}{utf8};
+ $o->{rpmsrate_flags_chosen}{BURNER} = 1 if detect_devices::burners();
+ $o->{rpmsrate_flags_chosen}{DVD} = 1 if detect_devices::dvdroms();
+ $o->{rpmsrate_flags_chosen}{USB} = 1 if $o->{modules_conf}->get_probeall("usb-interface");
+ $o->{rpmsrate_flags_chosen}{PCMCIA} = 1 if detect_devices::hasPCMCIA();
+ $o->{rpmsrate_flags_chosen}{HIGH_SECURITY} = 1 if $o->{security} > 3;
+ $o->{rpmsrate_flags_chosen}{BIGMEM} = 1 if c::dmiDetectMemory() > 4 * 1024;
+ $o->{rpmsrate_flags_chosen}{SMP} = 1 if detect_devices::hasSMP();
+ $o->{rpmsrate_flags_chosen}{CDCOM} = 1 if any { $_->{descr} =~ /commercial/i } values %{$o->{packages}{mediums}};
+ $o->{rpmsrate_flags_chosen}{TV} = 1 if detect_devices::getTVcards();
+ $o->{rpmsrate_flags_chosen}{'3D'} = 1 if
+ detect_devices::matching_desc__regexp('Matrox.* G[245][05]0') ||
+ detect_devices::matching_desc__regexp('Rage X[CL]') ||
+ detect_devices::matching_desc__regexp('3D Rage (?:LT|Pro)') ||
+ detect_devices::matching_desc__regexp('Voodoo [35]') ||
+ detect_devices::matching_desc__regexp('Voodoo Banshee') ||
+ detect_devices::matching_desc__regexp('8281[05].* CGC') ||
+ detect_devices::matching_desc__regexp('Rage 128') ||
+ detect_devices::matching_desc__regexp('Radeon ') || #- all Radeon card are now 3D with 4.3.0
+ detect_devices::matching_desc__regexp('[nN]Vidia.*T[nN]T2') || #- TNT2 cards
+ detect_devices::matching_desc__regexp('[nN][vV]idia.*NV[56]') ||
+ detect_devices::matching_desc__regexp('[nN][vV]idia.*Vanta') ||
+ detect_devices::matching_desc__regexp('[nN][vV]idia.*[gG]e[fF]orce') || #- GeForce cards
+ detect_devices::matching_desc__regexp('[nN][vV]idia.*NV1[15]') ||
+ detect_devices::matching_desc__regexp('[nN][vV]idia.*Quadro');
my @locale_pkgs = map { pkgs::packagesProviding($o->{packages}, 'locales-' . $_) } lang::langsLANGUAGE($o->{locale}{langs});
unshift @{$o->{default_packages}}, uniq(map { $_->name } @locale_pkgs);
foreach (lang::langsLANGUAGE($o->{locale}{langs})) {
- $o->{compssUsersChoice}{qq(LOCALES"$_")} = 1;
+ $o->{rpmsrate_flags_chosen}{qq(LOCALES"$_")} = 1;
}
- $o->{compssUsersChoice}{'CHARSET"' . lang::l2charset($o->{locale}{lang}) . '"'} = 1;
+ $o->{rpmsrate_flags_chosen}{'CHARSET"' . lang::l2charset($o->{locale}{lang}) . '"'} = 1;
}
sub unselectMostPackages {
@@ -545,7 +715,9 @@ sub warnAboutNaughtyServers {
my ($o) = @_;
my @naughtyServers = pkgs::naughtyServers($o->{packages}) or return 1;
my $r = $o->ask_from_list_('',
-formatAlaTeX(N("You have selected the following server(s): %s
+formatAlaTeX(
+ #-PO: keep the double empty lines between sections, this is formatted a la LaTeX
+ N("You have selected the following server(s): %s
These servers are activated by default. They don't have any known security
@@ -566,7 +738,9 @@ sub warnAboutRemovedPackages {
my ($o, $packages) = @_;
my @removedPackages = keys %{$packages->{state}{ask_remove} || {}} or return;
if (!$o->ask_yesorno('',
-formatAlaTeX(N("The following packages will be removed to allow upgrading your system: %s
+formatAlaTeX(
+ #-PO: keep the double empty lines between sections, this is formatted a la LaTeX
+ N("The following packages will be removed to allow upgrading your system: %s
Do you really want to remove these packages?
@@ -604,25 +778,25 @@ sub killCardServices() {
$pid and kill(15, $pid); #- send SIGTERM
}
-sub unlockCdrom(;$) {
- my ($cdrom) = @_;
- $cdrom or cat_("/proc/mounts") =~ m,(/(?:dev|tmp)/\S+)\s+(?:/mnt/cdrom|/tmp/image), and $cdrom = $1;
- eval { $cdrom and ioctl detect_devices::tryOpen($1), c::CDROM_LOCKDOOR(), 0 };
+sub unlockCdrom() {
+ my $cdrom = cat_("/proc/mounts") =~ m!(/(?:dev|tmp)/\S+)\s+(?:/mnt/cdrom|/tmp/image)! && $1 or return;
+ eval { ioctl(detect_devices::tryOpen($cdrom), c::CDROM_LOCKDOOR(), 0) };
}
-sub ejectCdrom(;$) {
- my ($cdrom) = @_;
+
+sub ejectCdrom {
+ my ($o_cdrom, $o_mountpoint) = @_;
getFile("XXX"); #- close still opened filehandle
- $cdrom ||= $1 if cat_("/proc/mounts") =~ m,(/(?:dev|tmp)/\S+)\s+(?:/mnt/cdrom|/tmp/image),;
- if ($cdrom) {
- #- umount BEFORE opening the cdrom device otherwise the umount will
- #- D state if the cdrom is already removed
- eval { fs::umount("/tmp/image") };
- $@ and warnAboutFilesStillOpen();
- eval {
- my $dev = detect_devices::tryOpen($cdrom);
- ioctl($dev, c::CDROMEJECT(), 1) if ioctl($dev, c::CDROM_DRIVE_STATUS(), 0) == c::CDS_DISC_OK();
- };
- }
+ my $cdrom = $o_cdrom || cat_("/proc/mounts") =~ m!(/(?:dev|tmp)/\S+)\s+(/mnt/cdrom|/tmp/image)! && $1 or return;
+ $o_mountpoint ||= $2 || '/tmp/image';
+
+ #- umount BEFORE opening the cdrom device otherwise the umount will
+ #- D state if the cdrom is already removed
+ eval { fs::umount($o_mountpoint) };
+ $@ and warnAboutFilesStillOpen();
+ eval {
+ my $dev = detect_devices::tryOpen($cdrom);
+ ioctl($dev, c::CDROMEJECT(), 1) if ioctl($dev, c::CDROM_DRIVE_STATUS(), 0) == c::CDS_DISC_OK();
+ };
}
sub warnAboutFilesStillOpen() {
@@ -638,7 +812,7 @@ sub setupFB {
foreach (@{$o->{bootloader}{entries}}) {
$_->{vga} = $vga if $_->{vga}; #- replace existing vga= with
}
- bootloader::install($o->{bootloader}, $o->{all_hds}{hds});
+ bootloader::install($o->{bootloader}, $o->{all_hds});
1;
}
@@ -648,6 +822,7 @@ sub install_urpmi {
#- rare case where urpmi cannot be installed (no hd install path).
$method eq 'disk' && !any::hdInstallPath() and return;
+ log::l("install_urpmi $method");
#- clean to avoid opening twice the rpm db.
delete $packages->{rpmdb};
@@ -658,7 +833,7 @@ sub install_urpmi {
$packages->import_needed_pubkeys($medium->{pubkey}, db => $db, callback => sub {
my (undef, undef, $_k, $id, $imported) = @_;
if ($id) {
- log::l(($imported ? "imported" : "found")." key=$id for medium $medium->{descr}");
+ log::l(($imported ? "imported" : "found") . " key=$id for medium $medium->{descr}");
$medium->{key_ids}{$id} = undef;
}
});
@@ -668,13 +843,14 @@ sub install_urpmi {
foreach (sort { $a->{medium} <=> $b->{medium} } values %$mediums) {
my $name = $_->{fakemedium};
if ($_->{ignored} || $_->{selected}) {
+ my $curmethod = $_->{method} || $::o->{method};
my $dir = ($_->{prefix} || ${{ nfs => "file://mnt/nfs",
disk => "file:/" . any::hdInstallPath(),
ftp => $ENV{URLPREFIX},
http => $ENV{URLPREFIX},
- cdrom => "removable://mnt/cdrom" }}{$method} ||
+ cdrom => "removable://mnt/cdrom" }}{$curmethod} ||
#- for live_update or live_install script.
- readlink("/tmp/image/Mandrake") =~ m,^(/.*)/Mandrake/*$, && "removable:/$1") . "/$_->{rpmsdir}";
+ readlink("/tmp/image/media") =~ m,^(/.*)/media/*$, && "removable:/$1") . "/$_->{rpmsdir}";
#- use list file only if visible password or macro.
my $need_list = $dir =~ m,^(?:[^:]*://[^/:\@]*:[^/:\@]+\@|.*%{),; #- }
@@ -692,10 +868,10 @@ sub install_urpmi {
my $arch = $_->arch;
my $ldir = $dir;
$ldir =~ s|/([^/]*)%{ARCH}|/./$1$arch|; $ldir =~ s|%{ARCH}|$arch|g;
- print $LIST "$ldir/".$_->filename."\n";
+ print $LIST "$ldir/" . $_->filename . "\n";
}
} else {
- #- need to use another method here to build synthesis.
+ #- need to use another method here to build list file.
open(my $F, "parsehdlist '$prefix/var/lib/urpmi/hdlist.$name.cz' |");
local $_;
while (<$F>) {
@@ -709,6 +885,16 @@ sub install_urpmi {
close $LIST;
}
+ #- build a names file
+ if (open my $F, ">", "$prefix/var/lib/urpmi/names.$name") {
+ if (defined $_->{start} && defined $_->{end}) {
+ foreach ($_->{start} .. $_->{end}) {
+ print $F $packages->{depslist}[$_]->name . "\n";
+ }
+ }
+ close $F;
+ }
+
#- build synthesis file if there are still not existing (ie not copied from mirror).
if (-s "$prefix/var/lib/urpmi/synthesis.hdlist.$name.cz" <= 32) {
unlink "$prefix/var/lib/urpmi/synthesis.hdlist.$name.cz";
@@ -720,16 +906,17 @@ sub install_urpmi {
my ($qname, $qdir) = ($name, $dir);
$qname =~ s/(\s)/\\$1/g; $qdir =~ s/(\s)/\\$1/g;
- #- compute correctly reference to Mandrake/base
+ #- compute correctly reference to media/media_info
my $with;
if ($_->{update}) {
- #- an update medium always use "../base/hdlist.cz";
- $with = "../base/hdlist.cz";
+ $with = "media_info/hdlist.cz";
+ } elsif ($_->{with_hdlist}) {
+ $with = $_->{with_hdlist};
} else {
$with = $_->{rpmsdir};
$with =~ s|/[^/]*%{ARCH}.*||;
$with =~ s|/+|/|g; $with =~ s|/$||; $with =~ s|[^/]||g; $with =~ s!/!../!g;
- $with .= "../Mandrake/base/$_->{hdlist}";
+ $with .= "../media/media_info/$_->{hdlist}";
}
#- output new urpmi.cfg format here.
@@ -745,6 +932,7 @@ sub install_urpmi {
";
} else {
#- remove not selected media by removing hdlist and synthesis files copied.
+ log::l("removing media $name");
unlink "$prefix/var/lib/urpmi/hdlist.$name.cz";
unlink "$prefix/var/lib/urpmi/synthesis.hdlist.$name.cz";
}
@@ -801,7 +989,7 @@ sub g_auto_install {
require pkgs;
$o->{default_packages} = pkgs::selected_leaves($::o->{packages});
- my @fields = qw(mntpoint pt_type size);
+ my @fields = qw(mntpoint fs_type size);
$o->{partitions} = [ map { my %l; @l{@fields} = @$_{@fields}; \%l } grep { $_->{mntpoint} } @{$::o->{fstab}} ];
exists $::o->{$_} and $o->{$_} = $::o->{$_} foreach qw(locale authentication mouse netc timezone superuser intf keyboard users partitioning isUpgrade manualFstab nomouseprobe crypto security security_user libsafe netcnx useSupermount autoExitInstall X services); #- TODO modules bootloader
@@ -862,9 +1050,9 @@ sub getAndSaveInstallFloppies {
$image .= arch() =~ /sparc64/ && "64"; #- for sparc64 there are a specific set of image.
if ($have_drivers) {
- getAndSaveFile("images/${image}_drivers.img", "$dest_dir/${name}_drivers.img") or log::l("failed to write Install Floppy (${image}_drivers.img) to $dest_dir/${name}_drivers.img"), return;
+ getAndSaveFile("install/images/${image}_drivers.img", "$dest_dir/${name}_drivers.img") or log::l("failed to write Install Floppy (${image}_drivers.img) to $dest_dir/${name}_drivers.img"), return;
}
- getAndSaveFile("images/$image.img", "$dest_dir/$name.img") or log::l("failed to write Install Floppy ($image.img) to $dest_dir/$name.img"), return;
+ getAndSaveFile("install/images/$image.img", "$dest_dir/$name.img") or log::l("failed to write Install Floppy ($image.img) to $dest_dir/$name.img"), return;
"$dest_dir/$name.img", if_($have_drivers, "$dest_dir/${name}_drivers.img");
}
@@ -889,12 +1077,6 @@ sub getAndSaveAutoInstallFloppies {
my $dev = devices::set_loop($img) or log::l("couldn't set loopback device"), return;
find { eval { fs::mount($dev, $mountdir, $_, 0); 1 } } qw(ext2 vfat) or return;
- if (@imgs == 1 || $img =~ /drivers/) {
- local $o->{partitioning}{clearall} = !$replay;
- eval { output("$mountdir/auto_inst.cfg", g_auto_install($replay)) };
- $@ and log::l("Warning: <", formatError($@), ">");
- }
-
if (-e "$mountdir/menu.lst") {
# hd_grub boot disk is different than others
substInFile {
@@ -902,17 +1084,25 @@ sub getAndSaveAutoInstallFloppies {
s/\bautomatic=method:disk/$param/;
} "$mountdir/menu.lst";
} elsif (-e "$mountdir/syslinux.cfg") {
+ #- make room first
+ unlink "$mountdir/help.msg", "$mountdir/boot.msg";
+
substInFile {
s/timeout.*/$replay ? 'timeout 1' : ''/e;
s/^(\s*append)/$1 $param/
} "$mountdir/syslinux.cfg";
- unlink "$mountdir/help.msg";
- output "$mountdir/boot.msg", "\n0c",
+ output "$mountdir/boot.msg", $replay ? '' : "\n0c" .
"!! If you press enter, an auto-install is going to start.
All data on this computer is going to be lost,
including any Windows partitions !!
-", "07\n" if !$replay;
+" . "07\n";
+ }
+
+ if (@imgs == 1 || $img =~ /drivers/) {
+ local $o->{partitioning}{clearall} = !$replay;
+ eval { output("$mountdir/auto_inst.cfg", g_auto_install($replay)) };
+ $@ and log::l("Warning: <", formatError($@), ">");
}
fs::umount($mountdir);
@@ -988,7 +1178,16 @@ sub loadO {
#- handle backward compatibility for things that changed
foreach (@{$o->{partitions} || []}, @{$o->{manualFstab} || []}) {
- $_->{pt_type} ||= $_->{type};
+ if (my $type = delete $_->{type}) {
+ if ($type =~ /^(0x)?(\d*)$/) {
+ fs::type::set_pt_type($_, $type);
+ } else {
+ fs::type::set_fs_type($_, $type);
+ }
+ }
+ }
+ if (my $rpmsrate_flags_chosen = delete $o->{compssUsersChoice}) {
+ $o->{rpmsrate_flags_chosen} = $rpmsrate_flags_chosen;
}
$o;
@@ -1001,7 +1200,7 @@ sub generate_automatic_stage1_params {
my @ks;
if ($o->{method} eq 'http') {
- $ENV{URLPREFIX} =~ m!(http|ftp)://([^/:]+)(/.*)! or die;
+ $ENV{URLPREFIX} =~ m!(http|ftp)://([^/:]+)(.*)! or die;
$method = $1; #- in stage1, FTP via HTTP proxy is available through FTP config, not HTTP
@ks = (server => $2, directory => $3);
} elsif ($o->{method} eq 'ftp') {
@@ -1065,7 +1264,7 @@ sub suggest_mount_points {
my ($mnt, $handle) = guess_mount_point($part, $prefix, \$user) or next;
- next if $uniq && fsedit::mntpoint2part($mnt, $fstab);
+ next if $uniq && fs::get::mntpoint2part($mnt, $fstab);
$part->{mntpoint} = $mnt; delete $part->{unsafeMntpoint};
#- try to find other mount points via fstab
@@ -1078,23 +1277,122 @@ sub find_root_parts {
my ($fstab, $prefix) = @_;
map {
my $handle = any::inspect($_, $prefix);
- my $f = $handle && (find { -f $_ } map { "$handle->{dir}/etc/$_" } 'mandrake-release', 'mandrakelinux-release');
+ my $f = $handle && (find { -f $_ } map { "$handle->{dir}/etc/$_" } 'mandrakelinux-release', 'mandrake-release', 'redhat-release');
if ($f) {
my $s = cat_($f);
chomp($s);
$s =~ s/\s+for\s+\S+//;
log::l("find_root_parts found $_->{device}: $s");
- { release => $s, part => $_ };
+ { release => $s, part => $_, release_file => $f };
} else { () }
} @$fstab;
}
+
+sub migrate_device_names {
+ my ($all_hds, $from_fstab, $new_root, $root_from_fstab, $o_in) = @_;
+
+ log::l("warning: fstab says root partition is $root_from_fstab->{device}, whereas we were reading fstab from $new_root->{device}");
+ my ($old_prefix, $old_part_number) = devices::simple_partition_scan($root_from_fstab);
+ my ($new_prefix, $new_part_number) = devices::simple_partition_scan($new_root);
+
+ if ($old_part_number != $new_part_number) {
+ log::l("argh, $root_from_fstab->{device} and $old_part_number->{device} are not the same partition number");
+ return;
+ }
+
+ log::l("replacing $old_prefix with $new_prefix");
+
+ my %h;
+ foreach (@$from_fstab) {
+ if ($_->{device} =~ s!^\Q$old_prefix!$new_prefix!) {
+ #- this is simple to handle, nothing more to do
+ } elsif ($_->{part_number}) {
+ my $device_prefix = devices::part_prefix($_);
+ push @{$h{$device_prefix}}, $_;
+ } else {
+ #- hopefully this doesn't need anything special
+ }
+ };
+ my @from_fstab_per_hds = values %h or return;
+
+
+ my @current_hds = grep { $new_root->{rootDevice} ne $_->{device} } fs::get::hds($all_hds);
+
+ found_one:
+ @from_fstab_per_hds or return;
+
+ foreach my $from_fstab_per_hd (@from_fstab_per_hds) {
+ my ($matching, $other) = partition {
+ my $hd = $_;
+ every {
+ my $wanted = $_;
+ my $part = find { $_->{part_number} eq $wanted->{part_number} } partition_table::get_normal_parts($hd);
+ $part && $part->{fs_type} && fs::type::can_be_this_fs_type($wanted, $part->{fs_type});
+ } @$from_fstab_per_hd;
+ } @current_hds;
+ @$matching == 1 or next;
+
+ my ($hd) = @$matching;
+ @current_hds = @$other;
+ @from_fstab_per_hds = grep { $_ != $from_fstab_per_hd } @from_fstab_per_hds;
+
+ log::l("$hd->{device} nicely corresponds to " . join(' ', map { $_->{device} } @$from_fstab_per_hd));
+ foreach (@$from_fstab_per_hd) {
+ partition_table::compute_device_name($_, $hd);
+ }
+ goto found_one;
+ }
+
+ #- we can't find one and only one matching hd
+ my @from_fstab_not_handled = map { @$_ } @from_fstab_per_hds;
+ log::l("we still don't know what to do with: " . join(' ', map { $_->{device} } @from_fstab_not_handled));
+
+
+ if (!$o_in) {
+ die 'still have';
+ log::l("well, ignoring them!");
+ return;
+ }
+
+ my $propositions_valid = every {
+ my $wanted = $_;
+ my @parts = grep { $_->{part_number} eq $wanted->{part_number}
+ && $_->{fs_type} && fs::type::can_be_this_fs_type($wanted, $_->{fs_type}) } fs::get::hds_fstab(@current_hds);
+ $wanted->{propositions} = \@parts;
+ @parts > 0;
+ } @from_fstab_not_handled;
+
+ $o_in->ask_from('',
+ N("The "),
+ [ map {
+ { label => N("%s (was %s)", $_->{mntpoint}, $_->{device}), val => \$_->{device},
+ format => sub { $_[0] && $_->{device} },
+ list => [ '',
+ $propositions_valid ? @{$_->{propositions}} :
+ fs::get::hds_fstab(@current_hds) ] };
+ } @from_fstab_not_handled ]);
+}
+
sub use_root_part {
- my ($all_hds, $part, $prefix) = @_;
+ my ($all_hds, $part, $o_in) = @_;
+ my $migrate_device_names;
{
- my $handle = any::inspect($part, $prefix) or die;
- fs::get_info_from_fstab($all_hds, $handle->{dir});
+ my $handle = any::inspect($part, $::prefix) or die;
+
+ my @from_fstab = fs::read_fstab($handle->{dir}, '/etc/fstab', 'keep_default');
+
+ my $root_from_fstab = fs::get::root_(\@from_fstab);
+ if (!fsedit::is_same_hd($root_from_fstab, $part)) {
+ $migrate_device_names = 1;
+ log::l("from_fstab contained: $_->{device} $_->{mntpoint}") foreach @from_fstab;
+ migrate_device_names($all_hds, \@from_fstab, $part, $root_from_fstab, $o_in);
+ log::l("from_fstab now contains: $_->{device} $_->{mntpoint}") foreach @from_fstab;
+ }
+ fs::add2all_hds($all_hds, @from_fstab);
+ log::l("fstab is now: $_->{device} $_->{mntpoint}") foreach fs::get::fstab($all_hds);
}
- isSwap($_) and $_->{mntpoint} = 'swap' foreach fsedit::get_really_all_fstab($all_hds); #- use all available swap.
+ isSwap($_) and $_->{mntpoint} = 'swap' foreach fs::get::really_all_fstab($all_hds); #- use all available swap.
+ $migrate_device_names;
}
sub getHds {
@@ -1115,10 +1413,10 @@ sub getHds {
fs::add2all_hds($all_hds, @{$o->{manualFstab}});
$o->{all_hds} = $all_hds;
- $o->{fstab} = [ fsedit::get_really_all_fstab($all_hds) ];
+ $o->{fstab} = [ fs::get::really_all_fstab($all_hds) ];
fs::merge_info_from_mtab($o->{fstab});
- my @win = grep { isFat_or_NTFS($_) && isFat_or_NTFS({ pt_type => fsedit::typeOfPart($_->{device}) }) } @{$o->{fstab}};
+ my @win = grep { isFat_or_NTFS($_) && maybeFormatted($_) && !$_->{is_removable} } @{$o->{fstab}};
log::l("win parts: ", join ",", map { $_->{device} } @win) if @win;
if (@win == 1) {
#- Suggest /boot/efi on ia64.
@@ -1130,7 +1428,7 @@ sub getHds {
}
}
- my @sunos = grep { isSunOS($_) && pt_type2name($_->{pt_type}) =~ /root/i } @{$o->{fstab}}; #- take only into account root partitions.
+ my @sunos = grep { $_->{pt_type} == 2 } @{$o->{fstab}}; #- take only into account root partitions.
if (@sunos) {
my $v = '';
map { $_->{mntpoint} = $_->{unsafeMntpoint} = "/mnt/sunos" . ($v && ++$v) } @sunos;
@@ -1151,7 +1449,7 @@ sub log_sizes {
sub X_options_from_o {
my ($o) = @_;
{
- freeDriver => $o->{freeDriver},
+ freedriver => $o->{freedriver},
allowFB => $o->{allowFB},
};
}
@@ -1162,7 +1460,7 @@ sub copy_advertising {
return if $::rootwidth < 800;
my $f;
- my $source_dir = "Mandrake/share/advertising";
+ my $source_dir = "install/extra/advertising";
foreach ("." . $o->{locale}{lang}, "." . substr($o->{locale}{lang},0,2), '') {
$f = getFile("$source_dir$_/list") or next;
$source_dir = "$source_dir$_";
@@ -1209,7 +1507,7 @@ sub set_security {
sub write_fstab {
my ($o) = @_;
- fs::write_fstab($o->{all_hds}, $o->{prefix}) if !$o->{isUpgrade};
+ fs::write_fstab($o->{all_hds}, $o->{prefix}) if !$o->{isUpgrade} || $o->{migrate_device_names};
}
my @bigseldom_used_groups = (
@@ -1265,7 +1563,7 @@ sub remove_bigseldom_used() {
#- pcmcia various
#-###############################################################################
sub configure_pcmcia {
- my ($pcic) = @_;
+ my ($modules_conf, $pcic) = @_;
#- try to setup pcmcia if cardmgr is not running.
my $running if 0;
@@ -1283,7 +1581,7 @@ sub configure_pcmcia {
sleep(3);
#- make sure to be aware of loaded module by cardmgr.
- modules::read_already_loaded();
+ modules::read_already_loaded($modules_conf);
}
sub write_pcmcia {