diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2006-02-17 16:14:18 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2006-02-17 16:14:18 +0000 |
commit | baac6c847740b601059c3ffe114eaea290830e39 (patch) | |
tree | a330a82a79c068d65aaabc6b9573dc1bcce2cf15 /perl-install/commands.pm | |
parent | ab35395713375ba5ad6a5059c9f5de18831ac3eb (diff) | |
download | drakx-baac6c847740b601059c3ffe114eaea290830e39.tar drakx-baac6c847740b601059c3ffe114eaea290830e39.tar.gz drakx-baac6c847740b601059c3ffe114eaea290830e39.tar.bz2 drakx-baac6c847740b601059c3ffe114eaea290830e39.tar.xz drakx-baac6c847740b601059c3ffe114eaea290830e39.zip |
enhance "bug" command to allow saving report.bug on usb key
Diffstat (limited to 'perl-install/commands.pm')
-rw-r--r-- | perl-install/commands.pm | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/perl-install/commands.pm b/perl-install/commands.pm index ff27efa79..6719151f1 100644 --- a/perl-install/commands.pm +++ b/perl-install/commands.pm @@ -431,17 +431,39 @@ sub du { sub bug { my ($h) = getopts(\@_, "h"); - $h and die "usage: bug\nput file report.bug on fat formatted floppy\n"; + my ($o_part_device) = @_; + $h and die "usage: bug [device]\nput file report.bug on a floppy or usb key\n"; - require detect_devices; + require fsedit; require modules; - require fs; modules::load_dependencies("/modules/modules.dep"); - fs::mount::mount(devices::make(detect_devices::floppy()), '/fd0', 'vfat'); + + my $part; + if ($o_part_device) { + $part = { device => $o_part_device }; + } else { + require interactive::stdio; + my $in = interactive::stdio->new; + + eval { modules::load('usb-storage', 'sd_mod') } if detect_devices::usbStorage(); + my $all_hds = fsedit::get_hds({}, $in); + fs::get_raw_hds('', $all_hds); + + my @l1 = grep { detect_devices::isKeyUsb($_) } @{$all_hds->{hds}}; + my @l2 = grep { $_->{media_type} eq 'fd' || detect_devices::isKeyUsb($_) } @{$all_hds->{raw_hds}}; + my @l = (fs::get::hds_fstab(@l1), @l2); + + $part = $in->ask_from_listf('', "Which device?", \&partition_table::description, \@l) or return; + } + + warn "putting file report.bug on $part->{device}\n"; + my $fs_type = fs::type::fs_type_from_magic($part) or die "unknown fs type\n"; + + fs::mount::mount(devices::make($part->{device}), '/fd', $fs_type); require install_any; - output("/fd0/report.bug", install_any::report_bug()); - umount "/fd0"; + output('/fd/report.bug', install_any::report_bug()); + umount '/fd'; common::sync(); } |