summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorDamien Chaumette <dchaumette@mandriva.com>2003-09-12 16:05:52 +0000
committerDamien Chaumette <dchaumette@mandriva.com>2003-09-12 16:05:52 +0000
commit8bcc9984fa76e26fc94c5609bd4bf6e26f0135a7 (patch)
tree253a6331ae87eef67551a16b866c0edbc6a29a75 /perl-install
parentc167c1ead3bc2a2bb782e79a7d5b02b66d854b0c (diff)
downloaddrakx-backup-do-not-use-8bcc9984fa76e26fc94c5609bd4bf6e26f0135a7.tar
drakx-backup-do-not-use-8bcc9984fa76e26fc94c5609bd4bf6e26f0135a7.tar.gz
drakx-backup-do-not-use-8bcc9984fa76e26fc94c5609bd4bf6e26f0135a7.tar.bz2
drakx-backup-do-not-use-8bcc9984fa76e26fc94c5609bd4bf6e26f0135a7.tar.xz
drakx-backup-do-not-use-8bcc9984fa76e26fc94c5609bd4bf6e26f0135a7.zip
added sub copy_firmware, sub use_windows(), sub use_floppy
firmware copy works from floppy and windows/winnt
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/network/tools.pm45
1 files changed, 45 insertions, 0 deletions
diff --git a/perl-install/network/tools.pm b/perl-install/network/tools.pm
index b40ed0860..62b9a0fb5 100644
--- a/perl-install/network/tools.pm
+++ b/perl-install/network/tools.pm
@@ -300,4 +300,49 @@ EOF
};
}
+sub copy_firmware {
+ my ($device, $destination, $file) = @_;
+ my ($source, $failed, $mounted);
+
+ $device eq 'floppy' and do { $mounted = 1; ($source, $failed) = use_floppy($file) };
+ $device eq 'windows' and ($source, $failed) = use_windows();
+
+ $source eq $failed and return;
+ $mounted and my $_b = before_leaving { fs::umount('/mnt') };
+ if ($failed) {
+ eval { $in->ask_warn('', $failed) }; $in->exit if $@ =~ /wizcancel/;
+ return;
+ }
+
+ if (-e "$source/$file") { cp_af("$source/$file", $destination) }
+ else { $failed = N("Firmware copy failed, file %s not found", $file) }
+ eval { $in->ask_warn('', $failed || N("Firmware copy succeeded")) }; $in->exit if $@ =~ /wizcancel/;
+ log::explanations($failed || "Firmware copy $file in $destination succeeded");
+
+ $failed ? 0 : 1;
+}
+
+sub use_windows() {
+ my $all_hds = fsedit::get_hds({}, undef);
+ fs::get_info_from_fstab($all_hds, '');
+ my $part = find { $_->{device_windobe} eq 'C' } fsedit::get_fstab(@{$all_hds->{hds}});
+ $part or my $failed = N("No partition available");
+ my $source = -d "$part->{mntpoint}/windows/" ? "$part->{mntpoint}/windows/system" : "$part->{mntpoint}/winnt/system";
+ log::explanations($failed || "Seek in $source to find firmware");
+
+ return $source, $failed;
+}
+
+sub use_floppy {
+ my ($file) = @_;
+ my $floppy = detect_devices::floppy();
+ $in->ask_okcancel(N("Insert floppy"),
+ N("Insert a FAT formatted floppy in drive %s with %s in root directory and press %s", $floppy, $file, N("Next"))) or return;
+ eval { fs::mount(devices::make($floppy), '/mnt', 'vfat', 'readonly'); 1 } or my $failed = N("Floppy access error, unable to mount device %s", $floppy);
+ log::explanations($failed || "Mounting floppy device $floppy in /mnt");
+
+ return '/mnt', $failed;
+}
+
+
1;