From fd82c0312a315599fb0d766fa5c6b7be4b211ba3 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Fri, 10 Sep 1999 09:15:24 +0000 Subject: no_comment --- perl-install/Makefile | 33 ++++++++++-------- perl-install/common.pm | 3 +- perl-install/install2.pm | 4 +-- perl-install/install_any.pm | 26 +++++++++++--- perl-install/install_steps_interactive.pm | 24 ++++++++----- perl-install/keyboard.pm | 8 +++-- perl-install/lang.pm | 4 ++- perl-install/modparm.pm | 2 -- perl-install/pkgs.pm | 57 ++++++++++++++++++++----------- perl-install/share/list | 22 ++++++++++-- 10 files changed, 125 insertions(+), 58 deletions(-) diff --git a/perl-install/Makefile b/perl-install/Makefile index 9fe3affe3..6c2704d0b 100644 --- a/perl-install/Makefile +++ b/perl-install/Makefile @@ -7,6 +7,7 @@ DEST = $(ROOTDEST)/Mandrake/mdkinst STAGE2 = $(ROOTDEST)/Mandrake/base/mdkinst_stage2 BASE = $(ROOTDEST)/Mandrake/base DESTREP4PMS = $(DEST)/usr/bin/perl-install +STAGE2TMP = /tmp/stage2_tmp PERL = perl LOCALFILES = $(PERL) mouseconfig DIRS = po pci_probing @@ -78,9 +79,10 @@ install_pms: all for i in $(PMS); do \ dest=$(DESTREP4PMS)/`dirname $$i`; \ install -d $$dest; \ - perl -ne 's/\s*#-.*//; print unless (/^=head/ .. /^=cut/)' $$i > $(DESTREP4PMS)/$$i; \ + perl -ne 'print' $$i > $(DESTREP4PMS)/$$i; \ done -# || /use (diagnostics|vars|strict)/ +# perl -ne 's/\s*#-.*//; print unless (/^=head/ .. /^=cut/) || /use (diagnostics|vars|strict)/' $$i > $(DESTREP4PMS)/$$i; \ +# / rm $(DESTREP4PMS)/c/c.xs.pm mv -f $(DESTREP4PMS)/c/c.pm $(DESTREP4PMS) @@ -132,14 +134,8 @@ get_needed_files: $(SO_FILES) ln -sf ash $(DEST)/usr/bin/sh - install -d $(DEST)/usr/X11R6/lib/X11/fonts/75dpi - install -d $(DEST)/usr/X11R6/lib/X11/fonts/misc - cd /usr/X11R6/lib/X11/fonts/75dpi ; cp -a fonts.* helvR* $(DEST)/usr/X11R6/lib/X11/fonts/75dpi - cd /usr/X11R6/lib/X11/fonts/misc ; cp -a fonts.* k14.pcf.gz cursor.pcf.gz 6x13.pcf.gz $(DEST)/usr/X11R6/lib/X11/fonts/misc - - for i in ru ja; do install -d $(DEST)/usr/share/locale/$$i ; cp -f `find /usr/share/locale/$$i/* -prune -type f` $(DEST)/usr/share/locale/$$i ; done - - perl -I. -Ic -Ic/blib/arch -Mkeyboard -e 'foreach (keyboard::xmodmaps()) { `cp /usr/share/xmodmap/xmodmap.$$_ $(DEST)/usr/share/xmodmap` }' + DEST=$(DEST) perl -I. -MForMakefile -e 'locale()' + DEST=$(DEST) perl -I. -MForMakefile -e 'xmodmap()' cp -a keymaps $(DEST)/usr/share cp -a consolefonts $(DEST)/usr/share @@ -169,14 +165,23 @@ full_stage2: $(BASE)/depslist stage2: $(MAKE) install_pms - dd if=/dev/zero of=$(STAGE2) bs=1M count=12 + $(SUDO) rm -rf $(STAGE2TMP) + install -d $(STAGE2TMP) + $(SUDO) cp -a $(DEST)/* $(STAGE2TMP) + + $(SUDO) umount /mnt/stage2 ; true + dd if=/dev/zero of=$(STAGE2) bs=1M count=13 echo y | /sbin/mke2fs $(STAGE2) $(SUDO) mount $(STAGE2) /mnt/stage2 -o loop # hack to reduce the STAGE2 image - mv $(DEST)/usr/X11R6/bin/XF86_SVGA /tmp - $(SUDO) cp -a $(DEST)/* /mnt/stage2 - mv /tmp/XF86_SVGA $(DEST)/usr/X11R6/bin/ + rm $(STAGE2TMP)/usr/X11R6/bin/XF86_SVGA + for i in /usr/share/locale /usr/share/keymaps /usr/share/xmodmap; do \ + name=`basename $$i` ; \ + (cd $(STAGE2TMP)/`dirname $$i` ; find $$name | cpio --quiet -o 2>/dev/null | bzip2 > $$name.cpio.bz2 ; rm -rf $$name) \ + done + $(SUDO) cp -a $(STAGE2TMP)/* /mnt/stage2 + $(SUDO) rm -rf $(STAGE2TMP) $(SUDO) umount $(STAGE2) gzip -f -9 $(STAGE2) diff --git a/perl-install/common.pm b/perl-install/common.pm index 4b88b85ed..5fa40e2b1 100644 --- a/perl-install/common.pm +++ b/perl-install/common.pm @@ -6,7 +6,7 @@ use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK $printable_chars $sizeof_int $bitof_int @ISA = qw(Exporter); %EXPORT_TAGS = ( - common => [ qw(__ min max sum sign product bool bool2text ikeys member divide is_empty_array_ref add2hash set_new set_add round_up round_down first second top uniq translate untranslate warp_text) ], + common => [ qw(__ min max sum sign product bool bool2text to_int ikeys member divide is_empty_array_ref add2hash set_new set_add round_up round_down first second top uniq translate untranslate warp_text) ], functional => [ qw(fold_left map_index map_tab_hash mapn mapn_ difference2 before_leaving catch_cdie cdie) ], file => [ qw(dirname basename touch all glob_ cat_ chop_ mode) ], system => [ qw(sync makedev unmakedev psizeof strcpy gettimeofday syscall_ crypt_ getVarsFromSh setVarsInSh) ], @@ -40,6 +40,7 @@ sub first { $_[0] } sub second { $_[1] } sub top { $_[$#_] } sub uniq { my %l; @l{@_} = (); keys %l } +sub to_int { $_[0] =~ /(\d+)/; $1 } sub ikeys { my %l = @_; sort { $a <=> $b } keys %l } sub add2hash { my ($a, $b) = @_; while (my ($k, $v) = each %{$b || {}}) { $a->{$k} ||= $v } } sub member { my $e = shift; foreach (@_) { $e eq $_ and return 1 } 0 } diff --git a/perl-install/install2.pm b/perl-install/install2.pm index f3850252b..c4a6c17ae 100644 --- a/perl-install/install2.pm +++ b/perl-install/install2.pm @@ -385,7 +385,7 @@ sub selectInstallClass { $::beginner = $o->{installClass} eq "beginner"; $o->{partitions} = $suggestedPartitions{$o->{installClass}}; - install_any::setPackages($o) if $o->{steps}{choosePackages}{entered} > 1; + install_any::setPackages($o, \@install_classes) if $o->{steps}{choosePackages}{entered} > 1; } #------------------------------------------------------------------------------ @@ -446,7 +446,7 @@ sub formatPartitions { #------------------------------------------------------------------------------ #-PADTODO sub choosePackages { - install_any::setPackages($o); + install_any::setPackages($o, \@install_classes); $o->choosePackages($o->{packages}, $o->{compss}); $o->{packages}{$_}{selected} = 1 foreach @{$o->{base}}; } diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm index 0b9989377..47d4808a4 100644 --- a/perl-install/install_any.pm +++ b/perl-install/install_any.pm @@ -11,6 +11,7 @@ use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK); @EXPORT_OK = map { @$_ } values %EXPORT_TAGS; use common qw(:common :system); +use run_program; use pkgs; use smp; use log; @@ -94,8 +95,8 @@ sub getAvailableSpace { die "missing root partition"; } -sub setPackages { - my ($o) = @_; +sub setPackages($$) { + my ($o, $install_classes) = @_; unless ($o->{package}) { my $useHdlist = $o->{method} !~ /nfs|hd/; @@ -105,17 +106,18 @@ sub setPackages { pkgs::getDeps($o->{packages}); $o->{compss} = pkgs::readCompss ($o->{packages}); - $o->{compssList} = pkgs::readCompssList($o->{packages}); + $o->{compssListLevels} = pkgs::readCompssList($o->{packages}); + $o->{compssListLevels} ||= $install_classes; push @{$o->{base}}, "kernel-smp" if smp::detect(); do { my $p = $o->{packages}{$_} or log::l(), next; pkgs::select($o->{packages}, $p, 1); } foreach @{$o->{base}}; - } + } pkgs::setShowFromCompss($o->{compss}, $o->{installClass}, $o->{lang}); - pkgs::setSelectedFromCompssList($o->{compssList}, $o->{packages}, getAvailableSpace($o) * 0.7, $o->{installClass}, $o->{lang}); + pkgs::setSelectedFromCompssList($o->{compssListLevels}, $o->{packages}, getAvailableSpace($o) * 0.7, $o->{installClass}, $o->{lang}); } sub addToBeDone(&$) { @@ -125,3 +127,17 @@ sub addToBeDone(&$) { push @{$::o->{steps}{$step}{toBeDone}}, $f; } + +sub install_cpio { + my ($dir, $name) = @_; + + return if -e "$dir/$name"; + + my $cpio = "$dir.cpio.bz2"; + -e $cpio or return; + + commands::rm "-r", $dir; + mkdir $dir, 0755; + run_program::run("cd $dir ; bzip2 -cd $cpio | cpio -i $name"); + "$dir/$name"; +} diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm index 70090a875..296441bb9 100644 --- a/perl-install/install_steps_interactive.pm +++ b/perl-install/install_steps_interactive.pm @@ -13,6 +13,7 @@ use vars qw(@ISA); use common qw(:common); use partition_table qw(:types); use install_steps; +use pci_probing::main; use install_any; use detect_devices; use timezone; @@ -591,15 +592,22 @@ sub setup_thiskind { my @l = $o->load_thiskind($type); return if $auto && (@l || !$at_least_one); while (1) { - @l ? - $o->ask_yesorno('', - [ _("Found %s %s interfaces", join(", ", map { $_->[0] } @l), $type), - _("Do you have another one?") ], "No") : - $o->ask_yesorno('', _("Do you have an %s interface?", $type), "No") or return; + my $msg = @l ? + [ _("Found %s %s interfaces", join(", ", map { $_->[0] } @l), $type), + _("Do you have another one?") ] : + _("Do you have an %s interface?", $type); - my @r = $o->loadModule($type) or return; - push @l, \@r; - } + my $opt = [ __("Yes"), __("No") ]; + push @$opt, __("See hardware info") if $::expert; + my $r = $o->ask_from_list_('', $msg, $opt); + $r eq "No" and return; + if ($r eq "Yes") { + my @r = $o->loadModule($type) or return; + push @l, \@r; + } else { + $o->ask_warn('', [ pci_probing::main::list() ]); + } + } } diff --git a/perl-install/keyboard.pm b/perl-install/keyboard.pm index baad33b74..fdd821465 100644 --- a/perl-install/keyboard.pm +++ b/perl-install/keyboard.pm @@ -9,6 +9,7 @@ use strict; #-###################################################################################### use common qw(:common :system :file); use run_program; +use install_any; use log; use c; @@ -116,12 +117,13 @@ sub setup($) { my ($keyboard) = @_; my $o = $keyboards{$keyboard} or return; - my $file = "/usr/share/keymaps/$o->[1].kmap"; - if (-e $file) { + if (my $file = install_any::install_cpio("/usr/share/keymaps", "$o->[1].kmap")) { log::l("loading keymap $o->[1]"); load(cat_($file)); } - eval { run_program::run('xmodmap', "/usr/share/xmodmap/xmodmap.$o->[2]") } unless $::testing; + if (my $file = install_any::install_cpio("/usr/share/xmodmap", "xmodmap.$o->[2]")) { + eval { run_program::run('xmodmap', $file) } unless $::testing; + } } sub write($$) { diff --git a/perl-install/lang.pm b/perl-install/lang.pm index fa353a776..a3a1c96c6 100644 --- a/perl-install/lang.pm +++ b/perl-install/lang.pm @@ -8,6 +8,7 @@ use strict; #-###################################################################################### use common qw(:file); use commands; +use install_any; use log; #-###################################################################################### @@ -108,7 +109,7 @@ sub text2lang { } sub set { - my ($lang) = @_; + my ($lang, $prefix) = @_; if ($lang) { $ENV{LC_ALL} = $lang; @@ -120,6 +121,7 @@ sub set { delete $ENV{LC_ALL}; delete $ENV{LINGUAS}; } + install_any::install_cpio($prefix, "/usr/share/locale", $lang); } sub write { diff --git a/perl-install/modparm.pm b/perl-install/modparm.pm index 308929bf6..e8308de00 100644 --- a/perl-install/modparm.pm +++ b/perl-install/modparm.pm @@ -50,6 +50,4 @@ sub get_options_name($) { @names; } -read_modparm_file("/tmp/modparm.txt"); - 1; diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm index edb6f441c..6843a1a3b 100644 --- a/perl-install/pkgs.pm +++ b/perl-install/pkgs.pm @@ -4,7 +4,7 @@ use diagnostics; use strict; use vars qw($fd); -use common qw(:common :file); +use common qw(:common :file :functional); use install_any; use log; use smp; @@ -36,8 +36,8 @@ sub select($$;$) { $i->{selected}++ unless $i->{selected} == -1; } } -sub unselect($$) { - my ($packages, $p) = @_; +sub unselect($$;$) { + my ($packages, $p, $size) = @_; $p->{base} and return; my $set = set_new($p->{name}); my $l = $set->{list}; @@ -56,9 +56,10 @@ sub unselect($$) { $i->{selected} <= 0 || $i->{base} and next; if (--$i->{selected} == 0) { - push @$l, @{$i->{deps} || []}; + push @$l, @{$i->{deps} || []} if !$size || ($size -= $i->{size}) > 0; } } + return if $size <= 0; #- garbage collect for circular dependencies my $changed = 1; @@ -167,21 +168,22 @@ sub readCompss($) { sub readCompssList($) { my ($packages) = @_; - my ($list, %compssList); + my $level; my $f = install_any::getFile("compssList") or die "can't find compssList"; foreach (<$f>) { /^\s*$/ || /^#/ and next; - if (/(.*):$/) { - $compssList{$1} = $list = []; + my ($name, @values) = split; + + if ($name eq "package") { + $level = \@values; } else { - chomp; - my $p = $packages->{$_} or log::l("unknown package $_ (in compssList)"), next; - push @$list, $p; + my $p = $packages->{$name} or log::l("unknown packages $name (in compssList)"), next; + $p->{values} = \@values; } } - \%compssList; + $level; } sub verif_lang($$) { @@ -207,18 +209,35 @@ sub setShowFromCompss($$$) { } sub setSelectedFromCompssList($$$$$) { - my ($compssList, $packages, $size, $install_class, $lang) = @_; - - my $l = $compssList->{$install_class} or log::l("no $_ entry in compssList"), return; - foreach (@$l) { - verif_lang($_, $lang) or next; - &select($packages, $_); + my ($compssListLevels, $packages, $size, $install_class, $lang) = @_; - my $nb = 0; foreach (values %$packages) { + my @packages = values %$packages; + my @places = do { + my $ind; + map_index { $ind = $::i if $_ eq $install_class } @{$compssListLevels}; + defined $ind or log::l("unknown install class $install_class in compssList"), return; + + my @values = map { $_->{values}[$ind] } @packages; + sort { $values[$a] <=> $values[$b] } 0 .. $#packages; + }; + foreach (@places) { + my $p = $packages[$_]; + verif_lang($p, $lang) or next; + print "selecting $p->{name}\n"; + &select($packages, $p); + + my $nb = 0; foreach (@packages) { $nb += $_->{size} if $_->{selected}; } if ($nb > $size) { - unselect($packages, $_); + unselect($packages, $p, $nb - $size); + print "leaving auto selection (zsize was $nb > $size)\n"; + + my $nb = 0; foreach (@packages) { + $nb += $_->{size} if $_->{selected}; + } + print "leaving auto selection (zsize was $nb > $size)\n"; + last; } } diff --git a/perl-install/share/list b/perl-install/share/list index 71655f9cc..46d6ecf08 100644 --- a/perl-install/share/list +++ b/perl-install/share/list @@ -8,10 +8,9 @@ /sbin/insmod /sbin/mkdosfs /sbin/mke2fs -/usr/X11R6/bin/XF86_SVGA -/usr/X11R6/bin/XF86_VGA16 -/usr/X11R6/bin/xmodmap /usr/bin/bzip2 +/usr/lib/gconv/gconv-modules +/usr/lib/gconv/ISO8859-1.so /usr/lib/perl5/5.00503/AutoLoader.pm /usr/lib/perl5/5.00503/Carp.pm /usr/lib/perl5/5.00503/Data/Dumper.pm @@ -62,3 +61,20 @@ /usr/lib/perl5/site_perl/5.005/i386-linux/auto/Gtk/Gtk.bs /usr/lib/perl5/site_perl/5.005/i386-linux/auto/Gtk/Gtk.so /usr/lib/rpm/rpmrc +/usr/X11R6/bin/XF86_SVGA +/usr/X11R6/bin/XF86_VGA16 +/usr/X11R6/bin/xmodmap +/usr/X11R6/lib/X11/fonts/75dpi/fonts.dir +/usr/X11R6/lib/X11/fonts/75dpi/fonts.alias +/usr/X11R6/lib/X11/fonts/75dpi/helvR10.pcf.gz +/usr/X11R6/lib/X11/fonts/75dpi/helvR08.pcf.gz +/usr/X11R6/lib/X11/fonts/cyrillic/fonts.dir +/usr/X11R6/lib/X11/fonts/cyrillic/fonts.alias +/usr/X11R6/lib/X11/fonts/cyrillic/crox1h.pcf.gz +/usr/X11R6/lib/X11/fonts/cyrillic/crox2h.pcf.gz +/usr/X11R6/lib/X11/fonts/misc/fonts.dir +/usr/X11R6/lib/X11/fonts/misc/fonts.alias +/usr/X11R6/lib/X11/fonts/misc/6x13.pcf.gz +/usr/X11R6/lib/X11/fonts/misc/cursor.pcf.gz +/usr/X11R6/lib/X11/fonts/misc/jiskan16.pcf.gz +/usr/X11R6/lib/X11/fonts/misc/7x14rk.pcf.gz -- cgit v1.2.1