diff options
author | Pascal Rigaux <pixel@mandriva.com> | 1999-07-24 19:40:11 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 1999-07-24 19:40:11 +0000 |
commit | 56b374075f45355184b2927cc2f24262dc7e6c21 (patch) | |
tree | 0131cb0b14564bedd750bae2dce222b46b6deecd | |
parent | 5a632fe532f355a2583970fefb2ed8ceec6c9460 (diff) | |
download | drakx-56b374075f45355184b2927cc2f24262dc7e6c21.tar drakx-56b374075f45355184b2927cc2f24262dc7e6c21.tar.gz drakx-56b374075f45355184b2927cc2f24262dc7e6c21.tar.bz2 drakx-56b374075f45355184b2927cc2f24262dc7e6c21.tar.xz drakx-56b374075f45355184b2927cc2f24262dc7e6c21.zip |
no_comment
-rw-r--r-- | docs/TODO | 2 | ||||
-rw-r--r-- | perl-install/Makefile | 4 | ||||
-rw-r--r-- | perl-install/c/Makefile.PL | 7 | ||||
-rw-r--r-- | perl-install/common.pm | 8 | ||||
-rw-r--r-- | perl-install/install2.pm | 37 | ||||
-rw-r--r-- | perl-install/install_any.pm | 4 | ||||
-rw-r--r-- | perl-install/install_steps.pm | 6 | ||||
-rw-r--r-- | perl-install/install_steps_stdio.pm | 22 | ||||
-rw-r--r-- | perl-install/lang.pm | 2 | ||||
-rw-r--r-- | perl-install/pkgs.pm | 77 |
10 files changed, 115 insertions, 54 deletions
@@ -1,3 +1,5 @@ +for compss language support. see apropos howto-$LANG and %lang::languages + install2 sigsegv when leaving :( (just do active and it will do it) diff --git a/perl-install/Makefile b/perl-install/Makefile index 5381b1391..b0e492ccf 100644 --- a/perl-install/Makefile +++ b/perl-install/Makefile @@ -31,11 +31,11 @@ tar-diskdrake: clean c/c.xs: c/c.xs.pm rm -f $@ - perl $< > $@ + export C_RPM=1 ; perl $< > $@ chmod a-w $@ $(SO_FILES): c/c.xs - test -e c/Makefile || (cd c; perl Makefile.PL) + test -e c/Makefile || (cd c; export C_RPM=1 ; perl Makefile.PL) $(MAKE) -C c install1_hd: install1_hd.c diff --git a/perl-install/c/Makefile.PL b/perl-install/c/Makefile.PL index 4ed352603..edbabef13 100644 --- a/perl-install/c/Makefile.PL +++ b/perl-install/c/Makefile.PL @@ -1,10 +1,15 @@ use ExtUtils::MakeMaker; # See lib/ExtUtils/MakeMaker.pm for details of how to influence # the contents of the Makefile that is written. + +my $libs = '-L/usr/X11R6/lib -lX11 -lgdk'; + +$libs .= ' -lrpm -ldb1 -lz' if $ENV{C_RPM}; + WriteMakefile( 'NAME' => 'c', 'VERSION_FROM' => 'c.pm', # finds $VERSION - 'LIBS' => ['-lrpm -ldb1 -lz -L/usr/X11R6/lib -lX11 -lgdk'], # e.g., '-lm' + 'LIBS' => [$libs], # e.g., '-lm' 'DEFINE' => '', # e.g., '-DHAVE_SOMETHING' 'INC' => '-I/usr/include/rpm -Wall `gtk-config --cflags`', # e.g., '-I/usr/include/other' ); diff --git a/perl-install/common.pm b/perl-install/common.pm index 429a18d35..ce4d599e9 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 bool member divide is_empty_array_ref set_new set_add round_up round_down first second top uniq translate) ], + common => [ qw(_ __ min max bool member divide is_empty_array_ref set_new set_add round_up round_down first second top uniq translate untranslate) ], file => [ qw(dirname basename all glob_ cat_ chop_ mode) ], system => [ qw(sync makedev unmakedev psizeof strcpy gettimeofday syscall_ crypt_) ], constant => [ qw($printable_chars $sizeof_int $bitof_int $SECTORSIZE) ], @@ -96,3 +96,9 @@ sub translate { } $po::I18N::I18N{$s} || $s; } + +sub untranslate($@) { + my $s = shift; + foreach (@_) { translate($_) eq $s and return $_ } + die "untranslate failed"; +} diff --git a/perl-install/install2.pm b/perl-install/install2.pm index 0ba4ae3b0..8458412dc 100644 --- a/perl-install/install2.pm +++ b/perl-install/install2.pm @@ -19,7 +19,7 @@ use pkgs; use smp; use lang; -$::testing = $ENV{PERL_INSTALL_TEST}; +$::testing = 1;#$ENV{PERL_INSTALL_TEST}; $INSTALL_VERSION = 0; my @installStepsFields = qw(text help skipOnCancel skipOnLocal prev next); @@ -79,6 +79,8 @@ for (my $i = 0; $i < @upgradeSteps; $i += 2) { $upgradeSteps{first} = $upgradeSteps[0]; +my @install_classes = (__("newbie"), __("developer"), __("server"), __("expert")); + # partition layout for a server my @serverPartitioning = ( { mntpoint => "/boot", size => 16 << 11, type => 0x83 }, @@ -99,13 +101,6 @@ my $default = { bootloader => { onmbr => 1, linear => 0 }, mkbootdisk => 0, base => [ qw(basesystem console-tools mkbootdisk linuxconf anacron linux_logo rhs-hwdiag utempter ldconfig chkconfig ntsysv mktemp setup setuptool filesystem MAKEDEV SysVinit ash at authconfig bash bdflush binutils console-tools crontabs dev e2fsprogs ed etcskel file fileutils findutils getty_ps gpm grep groff gzip hdparm info initscripts isapnptools kbdconfig kernel less ldconfig lilo logrotate losetup man mkinitrd mingetty modutils mount net-tools passwd procmail procps psmisc mandrake-release rootfiles rpm sash sed setconsole setserial shadow-utils sh-utils slocate stat sysklogd tar termcap textutils time timeconfig tmpwatch util-linux vim-minimal vixie-cron which) ], - comps => [ - [ 0, __('X Window System') => qw(XFree86 XFree86-xfs XFree86-75dpi-fonts) ], - [ 0, __('KDE') => qw(kdeadmin kdebase kthememgr kdegames kjumpingcube kdegraphics kdelibs kdemultimedia kdenetwork kdesupport kdeutils kBeroFTPD kdesu kdetoys kpilot kcmlaptop kdpms kpppload kmpg) ], - [ 0, __('Console Multimedia') => qw(aumix audiofile esound sndconfig awesfx rhsound cdp mpg123 svgalib playmidi sox mikmod) ], - [ 0, __('CD-R burning and utilities') => qw(mkisofs cdrecord cdrecord-cdda2wav cdparanoia xcdroast) ], - [ 0, __('Games') => qw(xbill xboard xboing xfishtank xgammon xjewel xpat2 xpilot xpuzzles xtrojka xkobo freeciv) ], - ], packages => [ qw() ], partitionning => { clearall => $::testing, eraseBadPartitions => 1, autoformat => 1 }, partitions => [ @@ -129,20 +124,10 @@ sub selectPath { $o->{isUpgrade} = $o->selectInstallOrUpgrade; $o->{steps} = $o->{isUpgrade} ? \%upgradeSteps : \%installSteps; $o->{orderedSteps} = $o->{isUpgrade} ? \@orderedUpgradeSteps : \@orderedInstallSteps; - - $o->{comps} = [ @{$o->{default}->{comps}} ]; - foreach (@{$o->{comps}}) { - my ($selected, $name, @packages) = @$_; - $_ = { selected => $selected, name => $name, packages => \@packages }; - } } sub selectInstallClass { - $o->{installClass} = $o->selectInstallClass; - - if ($o->{installClass} eq 'Server') { - #TODO - } + $o->{installClass} = $o->selectInstallClass(@install_classes); } sub setupSCSI { @@ -199,15 +184,19 @@ sub findInstallFiles { $o->{packages} = pkgs::psUsingDirectory(); pkgs::getDeps($o->{packages}); + + $o->{compss} = pkgs::readCompss($o->{packages}); } sub choosePackages { - foreach (@{$o->{default}->{base}}) { pkgs::select($o->{packages}, $_) } - $o->choosePackages($o->{packages}, $o->{comps}); - - my @p = @{$o->{default}->{base}}, grep { $_->{selected} } @{$o->{comps}}; + my @p = @{$o->{default}->{base}}; push @p, "kernel-smp" if smp::detect(); + foreach (@p) { $o->{packages}->{$_}->{base} = 1 } + + pkgs::setCompssSelected($o->{compss}, $o->{packages}, $o->{installClass}); + $o->choosePackages($o->{packages}, $o->{compss}); + foreach (@p) { $o->{packages}->{$_}->{selected} = 1 } } @@ -249,7 +238,7 @@ install chapter of the Official Linux Mandrake User's Guide."); } sub main { - $SIG{__DIE__} = sub { chomp $_[0]; log::l("ERROR: $_[0]") }; +# $SIG{__DIE__} = sub { chomp $_[0]; log::l("ERROR: $_[0]") }; # if this fails, it's okay -- it might help with free space though unlink "/sbin/install"; diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm index 74e6b2a01..be4b2d7c8 100644 --- a/perl-install/install_any.pm +++ b/perl-install/install_any.pm @@ -15,7 +15,7 @@ use log; 1; -sub fileInBase { member($_[0], qw(hdlist comps depslist)); } +sub fileInBase { member($_[0], qw(hdlist compss depslist)); } sub imageGetFile { fileInBase($_[0]) and return "/tmp/rhimage/Mandrake/base/$_[0]"; @@ -170,5 +170,5 @@ sub upgrChoosePackages { # psVerifyDependencies(&$::o->{packages}, 1); # } # -# return psSelectPackages(&$::o->{packages}, &$::o->{comps}, NULL, 0, 1); +# return psSelectPackages(&$::o->{packages}, &$::o->{compss}, NULL, 0, 1); } diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm index ceef9a294..b25997932 100644 --- a/perl-install/install_steps.pm +++ b/perl-install/install_steps.pm @@ -45,8 +45,8 @@ sub chooseLanguage($) { sub selectInstallOrUpgrade($) { $o->{default}->{isUpgrade} || 0; } -sub selectInstallClass($) { - $o->{default}->{installClass} || 'Custom'; +sub selectInstallClass($@) { + $o->{default}->{installClass} || $_[1]; } sub setupSCSIInterfaces { die "TODO"; @@ -72,7 +72,7 @@ sub choosePartitionsToFormat($$) { } sub choosePackages($$$) { - my ($o, $packages, $comps) = @_; + my ($o, $packages, $compss) = @_; } sub beforeInstallPackages($) { diff --git a/perl-install/install_steps_stdio.pm b/perl-install/install_steps_stdio.pm index 4c4c74c84..22e171c22 100644 --- a/perl-install/install_steps_stdio.pm +++ b/perl-install/install_steps_stdio.pm @@ -28,8 +28,8 @@ sub leavingStep { } sub chooseLanguage($) { - my $lang = lang::text2lang(ask_from_list('Language', - 'Which language do you want?', + my $lang = lang::text2lang(ask_from_list("Language", # no use translating this + "Which language do you want?", [ lang::list() ])); run_program::run('xmodmap', "/usr/bin/$lang.map"); $lang; @@ -39,6 +39,14 @@ sub selectInstallOrUpgrade($) { ask_yesorno('Install/Upgrade', 'Do you want to upgrade an already installed Mandrake?'); } +sub selectInstallClass($@) { + my ($o, @classes) = @_; + my $c = ask_from_list(_("Install Class"), + _("What type of user will you have?"), + [ map { translate($_) } @classes ]); + untranslate($c, @classes); +} + sub rebootNeeded($) { my ($o) = @_; ask_warn('', "You need to reboot for the partition table modifications to take place"); @@ -57,14 +65,14 @@ sub choosePartitionsToFormat($$) { } sub choosePackages($$$) { - my ($o, $packages, $comps) = @_; + my ($o, $packages, $compss) = @_; my @r = ask_many_from_list('', "Choose the packages you want to install", - [ map { $_->{name} } @$comps ], - [ map { $_->{selected} } @$comps ]); + [ map { $_->{name} } @$compss ], + [ map { $_->{selected} } @$compss ]); - for (my $i = 0; $i < @$comps; $i++) { - $comps->[$i]->{selected} = $r[$i]; + for (my $i = 0; $i < @$compss; $i++) { + $compss->[$i]->{selected} = $r[$i]; } } diff --git a/perl-install/lang.pm b/perl-install/lang.pm index 3385248d6..1b571ddd6 100644 --- a/perl-install/lang.pm +++ b/perl-install/lang.pm @@ -29,7 +29,7 @@ sub list { map { $_->[0] } values %languages } sub text2lang { my ($t) = @_; while (my ($k, $v) = each %languages) { - $v->[0] eq $t and return $k; + lc($v->[0]) eq lc($t) and return $k; } die "unknown language $t"; } diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm index 5407cd045..7795a7f8a 100644 --- a/perl-install/pkgs.pm +++ b/perl-install/pkgs.pm @@ -20,33 +20,32 @@ my @skipThesesPackages = qw(XFree86-8514 XFree86-AGX XFree86-FBDev XFree86-Mach3 sub skipThisPackage { member($_[0], @skipThesesPackages) } - sub Package { my ($packages, $name) = @_; $packages->{$name} or die "unknown package $name"; } -sub select($$) { - my ($packages, $name) = @_; - my $p = Package($packages, $name); + +sub select($$;$) { + my ($packages, $p, $base) = @_; $p->{selected} = -1; # selected by user my @l = @{$p->{deps}}; while (@l) { my $n = shift @l; my $i = Package($packages, $n); + $i->{base} = $base; push @l, @{$i->{deps}} unless $i->{selected}; $i->{selected}++ unless $i->{selected} == -1; } } sub unselect($$) { - my ($packages, $name) = @_; - my $p = Package($packages, $name); - my $set = set_new($name); + my ($packages, $p) = @_; + my $set = set_new($p->{name}); my $l = $set->{list}; # get the list of provided packages foreach my $q (@$l) { my $i = Package($packages, $q); - $i->{selected} or next; + $i->{selected} && !$i->{base} or next; $i->{selected} = 1; # that way, its counter will be zero the first time set_add($set, @{$i->{provides} || []}); } @@ -78,12 +77,12 @@ sub unselect($$) { } } sub toggle($$) { - my ($packages, $name) = @_; - Package($packages, $name)->{selected} ? unselect($packages, $name) : &select($packages, $name); + my ($packages, $p) = @_; + $p->{selected} ? unselect($packages, $p) : &select($packages, $p); } sub set($$$) { - my ($packages, $name, $val) = @_; - $val ? &select($packages, $name) : unselect($packages, $name); + my ($packages, $p, $val) = @_; + $val ? &select($packages, $p) : unselect($packages, $p); } sub addInfosFromHeader($$;$) { @@ -116,7 +115,7 @@ sub getDeps($) { my ($packages) = @_; local *F; - open F, install_any::imageGetFile("depslist"); # or die "can't find dependencies list"; + open F, install_any::imageGetFile("depslist") or die "can't find dependencies list"; foreach (<F>) { my ($name, $size, @deps) = split; $packages->{$name}->{size} = $size; @@ -125,6 +124,58 @@ sub getDeps($) { } } +sub readCompss($) { + my ($packages) = @_; + my (@compss, $ps, $category); + + local *F; + open F, install_any::imageGetFile("compss") or die "can't find compss"; + foreach (<F>) { + /^\s*$/ || /^#/ and next; + s/#.*//; + my ($options, $name) = /^(\S*)\s+(.*?)\s*$/ or die "bad line in compss: $_"; + + if ($name =~ /(.*):$/) { + if ($category) { + push @compss, $category; + $ps = []; + } + $category = { options => $options, name => $1, packages => $ps }; + } else { + my $p = $packages->{$name} or log::l("unknown package $name (in compss)"), next; + $p->{options} = $options; + push @$ps, $p; + } + } + [ @compss, $category ]; +} + +sub setCompssSelected($$$) { + my ($compss, $packages, $install_class, $select) = @_; + + my $l = substr($install_class, 0, 1); + my $L = uc $l; + + my $verif_lang = sub { + $_[0] =~ /-([^-]*)$/; + $1 eq $ENV{LANG} || eval { lang::text2lang($1) eq $ENV{LANG} } && !$@; + }; + + foreach my $c (@$compss) { + $c->{show} = bool($c->{options} =~ /($l|\*)/); + my $nb = 0; + foreach my $p (@{$c->{packages}}) { + local $_ = $p->{options}; + $p->{show} = ! (/$L/); + + &select($packages, $p, $p->{base}), $nb++ + if /$l|\*/ && (!/l/ || &$verif_lang($p->{name})) || + $p->{base}; + } + $c->{selected} = $nb; + } +} + sub psFromHeaderListDesc { my ($fd, $noSeek) = @_; my %packages; |