From 1237406e5ee90da9dbdfec9fce21d603f75c80a6 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Wed, 4 Oct 2000 00:30:29 +0000 Subject: no_comment --- perl-install/ChangeLog | 45 +++++++++++++++++++++++++++++++ perl-install/Xconfigurator.pm | 2 +- perl-install/bootloader.pm | 3 +-- perl-install/c/stuff.xs.pm | 8 ++++++ perl-install/commands.pm | 2 +- perl-install/common.pm | 8 +++++- perl-install/detect_devices.pm | 27 ++++++++++--------- perl-install/fs.pm | 2 +- perl-install/install_any.pm | 4 +-- perl-install/install_steps.pm | 5 ++-- perl-install/install_steps_interactive.pm | 6 ++--- perl-install/modules.pm | 16 ++++++----- 12 files changed, 95 insertions(+), 33 deletions(-) diff --git a/perl-install/ChangeLog b/perl-install/ChangeLog index 885251b42..754936cab 100644 --- a/perl-install/ChangeLog +++ b/perl-install/ChangeLog @@ -1,3 +1,47 @@ +2000-10-04 Pixel + + * modules.pm (when_load): stricter regexp for $type is scsi or not + (so that scsi_mod with is scsi_raw doesn't get an alias + scsi_hostadapter) + + * detect_devices.pm (isLS120Drive): extend the regexp to include + "Caleb Technology - 144MB FDD UHD Floppy" + + * detect_devices.pm (burners, IDEburners): reworked, renamed, now + works! + * c/stuff.xs.pm (isBurner): created + + * modules.pm (load_ide): make sure ide-cd is loaded! + + * install_steps_interactive.pm (chooseGroups): the label and help + are now translated (at least will be), so use the translations + +2000-10-03 Pixel + + * share/po/Makefile (DrakX.pot): added the to-be-translated from + compssUsers + * share/po/i18n_compssUsers: read the compssUsers's and output the + to-be-translated in po format + + * log.pm (l): log to STDERR instead of STDOUT + + * install_any.pm (loadO): use first floppy drive available (won't + help much though, as stage1 doesn't follow this...) + +2000-10-03 DrakX + + * snapshot uploaded + +2000-10-03 Pixel + + * Xconfigurator.pm (autologin): don't propose autologin in + security > 3 + + * common.pm (availableRamMB): HACK HACK if i810 and memsize, + returns 127 + + * bootloader.pm (suggest): don't use grub if more than 800MB + 2000-10-04 Guillaume Cottenceau * share/po/validate.pl: create this tool @@ -23,6 +67,7 @@ * share/Cards+: fixed Savage2000 entry. +>>>>>>> 1.300 2000-10-03 DrakX * snapshot uploaded diff --git a/perl-install/Xconfigurator.pm b/perl-install/Xconfigurator.pm index 1e515ac05..f594969f1 100644 --- a/perl-install/Xconfigurator.pm +++ b/perl-install/Xconfigurator.pm @@ -1131,7 +1131,7 @@ sub autologin { my %l; @l{@etc_pass_fields} = split ':'; $l{uid} > 500, $l{name}; } cat_("$prefix/etc/passwd"); - unless (($::auto && $o->{skiptest}) || !@users || $o->{authentication}{NIS}) { + unless (($::auto && $o->{skiptest}) || !@users || $o->{authentication}{NIS} || $ENV{SECURE_LEVEL} > 3) { my $cmd = $prefix ? "chroot $prefix" : ""; my @wm = (split (' ', `$cmd /usr/sbin/chksession -l`)); my %l = getVarsFromSh("$prefix/etc/sysconfig/autologin"); diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm index 694b06d60..e20a6a270 100644 --- a/perl-install/bootloader.pm +++ b/perl-install/bootloader.pm @@ -316,7 +316,7 @@ wait %d seconds for default boot. my %l = ( silo => bool(arch() =~ /sparc/), lilo => bool(arch() !~ /sparc/) && !isLoopback(fsedit::get_root($fstab)), - grub => bool(arch() !~ /sparc/), #!isReiserfs(fsedit::get_root($fstab, 'boot')), + grub => bool(arch() !~ /sparc/ && availableRamMB() < 800), #- don't use grub if more than 800MB loadlin => bool(arch() !~ /sparc/) && -e "/initrd/loopfs/lnx4win", ); $lilo->{methods} ||= { map { $_ => 1 } grep { $l{$_} } keys %l }; @@ -582,7 +582,6 @@ sub install_grub { } } } - my $fd = first(detect_devices::floppies()); my $hd = fsedit::get_root($fstab, 'boot')->{rootDevice}; my $dev = dev2grub($lilo->{boot}, \%dev2bios); diff --git a/perl-install/c/stuff.xs.pm b/perl-install/c/stuff.xs.pm index 0b047e563..52191cb27 100644 --- a/perl-install/c/stuff.xs.pm +++ b/perl-install/c/stuff.xs.pm @@ -142,6 +142,14 @@ lseek_sector(fd, sector, offset) OUTPUT: RETVAL +int +isBurner(fd) + int fd + CODE: + RETVAL = ioctl(fd, CDROM_GET_CAPABILITY) & CDC_CD_RW; + OUTPUT: + RETVAL + unsigned int total_sectors(fd) int fd diff --git a/perl-install/commands.pm b/perl-install/commands.pm index 2e8ffc146..f9b532958 100644 --- a/perl-install/commands.pm +++ b/perl-install/commands.pm @@ -563,7 +563,7 @@ sub bug { $h and die "usage: bug\nput file report.bug on fat formatted floppy\n"; require detect_devices; - mount devices::make(first(detect_devices::floppies())), "/fd0"; + mount devices::make(detect_devices::floppy()), "/fd0"; sub header { " ******************************************************************************** diff --git a/perl-install/common.pm b/perl-install/common.pm index b3a6b05e5..2232048f6 100644 --- a/perl-install/common.pm +++ b/perl-install/common.pm @@ -571,7 +571,13 @@ sub typeFromMagic($@) { } sub availableMemory() { sum map { /(\d+)/ } grep { /^(MemTotal|SwapTotal):/ } cat_("/proc/meminfo"); } -sub availableRamMB() { 4 * int ((stat("/proc/kcore"))[7] / 1024 / 1024 / 4 + 0.5) } +sub availableRamMB() { + my $s = 4 * int ((stat("/proc/kcore"))[7] / 1024 / 1024 / 4 + 0.5); + #- HACK HACK: if i810 and memsize + require detect_devices; + return $s - 1 if $s == 128 && grep { $_->{driver} =~ /i810/ } detect_devices::probeall(); + $s; +} sub setVirtual($) { my $vt = ''; diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm index 6e9852b45..9a28f0624 100644 --- a/perl-install/detect_devices.pm +++ b/perl-install/detect_devices.pm @@ -43,30 +43,34 @@ sub ls120s() { grep { $_->{type} =~ /.d/ && isLS120Drive($_) } get(); } sub usbfdus() { grep { $_->{type} =~ /.d/ && isUSBFDUDrive($_) } get(); } sub cdroms() { my @l = grep { $_->{type} eq 'cdrom' } get(); - if (my @l2 = getIDEBurners()) { + if (my @l2 = grep { isBurner($_->{device}) } @l) { require modules; modules::add_alias('scsi_hostadapter', 'ide-scsi'); my $nb = 1 + max(-1, map { $_->{device} =~ /scd (\d+)/x } @l); - foreach my $b (@l2) { - log::l("getIDEBurners: $b"); - my ($e) = grep { $_->{device} eq $b } @l or next; - $e->{device} = "scd" . $nb++; + foreach (@l2) { + log::l("IDEBurner: $_->{device}"); + $_->{device} = "scd" . $nb++; } } @l; } +sub burners { grep { isBurner($_->{device}) } cdroms() } +sub IDEburners { grep { $_->{type} eq 'cdrom' && isBurner($_->{device}) } getIDE() } + sub floppies() { my @ide = map { $_->{device} } ls120s() and modules::load("ide-floppy"); my @scsi = map { $_->{device} } usbfdus(); (@ide, @scsi, grep { tryOpen($_) } qw(fd0 fd1)); } +sub floppy { first(floppies()) } #- example ls120, model = "LS-120 SLIM 02 UHD Floppy" -sub isZipDrive() { $_[0]->{info} =~ /ZIP\s+\d+/ } #- accept ZIP 100, untested for bigger ZIP drive. -#-sub isJazzDrive() { $_[0]->{info} =~ /JAZZ?\s+/ } #- untested. -sub isLS120Drive() { $_[0]->{info} =~ /LS-?120/ } -sub isUSBFDUDrive() { $_[0]->{info} =~ /USB-?FDU/ } -sub isRemovableDrive() { &isZipDrive || &isLS120Drive || &isUSBFDUDrive } #-or &isJazzDrive } +sub isBurner { my $f = tryOpen($_[0]); $f && c::isBurner(fileno($f)) } +sub isZipDrive { $_[0]->{info} =~ /ZIP\s+\d+/ } #- accept ZIP 100, untested for bigger ZIP drive. +#-sub isJazzDrive { $_[0]->{info} =~ /JAZZ?\s+/ } #- untested. +sub isLS120Drive { $_[0]->{info} =~ /LS-?120|144MB/ } +sub isUSBFDUDrive { $_[0]->{info} =~ /USB-?FDU/ } +sub isRemovableDrive { &isZipDrive || &isLS120Drive || &isUSBFDUDrive } #-or &isJazzDrive } sub hasSCSI() { local *F; @@ -135,9 +139,6 @@ sub getIDE() { @idi; } -#- do not work if ide-scsi is built in the kernel (aka not in module) -sub getIDEBurners() { uniq map { m!ATAPI.* CD(-R|/RW){1,2} ! ? /(\w+)/ : () } syslog() } - sub getCompaqSmartArray() { my @idi; my $f; diff --git a/perl-install/fs.pm b/perl-install/fs.pm index 83f4676d5..0a799131a 100644 --- a/perl-install/fs.pm +++ b/perl-install/fs.pm @@ -342,7 +342,7 @@ sub write($$$$) { open F, "> $prefix/etc/mtab" or die "error resetting $prefix/etc/mtab"; } - my ($floppy) = detect_devices::floppies(); + my $floppy = detect_devices::floppy(); my @to_add = ( $useSupermount ? diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm index e2aa3ee57..11a80e9a6 100644 --- a/perl-install/install_any.pm +++ b/perl-install/install_any.pm @@ -287,7 +287,7 @@ sub setPackages($) { push @{$o->{default_packages}}, "apmd" if $o->{pcmcia}; push @{$o->{default_packages}}, "raidtools" if $o->{raid} && !is_empty_array_ref($o->{raid}{raid}); push @{$o->{default_packages}}, "reiserfs-utils" if grep { isReiserfs($_) } @{$o->{fstab}}; - push @{$o->{default_packages}}, "cdrecord" if detect_devices::getIDEBurners(); + push @{$o->{default_packages}}, "cdrecord" if detect_devices::burners(); push @{$o->{default_packages}}, "alsa", "alsa-utils" if modules::get_alias("snd-slot-0") =~ /^snd-card-/; pkgs::getDeps($o->{prefix}, $o->{packages}); @@ -564,7 +564,7 @@ sub loadO { if ($f =~ /^(floppy|patch)$/) { my $f = $f eq "floppy" ? 'Mandrake/base/auto_inst.cfg' : "patch"; unless ($::testing) { - fs::mount(devices::make("fd0"), "/mnt", (arch() =~ /sparc/ ? "romfs" : "vfat"), 'readonly'); + fs::mount(devices::make(detect_devices::floppy()), "/mnt", (arch() =~ /sparc/ ? "romfs" : "vfat"), 'readonly'); $f = "/mnt/$f"; } -e $f or $f .= '.pl'; diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm index 3f1d575fd..30c60a8ef 100644 --- a/perl-install/install_steps.pm +++ b/perl-install/install_steps.pm @@ -822,8 +822,9 @@ sub miscellaneous { if (my $ramsize = $o->{miscellaneous}{memsize} and !/mem=/) { $_ .= " mem=$ramsize"; } - if (my @l = detect_devices::getIDEBurners() and !/ide-scsi/) { - $_ .= " " . join(" ", (map { "$_=ide-scsi" } @l), + if (my @l = detect_devices::IDEburners() and !/ide-scsi/) { + $_ .= " " . join(" ", (map { "$_->{device}=ide-scsi" } @l), + #- in that case, also add ide-floppy otherwise ide-scsi will be used! map { "$_->{device}=ide-floppy" } detect_devices::ide_zips()); } if ($o->{miscellaneous}{HDPARM}) { diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm index 72e19259c..c852297b9 100644 --- a/perl-install/install_steps_interactive.pm +++ b/perl-install/install_steps_interactive.pm @@ -526,10 +526,10 @@ sub chooseGroups { my $all; $o->ask_many_from_list('', _("Package Group Selection"), { list => \@groups, - help => sub { $o->{compssUsersDescr}{$_} }, + help => sub { translate($o->{compssUsersDescr}{$_}) }, ref => sub { \$o->{compssUsersChoice}{$_} }, icon2f => sub { "/usr/share/icons/" . ($o->{compssUsersIcons}{$_} || 'default') . "_section.xpm" }, - label => sub { $size{$_} ? sprintf "$_ (%d%s)", round_down($size{$_} / sqr(1024), 10), _("MB") : translate($_) }, + label => sub { translate($_) . ($size{$_} ? sprintf " (%d%s)", round_down($size{$_} / sqr(1024), 10), _("MB") : '') }, }, $o->{meta_class} eq 'desktop' ? { list => [ _("All") ], ref => sub { \$all }, shadow => 0 } : (), $individual ? { list => [ _("Individual package selection") ], ref => sub { $individual } } : (), @@ -1037,7 +1037,7 @@ sub generateAutoInstFloppy($) { my ($o) = @_; $::expert || $::g_auto_install or return; - my ($floppy) = detect_devices::floppies(); + my $floppy = detect_devices::floppy(); $o->ask_yesorno('', _("Do you want to generate an auto install floppy for linux replication?"), $floppy) or return; diff --git a/perl-install/modules.pm b/perl-install/modules.pm index 909b09844..5f00af56b 100644 --- a/perl-install/modules.pm +++ b/perl-install/modules.pm @@ -408,7 +408,7 @@ sub remove_alias($) { sub when_load { my ($name, $type, @options) = @_; - if ($type =~ /scsi/ || $type eq $type_aliases{scsi}) { + if ($type =~ /\bscsi\b/ || $type eq $type_aliases{scsi}) { add_alias('scsi_hostadapter', $name), eval { load('sd_mod') }; } $conf{$name}{options} = join " ", @options if @options; @@ -612,13 +612,15 @@ sub get_that_type { } sub load_ide { - return; #- add it back to support Ultra66 on ide modules. - eval { - load("ide-mod", 'prereq', 'options="' . detect_devices::hasUltra66() . '"'); - delete $conf{"ide-mod"}{options}; - load_multi(qw(ide-probe ide-probe-mod ide-disk ide-cd)); + if (1) { #- add it back to support Ultra66 on ide modules. + load("ide-cd"); + } else { + eval { + load("ide-mod", 'prereq', 'options="' . detect_devices::hasUltra66() . '"'); + delete $conf{"ide-mod"}{options}; + load_multi(qw(ide-probe ide-probe-mod ide-disk ide-cd)); + } } - } sub configure_pcmcia { -- cgit v1.2.1