diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2000-03-08 00:32:57 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2000-03-08 00:32:57 +0000 |
commit | 96f663a1c39517c951282184848bf55ac22d1c15 (patch) | |
tree | c2737c74f07e4b808fd298e5506e7d80f1ff718e /perl-install | |
parent | 26f5c1cfb24bff40293d312c04572ab38a0148a0 (diff) | |
download | drakx-96f663a1c39517c951282184848bf55ac22d1c15.tar drakx-96f663a1c39517c951282184848bf55ac22d1c15.tar.gz drakx-96f663a1c39517c951282184848bf55ac22d1c15.tar.bz2 drakx-96f663a1c39517c951282184848bf55ac22d1c15.tar.xz drakx-96f663a1c39517c951282184848bf55ac22d1c15.zip |
no_comment
Diffstat (limited to 'perl-install')
-rw-r--r-- | perl-install/ChangeLog | 7 | ||||
-rw-r--r-- | perl-install/Makefile | 2 | ||||
-rw-r--r-- | perl-install/Xconfigurator.pm | 4 | ||||
-rwxr-xr-x | perl-install/g_auto_install | 1 | ||||
-rw-r--r-- | perl-install/install_any.pm | 23 | ||||
-rw-r--r-- | perl-install/install_steps_gtk.pm | 95 | ||||
-rw-r--r-- | perl-install/install_steps_interactive.pm | 22 | ||||
-rw-r--r-- | perl-install/interactive_gtk.pm | 4 | ||||
-rw-r--r-- | perl-install/modules.pm | 2 | ||||
-rw-r--r-- | perl-install/pkgs.pm | 34 |
10 files changed, 130 insertions, 64 deletions
diff --git a/perl-install/ChangeLog b/perl-install/ChangeLog index 5c3f661b1..6035be0d0 100644 --- a/perl-install/ChangeLog +++ b/perl-install/ChangeLog @@ -1,3 +1,10 @@ +2000-03-07 Pixel <pixel@mandrakesoft.com> + + * interactive_gtk.pm (ask_from_treelistW): s/focus_row/set_focus_row/ + + * install_steps_interactive.pm (addUser): force add a normal user + for security 4 + 2000-03-05 Pixel <pixel@mandrakesoft.com> * my_gtk.pm (_ask_from_list): replace focus_row with set_focus_row diff --git a/perl-install/Makefile b/perl-install/Makefile index 225d3bce1..5443526d5 100644 --- a/perl-install/Makefile +++ b/perl-install/Makefile @@ -116,7 +116,7 @@ endif cd share ; cp -a consolefonts $(DEST)/usr/share cd share ; cp template.in/*.in $(DEST)/usr/share cd share ; cp MonitorsDB CardsNames $(DEST)/usr/X11R6/lib/X11 - cd share ; cp logo-mandrake.xpm $(DEST)/usr/share + cd share ; cp *.xpm $(DEST)/usr/share cd share ; cp -a themes $(DEST)/usr/share/gtk cd share ; cp compss compssUsers compssList $(ROOTDEST)/Mandrake/base diff --git a/perl-install/Xconfigurator.pm b/perl-install/Xconfigurator.pm index 892b1f1c0..956f8695a 100644 --- a/perl-install/Xconfigurator.pm +++ b/perl-install/Xconfigurator.pm @@ -83,12 +83,12 @@ sub readCardsDB { \%cards; } sub readCardsNames { - my $file = "$prefix/usr/X11R6/lib/X11/CardsNames"; + my $file = "/usr/X11R6/lib/X11/CardsNames"; local *F; open F, $file or die "can't find $file\n"; map { (split '=>')[0] } <F>; } sub cardName2RealName { - my $file = "$prefix/usr/X11R6/lib/X11/CardsNames"; + my $file = "/usr/X11R6/lib/X11/CardsNames"; my ($name) = @_; local *F; open F, $file or die "can't find $file\n"; foreach (<F>) { chop; diff --git a/perl-install/g_auto_install b/perl-install/g_auto_install index cb5ed3cc7..bcaf8ba8b 100755 --- a/perl-install/g_auto_install +++ b/perl-install/g_auto_install @@ -7,5 +7,6 @@ $dir .= "/../../.."; $ENV{PERL5LIB} = join ":", map { "$dir/$_" } @INC; $ENV{LD_LIBRARY_PATH} = "$dir/usr/lib"; $ENV{PATH} = join ":", map { "$dir/$_" } split ":", "/usr/bin:/bin:/sbin:/usr/sbin:/usr/X11R6/bin"; +$ENV{SHARE_PATH} = "$dir/usr/share"; exec "../perl", "./install2", "--g_auto_install", @ARGV or die; diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm index 716789238..e77c4af61 100644 --- a/perl-install/install_any.pm +++ b/perl-install/install_any.pm @@ -122,7 +122,7 @@ sub setPackages($) { my ($o) = @_; require pkgs; - if (is_empty_array_ref($o->{packages})) { + if (!$o->{packages} || is_empty_hash_ref($o->{packages}[0])) { $o->{packages} = pkgs::psUsingHdlist($o->{prefix}); push @{$o->{default_packages}}, "nfs-utils-clients" if $o->{method} eq "nfs"; @@ -147,6 +147,15 @@ sub setPackages($) { $_->{values} = [ map { $_ + 50 } @{$_->{values}} ] foreach grep {$_} map { $o->{packages}{$_} } @l; grep { !pkgs::packageByName($o->{packages}, $_) && log::l("missing base package $_") } @{$o->{base}} and die "missing some base packages"; + + foreach (@{$o->{base}}) { + my $p = pkgs::packageByName($o->{packages}, $_) or log::l("missing base package $_"), next; + pkgs::selectPackage($o->{packages}, $p, 1); + } + + #- must be done after selecting base packages (to save memory) + pkgs::getProvides($o->{packages}); + } else { pkgs::unselectAllPackages($o->{packages}); } @@ -154,14 +163,10 @@ sub setPackages($) { #- this will be done if necessary in the selectPackagesToUpgrade, #- move the selection here ? this will remove the little window. unless ($o->{isUpgrade}) { - do { - my $p = pkgs::packageByName($o->{packages}, $_) or log::l("missing base package $_"), next; - pkgs::selectPackage($o->{packages}, $p, 1); - } foreach @{$o->{base}}; - do { + foreach (@{$o->{default_packages}}) { my $p = pkgs::packageByName($o->{packages}, $_) or log::l("missing add-on package $_"), next; pkgs::selectPackage($o->{packages}, $p); - } foreach @{$o->{default_packages}}; + } } } @@ -502,6 +507,10 @@ sub install_urpmi { (my $name = _("installation")) =~ s/\s/_/g; #- in case translators are too good :-/ { + local *F = getFile("depslist"); + output("$prefix/var/lib/urpmi/depslist", <F>); + } + { local *LIST; open LIST, ">$prefix/var/lib/urpmi/list.$name" or log::l("failed to write list.$name"), return; diff --git a/perl-install/install_steps_gtk.pm b/perl-install/install_steps_gtk.pm index 71f05d3bf..13f2485bc 100644 --- a/perl-install/install_steps_gtk.pm +++ b/perl-install/install_steps_gtk.pm @@ -347,7 +347,7 @@ sub choosePackagesTree { my ($o, $packages, $compss) = @_; my ($curr, $info_widget, $w_size, $go, $idle); - my %wtree; + my (%wtree, %ptree); my $w = my_gtk->new(''); my $details = new Gtk::VBox(0,0); @@ -355,21 +355,6 @@ sub choosePackagesTree { $tree->set_selection_mode('browse'); $tree->set_column_auto_resize($_, 1) foreach 0..1; - my $parent; $parent = sub { - if (my $w = $wtree{$_[0]}) { return $w } - my $s; foreach (split '/', $_[0]) { - $wtree{"$s/$_"} ||= - $tree->insert_node($s ? $parent->($s) : undef, undef, [$_], 5, (undef) x 4, 0, 0); - $s = "$s/$_"; - } - $wtree{$s}; - }; - my ($root, $leaf); - foreach (@$compss) { - ($root, $leaf) = m|(.*)/(.+)|o or ($root, $leaf) = ('', $_); - my $node = $tree->insert_node($parent->($root), undef, [$leaf], 5, (undef) x 4, 1, 0); - } - gtkadd($w->{window}, gtkpack_(new Gtk::VBox(0,5), 0, _("Choose the packages you want to install"), @@ -387,6 +372,40 @@ sub choosePackagesTree { $go->grab_focus; $w->show; + $tree->freeze; + my $dir = $::testing && $ENV{SHARE_PATH} || "/usr/share"; + my $pix_base = [ Gtk::Gdk::Pixmap->create_from_xpm($w->{window}->window, $w->{window}->style->bg('normal'), "$dir/rpm-base.xpm") ]; + my $pix_selected = [ Gtk::Gdk::Pixmap->create_from_xpm($w->{window}->window, $w->{window}->style->bg('normal'), "$dir/rpm-selected.xpm") ]; + my $pix_unselect = [ Gtk::Gdk::Pixmap->create_from_xpm_d($w->{window}->window, undef, "1 1 1 1", " c None", " ") ]; + + my $parent; $parent = sub { + if (my $w = $wtree{$_[0]}) { return $w } + my $s; foreach (split '/', $_[0]) { + $wtree{"$s/$_"} ||= + $tree->insert_node($s ? $parent->($s) : undef, undef, [$_], 5, (undef) x 4, 0, 0); + $s = "$s/$_"; + } + $wtree{$s}; + }; + my $add_node = sub { + my ($leaf, $root) = @_; + my $node = $tree->insert_node($parent->($root), undef, [$leaf], 5, (undef) x 4, 1, 0); + my $p = $packages->[0]{$leaf} or return; + my $pix = pkgs::packageFlagBase($p) ? $pix_base : pkgs::packageFlagSelected($p) ? $pix_selected : $pix_unselect; + $tree->node_set_pixmap($node, 1, $pix->[0], $pix->[1]); + push @{$ptree{$leaf}}, $node; + }; + + my ($root, $leaf); + foreach (sort keys %{$packages->[0]}) { + $add_node->($_, 'all'); + } + foreach (sort @$compss) { + ($root, $leaf) = m|(.*)/(.+)|o or ($root, $leaf) = ('', $_); + $add_node->($leaf, $root); + } + $tree->thaw; + my $display_info = sub { my $p = $packages->[0]{$curr} or return gtktext_insert($info_widget, ''); pkgs::extractHeaders($o->{prefix}, [$p]); @@ -398,7 +417,7 @@ sub choosePackagesTree { gtktext_insert($info_widget, $@ ? _("Bad package") : _("Version: %s\n", pkgs::packageVersion($p) . '-' . pkgs::packageRelease($p)) . _("Size: %d KB\n", pkgs::packageSize($p) / 1024) . - ($imp && _("Importance: %s\n", $imp)) . + ($imp && _("Importance: %s\n", $imp)) . "\n" . formatLines(c::headerGetEntry($p->{header}, 'description'))); c::headerFree(delete $p->{header}); 0; @@ -407,23 +426,51 @@ sub choosePackagesTree { $tree->signal_connect(tree_select_row => sub { Gtk->timeout_remove($idle) if $idle; - $_[1]->row->is_leaf or return; - ($curr) = $tree->node_get_pixtext($_[1], 0); - - $idle = Gtk->timeout_add(100, $display_info); + if ($_[1]->row->is_leaf) { + ($curr) = $tree->node_get_pixtext($_[1], 0); + $idle = Gtk->timeout_add(100, $display_info); + } else { + $curr = $_[1]; + } }); - my $update_size = sub { my $size = 0; foreach (values %{$packages->[0]}) { $size += pkgs::packageSize($_) - ($_->{installedCumulSize} || 0) if pkgs::packageFlagSelected($_); #- on upgrade, installed packages will be removed. } - $w_size->set(_("Total size: %d / %d KB", + $w_size->set(_("Total size: %d / %d MB", pkgs::correctSize($size / sqr(1024)), install_any::getAvailableSpace($o) / sqr(1024))); }; - &$update_size(); + my $toggle = sub { + if (ref $curr) { + $tree->toggle_expansion($curr); + } else { + my $p = $packages->[0]{$curr} or return; + pkgs::togglePackageSelection($packages, $p, my $l = {}); + if (my @l = grep { $l->{$_} } keys %$l) { + @l > 1 and $o->ask_okcancel('', [ _("The following packages are going to be install/removed"), join(", ", sort @l) ], 1) || return; + pkgs::togglePackageSelection($packages, $p); + foreach (@l) { + my $p = $packages->[0]{$_}; + my $pix = pkgs::packageFlagSelected($p) ? $pix_selected : $pix_unselect; + $tree->node_set_pixmap($_, 1, $pix->[0], $pix->[1]) foreach @{$ptree{$_}}; + } + &$update_size; + } else { + $o->ask_warn('', _("This is a mandatory package, it can't unselected")); + } + } + }; + $tree->signal_connect(button_press_event => sub { &$toggle if $_[1]{type} =~ /^2/ }); + $tree->signal_connect(key_press_event => sub { + my ($w, $e) = @_; + my $c = chr $e->{keyval}; + &$toggle if $e->{keyval} >= 0x100 ? $c eq "\r" || $c eq "\x8d" : $c eq ' '; + 1; + }); + &$update_size; $w->main; } diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm index 142c785bd..b66853989 100644 --- a/perl-install/install_steps_interactive.pm +++ b/perl-install/install_steps_interactive.pm @@ -266,23 +266,21 @@ sub choosePackages { $o->chooseGroups($packages, $compssUsers, $compssUsersSorted); - my %save_selected; $save_selected{pkgs::packageName($_)} = pkgs::packageFlagSelected($_) foreach values %{$packages->[0]}; + my %save_selected; $save_selected{$_->{file}} = pkgs::packageFlagSelected($_) foreach values %{$packages->[0]}; pkgs::setSelectedFromCompssList($o->{compssListLevels}, $packages, 1, 0, $o->{installClass}); my $max_size = pkgs::selectedSize($packages); - pkgs::packageSetFlagSelected($_, $save_selected{$_->{name}}) foreach values %{$packages->[0]}; + pkgs::packageSetFlagSelected($_, $save_selected{$_->{file}}) foreach values %{$packages->[0]}; - if (!$::beginner && $max_size > $available) { - $o->ask_okcancel('', + if (!$::beginner && $max_size > $available) { + $o->ask_okcancel('', _("You need %dMB for a full install of the groups you selected. You can go on anyway, but be warned that you won't get all packages", $max_size / sqr(1024)), 1) or goto &choosePackages - } - - my $size2install = $::beginner ? $available * 0.7 : $o->chooseSizeToInstall($packages, $min_size, min($max_size, $available * 0.9)) or goto &choosePackages; + } - ($o->{packages_}{ind}) = - pkgs::setSelectedFromCompssList($o->{compssListLevels}, $packages, 1, $size2install, $o->{installClass}); + my $size2install = $::beginner ? $available * 0.7 : $o->chooseSizeToInstall($packages, $min_size, min($max_size, $available * 0.9)) or goto &choosePackages; -# $_->{selected} and print "$_->{name}\n" foreach values %$packages; + ($o->{packages_}{ind}) = + pkgs::setSelectedFromCompssList($o->{compssListLevels}, $packages, 1, $size2install, $o->{installClass}); } $o->choosePackagesTree($packages, $compss) if $::expert; } @@ -626,7 +624,7 @@ sub addUser($) { my @shells = install_any::shells($o); if ($o->{security} < 2 && !$clicked || $o->ask_from_entries_refH( - [ _("Add user"), _("Accept user"), $o->{security} > 4 && !@{$o->{users}} ? () : _("Done") ], + [ _("Add user"), _("Accept user"), $o->{security} >= 4 && !@{$o->{users}} ? () : _("Done") ], _("Enter a user\n%s", $o->{users} ? _("(already added %s)", join(", ", map { $_->{realname} || $_->{name} } @{$o->{users}})) : ''), [ _("Real name") => \$u->{realname}, @@ -1154,7 +1152,7 @@ sub load_thiskind { install_any::ultra66($o); if (my ($c) = pci_probing::main::probe('AUDIO')) { - modules::add_alias("sound", $c->[1]); + modules::add_alias("sound", $c->[1]) if pci_probing::main::check($c->[1]); } } modules::load_thiskind($type, sub { $w = wait_load_module($o, $type, @_) }, $pcmcia); diff --git a/perl-install/interactive_gtk.pm b/perl-install/interactive_gtk.pm index 1e81785d7..250700578 100644 --- a/perl-install/interactive_gtk.pm +++ b/perl-install/interactive_gtk.pm @@ -85,7 +85,7 @@ sub ask_from_treelistW { my $s; $tree->expand($wtree{$s .= "$_$separator"}) foreach split $sep, $root; foreach my $nb (1 .. @$l) { if ($tree->node_nth($nb) == $node) { - $tree->focus_row($nb); + $tree->set_focus_row($nb); Gtk->idle_add(sub { $tree->node_moveto($node, 0, 0.5, 0); 0 }); last; } @@ -104,7 +104,7 @@ sub ask_from_treelistW { Gtk->main_quit; }; $w->{ok_clicked} = $leave; - $w->{cancel_clicked} = sub { $o->destroy; die "ask_from_list cancel" }; #- make sure windows doesn't live any more. + $w->{cancel_clicked} = sub { $w->destroy; die "ask_from_list cancel" }; #- make sure windows doesn't live any more. gtkadd($w->{window}, gtkpack($w->create_box_with_title(@$messages), gtkpack_(new Gtk::VBox(0,7), diff --git a/perl-install/modules.pm b/perl-install/modules.pm index 2727706e5..8092956df 100644 --- a/perl-install/modules.pm +++ b/perl-install/modules.pm @@ -506,7 +506,7 @@ sub load_thiskind($;&$) { my %devs; foreach (@devs) { my ($text, $mod) = @$_; - $mod =~ /unknown|ignore/ and log::l("skipping $text, no module available (if you know one, please mail bugs\@linux-mandrake.com)"), next; + pci_probing::main::check($mod) or next; $devs{$mod}++ and log::l("multiple $mod devices found"), next; log::l("found driver for $mod"); &$f($text, $mod) if $f; diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm index 7987fae7d..50b6b09d1 100644 --- a/perl-install/pkgs.pm +++ b/perl-install/pkgs.pm @@ -101,7 +101,8 @@ sub packageFlagBase { my ($pkg) = @_; $pkg->{flags} & $PKGS_BASE } sub packageFlagSkip { my ($pkg) = @_; $pkg->{flags} & $PKGS_SKIP } sub packageFlagUnskip { my ($pkg) = @_; $pkg->{flags} & $PKGS_UNSKIP } -sub packageSetFlagSelected { my ($pkg, $v) = @_; $v ? ($pkg->{flags} |= $PKGS_SELECTED) : ($pkg->{flags} &= ~$PKGS_SELECTED); } +sub packageSetFlagSelected { my ($pkg, $v) = @_; $pkg->{flags} &= ~$PKGS_SELECTED; $pkg->{flags} |= $v & $PKGS_SELECTED; } + sub packageSetFlagForce { my ($pkg, $v) = @_; $v ? ($pkg->{flags} |= $PKGS_FORCE) : ($pkg->{flags} &= ~$PKGS_FORCE); } sub packageSetFlagInstalled { my ($pkg, $v) = @_; $v ? ($pkg->{flags} |= $PKGS_INSTALLED) : ($pkg->{flags} &= ~$PKGS_INSTALLED); } sub packageSetFlagBase { my ($pkg, $v) = @_; $v ? ($pkg->{flags} |= $PKGS_BASE) : ($pkg->{flags} &= ~$PKGS_BASE); } @@ -202,13 +203,14 @@ sub selectPackage($$;$$) { #- deps have been closed except for choices, so no need to #- recursively apply selection, expand base on it. my $dep = packageById($packages, $_); +# printf ">>> $dep->{file}: %x\n", $dep->{flags}; $base and packageSetFlagBase($dep, 1); $otherOnly and !packageFlagSelected($dep) and $otherOnly->{packageName($dep)} = 1; $otherOnly or packageSetFlagSelected($dep, 1+packageFlagSelected($dep)); } } } - $otherOnly and packageFlagSelected($pkg) and $otherOnly->{packageName($pkg)} = 1; + $otherOnly and !packageFlagSelected($pkg) and $otherOnly->{packageName($pkg)} = 1; $otherOnly or packageSetFlagSelected($pkg, 1+packageFlagSelected($pkg)); 1; } @@ -226,11 +228,13 @@ sub unselectPackage($$;$) { #- provides are closed and are taken into account to get possible #- unselection of package (value false on otherOnly) or strict #- unselection (value true on otherOnly). - foreach my $providedPkg ($pkg, packageProvides($pkg)) { - packageFlagBase($providedPkg) and die "a provided package cannot be a base package"; - $otherOnly or packageSetFlagSelected($providedPkg, 0); - $otherOnly and $otherOnly->{packageName{$providedPkg}} = 1; - foreach (map { split '\|' } packageDepsId($providedPkg)) { + foreach my $provided ($pkg, packageProvides($pkg)) { + packageFlagBase($provided) and die "a provided package cannot be a base package"; + if (packageFlagSelected($provided)) { + $otherOnly or packageSetFlagSelected($provided, 0); + $otherOnly and $otherOnly->{packageName($provided)} = 1; + } + foreach (map { split '\|' } packageDepsId($provided)) { my $dep = packageById($packages, $_); packageFlagBase($dep) and next; packageFlagSelected($dep) or next; @@ -243,9 +247,9 @@ sub unselectPackage($$;$) { } 1; } -sub togglePackageSelection($$) { - my ($packages, $pkg) = @_; - packageFlagSelected($pkg) ? unselectPackage($packages, $pkg) : selectPackage($packages, $pkg); +sub togglePackageSelection($$;$) { + my ($packages, $pkg, $otherOnly) = @_; + packageFlagSelected($pkg) ? unselectPackage($packages, $pkg, $otherOnly) : selectPackage($packages, $pkg, 0, $otherOnly); } sub setPackageSelection($$$) { my ($packages, $pkg, $value) = @_; @@ -254,7 +258,7 @@ sub setPackageSelection($$$) { sub unselectAllPackages($) { my ($packages) = @_; - packageSetFlagSelected($_, packageFlagBase($_) && 1) foreach values %{$packages->[0]}; + packageFlagBase($_) or packageSetFlagSelected($_, 0) foreach values %{$packages->[0]}; } sub skipSetWithProvides { @@ -337,8 +341,8 @@ sub getProvides($) { #- needed by a large number of package. foreach my $pkg (@{$packages->[1]}) { - map { my $providedPkg = $packages->[1][$_] or die "invalid package index $_"; - packageFlagBase($providedPkg) or push @{$providedPkg->{provides} ||= []}, $pkg; + map { my $provided = $packages->[1][$_] or die "invalid package index $_"; + packageFlagBase($provided) or push @{$provided->{provides} ||= []}, $pkg; } map { split '\|' } packageDepsId($pkg); } } @@ -385,7 +389,7 @@ sub readCompssList { $p->{values} = [ map { $_ + 90 } @{$p->{values} || [ (0) x @levels ]} ]; } } - return { map_index { $_ => $::i } @levels }; + my $l = { map_index { $_ => $::i } @levels }; } sub readCompssUsers { @@ -426,7 +430,7 @@ sub readCompssUsers { sub setSelectedFromCompssList { my ($compssListLevels, $packages, $min_level, $max_size, $install_class) = @_; - my $ind = $compssListLevels->{$install_class} or log::l("unknown install class $install_class in compssList"), return; + my $ind = $compssListLevels->{$install_class}; defined $ind or log::l("unknown install class $install_class in compssList"), return; my @packages = allPackages($packages); my @places = do { |