From ccd328a91005d8942f6afb74880e018636ba573c Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Wed, 13 Feb 2002 11:37:17 +0000 Subject: - handle WORM type in /proc/scsi/scsi - added media_type cdrom-burner - adapting to new media_type - nicer fd&hd testing --- perl-install/detect_devices.pm | 22 +++++++++++++--------- perl-install/diskdrake/interactive.pm | 2 +- perl-install/fs.pm | 4 ++-- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm index e63ba16a8..c83d1043c 100644 --- a/perl-install/detect_devices.pm +++ b/perl-install/detect_devices.pm @@ -32,12 +32,12 @@ sub get { getIDE(), getSCSI(), getDAC960(), getCompaqSmartArray(), getATARAID(); } sub hds() { grep { $_->{media_type} eq 'hd' && ($::isStandalone || !isRemovableDrive($_)) } get(); } -sub zips() { grep { $_->{media_type} =~ /.d/ && isZipDrive($_) } get(); } -sub ide_zips() { grep { $_->{media_type} =~ /.d/ && isZipDrive($_) } getIDE(); } -#-sub jazzs() { grep { $_->{media_type} =~ /.d/ && isJazDrive($_) } get(); } -sub ls120s() { grep { $_->{media_type} =~ /.d/ && isLS120Drive($_) } get(); } +sub zips() { grep { member($_->{media_type}, 'fd', 'hd') && isZipDrive($_) } get(); } +sub ide_zips() { grep { member($_->{media_type}, 'fd', 'hd') && isZipDrive($_) } getIDE(); } +#-sub jazzs() { grep { member($_->{media_type}, 'fd', 'hd') && isJazDrive($_) } get(); } +sub ls120s() { grep { member($_->{media_type}, 'fd', 'hd') && isLS120Drive($_) } get(); } sub cdroms() { - my @l = grep { $_->{media_type} eq 'cdrom' } get(); + my @l = grep { $_->{media_type} =~ /cdrom/ } get(); if (my @l2 = IDEburners()) { require modules; modules::add_alias('scsi_hostadapter', 'ide-scsi'); @@ -50,9 +50,9 @@ sub cdroms() { } @l; } -sub burners { grep { $_->{media_type} eq 'cdrom' && isBurner($_) } get() } -sub IDEburners { grep { $_->{media_type} eq 'cdrom' && isBurner($_) } getIDE() } -sub dvdroms { grep { $_->{media_type} eq 'cdrom' && isDvdDrive($_) } get() } +sub burners { grep { $_->{media_type} eq 'cdrom-burner' || $_->{media_type} =~ /cdrom/ && isBurner($_) } get() } +sub IDEburners { grep { $_->{media_type} eq 'cdrom-burner' || $_->{media_type} =~ /cdrom/ && isBurner($_) } getIDE() } +sub dvdroms { grep { $_->{media_type} =~ /cdrom/ && isDvdDrive($_) } get() } sub get_mac_model() { my $mac_model = cat_("/proc/device-tree/model") || die "Can't open /proc/device-tree/model"; @@ -94,7 +94,8 @@ sub floppy { first(floppies_dev()) } #- example ls120, model = "LS-120 SLIM 02 UHD Floppy" sub isBurner { - my $dev = $_[0]{device}; + my ($e) = @_; + my $dev = $e->{device}; if (my($nb) = $dev =~ /scd(.*)/) { grep { /^(scd|sr)$nb:.*writer/ } syslog(); } else { @@ -142,6 +143,9 @@ sub getSCSI() { } elsif ($type =~ /CD-ROM/) { $device = "scd" . $cdromNum++; $type = 'cdrom'; + } elsif ($type =~ /WORM/) { + $device = "scd" . $cdromNum++; + $type = 'cdrom-burner'; } $device and push @drives, { device => $device, media_type => $type, info => "$vendor $model", id => $id, bus => 0 }; } diff --git a/perl-install/diskdrake/interactive.pm b/perl-install/diskdrake/interactive.pm index a4d731b83..ff3e85051 100644 --- a/perl-install/diskdrake/interactive.pm +++ b/perl-install/diskdrake/interactive.pm @@ -99,7 +99,7 @@ struct hd { int totalsectors # size in sectors string device # 'hda', 'sdc' ... string device_alias # 'cdrom', 'floppy' ... - string media_type # one of { 'hd', 'cdrom', 'fd', 'tape' } + string media_type # one of { 'hd', 'cdrom', 'cdrom-burner', 'fd', 'tape' } string info # name of the hd, eg: 'QUANTUM ATLAS IV 9 WLS' bool isDirty # does it need to be written to the disk diff --git a/perl-install/fs.pm b/perl-install/fs.pm index 5156a9c4c..e75970330 100644 --- a/perl-install/fs.pm +++ b/perl-install/fs.pm @@ -331,11 +331,11 @@ sub set_default_options { if ($options->{supermount} && $is_auto) { # this can't work, guessing :-( - $part->{type} = fs2type($part->{media_type} eq 'cdrom' ? 'iso9660' : 'vfat'); + $part->{type} = fs2type($part->{media_type} =~ /cdrom/ ? 'iso9660' : 'vfat'); $is_auto = 0; } - if ($part->{media_type} eq 'cdrom') { + if ($part->{media_type} =~ /cdrom/) { $options->{ro} = 1; } -- cgit v1.2.1