summaryrefslogtreecommitdiffstats
path: root/perl-install/install_any.pm
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.org>2004-07-14 08:27:33 +0000
committerOlivier Blin <oblin@mandriva.org>2004-07-14 08:27:33 +0000
commit4e31976d5b266415fe7d8458aeafa65994254254 (patch)
tree31e4984a029d61429e6225ed57409403ded77a6a /perl-install/install_any.pm
parentc8f524a84ea36554d8aa84b24b44511a0e4c94a6 (diff)
downloaddrakx-4e31976d5b266415fe7d8458aeafa65994254254.tar
drakx-4e31976d5b266415fe7d8458aeafa65994254254.tar.gz
drakx-4e31976d5b266415fe7d8458aeafa65994254254.tar.bz2
drakx-4e31976d5b266415fe7d8458aeafa65994254254.tar.xz
drakx-4e31976d5b266415fe7d8458aeafa65994254254.zip
automatically detect which media are available in install from ISO images
Diffstat (limited to 'perl-install/install_any.pm')
-rw-r--r--perl-install/install_any.pm22
1 files changed, 15 insertions, 7 deletions
diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm
index 10af86be3..7a5779384 100644
--- a/perl-install/install_any.pm
+++ b/perl-install/install_any.pm
@@ -76,12 +76,17 @@ sub askChangeMedium($$) {
log::l($allow ? "accepting medium $medium" : "refusing medium $medium");
$allow;
}
+
+sub method_is_from_ISO_images($) {
+ my ($method) = @_;
+ $method eq "disk-iso" || $method eq "nfs-iso";
+}
sub method_allows_medium_change($) {
my ($method) = @_;
- $method eq "cdrom" || $method eq "disk-iso" || $method eq "nfs-iso";
+ $method eq "cdrom" || method_is_from_ISO_images($method);
}
-sub look_for_ISOs() {
+sub look_for_ISO_images() {
$iso_images{media} = [];
($iso_images{loopdev}, $iso_images{mountpoint}) = cat_("/proc/mounts") =~ m|(/dev/loop\d+)\s+(/tmp/image) iso9660| or return;
@@ -112,12 +117,15 @@ sub look_for_ISOs() {
1;
}
-sub changeIso($) {
- my ($iso_label) = @_;
-
- %iso_images or look_for_ISOs() or return;
+sub find_ISO_image_labelled($) {
+ %iso_images or look_for_ISO_images() or return;
+ my ($iso_label) = @_;
+ return find { $_->{app_id} eq $iso_label && $_->{cd_set} eq $iso_images{cd_set} } @{$iso_images{media}};
+}
- my $iso_info = find { $_->{app_id} eq $iso_label && $_->{cd_set} eq $iso_images{cd_set} } @{$iso_images{media}} or return;
+sub changeIso($) {
+ my ($iso_label) = @_;
+ my $iso_info = find_ISO_image_labelled($iso_label) or return;
eval { fs::umount($iso_images{mountpoint}) };
$@ and warnAboutFilesStillOpen();