summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2004-08-13 03:44:46 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2004-08-13 03:44:46 +0000
commit8ebb5bd002ae74da0e6d1ef1bce1f8b2294f4e2b (patch)
tree99e713d6448b863a1febf34995c1f841bf03889b /perl-install
parentafd31bb0f770218ed23053971e7265f26cd925a6 (diff)
downloaddrakx-8ebb5bd002ae74da0e6d1ef1bce1f8b2294f4e2b.tar
drakx-8ebb5bd002ae74da0e6d1ef1bce1f8b2294f4e2b.tar.gz
drakx-8ebb5bd002ae74da0e6d1ef1bce1f8b2294f4e2b.tar.bz2
drakx-8ebb5bd002ae74da0e6d1ef1bce1f8b2294f4e2b.tar.xz
drakx-8ebb5bd002ae74da0e6d1ef1bce1f8b2294f4e2b.zip
Don't ask for the selection of supplementary media in non-interactive
installs.
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/install_any.pm189
-rw-r--r--perl-install/install_steps.pm2
-rw-r--r--perl-install/install_steps_interactive.pm5
3 files changed, 104 insertions, 92 deletions
diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm
index 53f7f9419..a60cdb477 100644
--- a/perl-install/install_any.pm
+++ b/perl-install/install_any.pm
@@ -360,113 +360,117 @@ sub preConfigureTimezone {
add2hash_($o->{timezone}, { UTC => $utc, ntp => $ntp });
}
-sub setPackages {
- my ($o, $rebuild_needed) = @_;
-
- require pkgs;
- if (!$o->{packages} || is_empty_array_ref($o->{packages}{depslist})) {
- my $cdrom;
- ($o->{packages}, my $suppl_method) = pkgs::psUsingHdlists($o->{prefix}, $o->{method});
-
- #- ask whether there are supplementary media
- SUPPL: {
- my $prev_asked_medium = $asked_medium;
- if ($suppl_method && !$o->{isUpgrade}
- && (my $suppl = $o->ask_from_list_('', N("Do you have a supplementary installation media to configure?"),
- [ N_("None"), N_("CD-ROM"), N_("Network (http)"), N_("Network (ftp)") ], 'None')
- ) 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' ? '1s' : int(keys %{$o->{packages}{mediums}}) + 1;
- local $::isWizard = 0;
- local $o->{method} = $suppl_method;
- if ($suppl_method eq 'cdrom') {
- (my $cdromdev) = detect_devices::cdroms();
- $suppl_method = '', 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);
- log::l($@) if $@;
- useMedium($medium_name);
- #- probe for an hdlists file and then look for all hdlists listed herein
- eval { pkgs::psUsingHdlists($o->{prefix}, $suppl_method, "/mnt/cdrom/media/media_info/hdlists", $o->{packages}) };
- if ($@) {
- #- no hdlists found on the suppl. CD
- #- Look directly for a file media/main/hdlist1s.cz
- my $supplmedium = pkgs::psUsingHdlist(
- $o->{prefix}, # /mnt
- $suppl_method,
- $o->{packages},
- "hdlist$medium_name.cz",
- $medium_name,
- 'media/main',
- "Supplementary CD $medium_name",
- 1, # selected
- "/mnt/cdrom/media/main/media_info/hdlist$medium_name.cz",
- );
- if ($supplmedium) {
- log::l("read suppl hdlist on cdrom");
- $supplmedium->{prefix} = "removable://mnt/cdrom"; #- for install_urpmi
- $supplmedium->{selected} = 1;
- $supplmedium->{method} = 'cdrom';
- } else {
- log::l("no suppl hdlist");
- }
- }
- }
- } else {
- my $url = $o->ask_from_entry('', N("URL of the mirror?")) or $suppl_method = '', last SUPPL;
- useMedium($medium_name);
- require "$suppl_method.pm";
- my $f = eval {
- if ($suppl_method eq 'http') {
- http::getFile("$url/media_info/hdlist.cz");
- } elsif ($suppl_method eq 'ftp') {
- ftp::getFile("$url/media_info/hdlist.cz");
- } else { undef }
- };
- if (!defined $f) {
- log::l($@) if $@;
- $o->ask_warn('', N("Can't find hdlist file on this mirror"));
- $suppl_method = '';
- useMedium($prev_asked_medium);
- last SUPPL;
- }
+sub selectSupplMedia {
+ my ($o, $suppl_method) = @_;
+ #- ask whether there are supplementary media
+ my $prev_asked_medium = $asked_medium;
+ if ($suppl_method && !$o->{isUpgrade}
+ && (my $suppl = $o->ask_from_list_('', N("Do you have a supplementary installation media to configure?"),
+ [ N_("None"), N_("CD-ROM"), N_("Network (http)"), N_("Network (ftp)") ], 'None')
+ ) 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' ? '1s' : int(keys %{$o->{packages}{mediums}}) + 1;
+ local $::isWizard = 0;
+ local $o->{method} = $suppl_method;
+ if ($suppl_method eq 'cdrom') {
+ (my $cdromdev) = detect_devices::cdroms();
+ return '' if !$cdromdev;
+ $cdrom = $cdromdev->{device};
+ devices::make($cdrom);
+ ejectCdrom($cdrom);
+ if ($o->ask_okcancel('', N("Insert the CD"), 1)) {
+ 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->{prefix}, $suppl_method, "/mnt/cdrom/media/media_info/hdlists", $o->{packages}) };
+ if ($@) {
+ #- no hdlists found on the suppl. CD
+ #- Look directly for a file media/main/hdlist1s.cz
my $supplmedium = pkgs::psUsingHdlist(
- $o->{prefix},
+ $o->{prefix}, # /mnt
$suppl_method,
$o->{packages},
- "hdlist$medium_name.cz", #- hdlist
+ "hdlist$medium_name.cz",
$medium_name,
- '', #- rpmsdir
- "Supplementary media $medium_name", #- description
+ 'media/main',
+ "Supplementary CD $medium_name",
1, # selected
- $f,
+ "/mnt/cdrom/media/main/media_info/hdlist$medium_name.cz",
);
- close $f;
if ($supplmedium) {
- log::l("read suppl hdlist (via $suppl_method)");
- $supplmedium->{prefix} = $url; #- for install_urpmi
+ log::l("read suppl hdlist on cdrom");
+ $supplmedium->{prefix} = "removable://mnt/cdrom"; #- for install_urpmi
$supplmedium->{selected} = 1;
- $supplmedium->{method} = $suppl_method;
- $supplmedium->{with_hdlist} = 'media_info/hdlist.cz'; #- for install_urpmi
+ $supplmedium->{method} = 'cdrom';
} else {
log::l("no suppl hdlist");
}
}
+ }
+ } else {
+ my $url = $o->ask_from_entry('', N("URL of the mirror?")) or return '';
+ useMedium($medium_name);
+ require "$suppl_method.pm";
+ my $f = eval {
+ if ($suppl_method eq 'http') {
+ http::getFile("$url/media_info/hdlist.cz");
+ } elsif ($suppl_method eq 'ftp') {
+ my ($login, $pass, $host, $prefix) = $url =~ m!^ftp://(?:(.*?)(?::(.*?))?@)?([^/]+)/(.*)!;
+ ftp::getFile("media_info/hdlist.cz", $host, $prefix, $login, $pass);
+ } 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 '';
+ }
+ 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)");
+ $supplmedium->{prefix} = $url; #- for install_urpmi
+ $supplmedium->{selected} = 1;
+ $supplmedium->{method} = $suppl_method;
+ $supplmedium->{with_hdlist} = 'media_info/hdlist.cz'; #- for install_urpmi
} else {
- $suppl_method = '';
+ log::l("no suppl hdlist");
}
- useMedium($prev_asked_medium); #- back to main medium
}
+ } else {
+ $suppl_method = '';
+ }
+ useMedium($prev_asked_medium); #- back to main medium
+ return $suppl_method;
+}
+
+sub setPackages {
+ my ($o, $rebuild_needed) = @_;
+
+ require pkgs;
+ if (!$o->{packages} || is_empty_array_ref($o->{packages}{depslist})) {
+ my $cdrom;
+ ($o->{packages}, my $suppl_method) = pkgs::psUsingHdlists($o->{prefix}, $o->{method});
+
+ $suppl_method = $o->selectSupplMedia($suppl_method);
#- open rpm db according to right mode needed.
$o->{packages}{rpmdb} ||= pkgs::rpmDbOpen($o->{prefix}, $rebuild_needed);
@@ -481,6 +485,7 @@ sub setPackages {
#- must be done after getProvides
#- if there is a supplementary CD, override the rpmsrate/compssUsers
+ #- FIXME make this overriding optional
pkgs::read_rpmsrate(
$o->{packages},
getFile($suppl_method eq 'cdrom' ? "/mnt/cdrom/media/media_info/rpmsrate" : "media/media_info/rpmsrate")
diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm
index 0153a23a4..fe54fff48 100644
--- a/perl-install/install_steps.pm
+++ b/perl-install/install_steps.pm
@@ -290,6 +290,8 @@ sub setPackages {
$rebuild_needed and pkgs::selectPackagesToUpgrade($o->{packages}, $o->{prefix});
}
+sub selectSupplMedia { '' }
+
sub choosePackages {
my ($o, $packages, $_compssUsers, $first_time) = @_;
diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm
index 6e377824a..f1ef4fbcc 100644
--- a/perl-install/install_steps_interactive.pm
+++ b/perl-install/install_steps_interactive.pm
@@ -383,6 +383,11 @@ sub setPackages {
pkgs::selectPackagesToUpgrade($o->{packages}, $o->{prefix});
}
}
+
+sub selectSupplMedia {
+ my ($o, $suppl_method) = @_;
+ install_any::selectSupplMedia($o, $suppl_method);
+}
#------------------------------------------------------------------------------
sub choosePackages {
my ($o, $packages, $compssUsers, $_first_time) = @_;