summaryrefslogtreecommitdiffstats
path: root/perl-install/commands.pm
Commit message (Expand)AuthorAgeFilesLines
* cleanup & kernel 2.6 .ko adaptationPascal Rigaux2004-01-201-23/+10
* perl_checker compliancePascal Rigaux2004-01-061-5/+0
* fix bug (detected by perl_checker!)Pascal Rigaux2003-12-151-1/+1
* pci hardware discovery: do full-probe by defaultThierry Vignaud2003-08-191-1/+1
* remove mkswap from commands.pm, so no need anymore to have mkswap_ (the drawb...Pascal Rigaux2003-07-161-7/+1
* perl_checker adaptations + fixesPascal Rigaux2003-04-241-6/+6
* fixed command insmod.Francois Pons2003-02-171-1/+2
* perl_checker compliance ("ref" now need parentheses in many case)Pascal Rigaux2003-02-121-2/+2
* remove unused variables or rename them with an underscore (eg: $o becomes $_o)Pascal Rigaux2002-12-041-2/+2
* do not use "local my $F, ...", use "local(my $F, ...) insteadPascal Rigaux2002-12-031-1/+1
* remove pack_ and unpack_ (unused)Pascal Rigaux2002-12-031-42/+2
* fix "ps" and "df" (were broken due to localization of *DF and *PS)Pascal Rigaux2002-11-281-5/+3
* perl_checker adaptationsPascal Rigaux2002-11-271-10/+10
* - add/remove spaces to make perl_checker happyPascal Rigaux2002-11-141-9/+9
* add/remove some spaces to make perl_checker happyPascal Rigaux2002-11-121-2/+2
* add or remove spaces where need to please perl_checkerPascal Rigaux2002-11-111-4/+6
* - do not use "foreach $var (...) {...}" use "foreach my $var (...) {...}" ins...Pascal Rigaux2002-11-111-11/+13
* - have "local *FILEHANDLE" before each "open FILEHANDLE, ..."Pascal Rigaux2002-11-061-1/+3
* (cp): use cp_afPascal Rigaux2002-11-061-36/+2
* please perl_checker:Pascal Rigaux2002-11-061-6/+14
* make perl_checker happyPascal Rigaux2002-08-051-1/+1
* s/__END__/1;Thierry Vignaud2002-08-051-1/+1
* kill "wonderful perl"Thierry Vignaud2002-08-051-5/+1
* - the old $o->{keyboard} is now $o->{keyboard}{KEYBOARD}Pascal Rigaux2002-08-011-1/+1
* make new perl_checker happyPascal Rigaux2002-07-311-1/+2
* make new perl_checker happy (and that's not easy!)Pascal Rigaux2002-07-311-10/+10
* remove "$_ =~ " (as detected by new perl_checker)Pascal Rigaux2002-07-171-1/+1
* adapt to new modprobe.pmPascal Rigaux2002-07-061-1/+1
* adapt to new modules.pmPascal Rigaux2002-07-041-2/+2
* make lspci a full pci probe instead of safe pci probe.Francois Pons2001-09-181-1/+1
* use new mkdir_p, rm_rf and cp_af from MDK::CommonPascal Rigaux2001-09-161-14/+2
* (sync): (re-?)addPascal Rigaux2001-08-031-0/+2
* do not export sync, keep it in common (esp. so that it doesn't conflict with ...Pascal Rigaux2001-07-251-1/+1
* move to MDK::Common, bool->to_boolPascal Rigaux2001-07-241-6/+7
* fix syntaxPascal Rigaux2001-07-241-1/+1
* removed/renamed unused/seldom-used functionsPascal Rigaux2001-07-241-2/+2
* generalize the use of chomp_ as the functional alternative to chomp (and work...Pascal Rigaux2001-07-241-2/+2
* (grep_): add a missing semi-colonPascal Rigaux2001-06-111-1/+1
* fixed log of packdrake.Francois Pons2001-04-121-2/+1
* - move report_bug in install_anyPascal Rigaux2001-04-051-29/+2
* fix typoPascal Rigaux2001-03-281-2/+1
* add fstab in the logPascal Rigaux2001-03-281-2/+6
* fixed live update between GLIBC 2.1 and GLIBC 2.2. should work for otherFrancois Pons2001-03-121-4/+4
* (loadkeys): createdPascal Rigaux2001-03-121-0/+7
* *** empty log message ***Stew Benedict2001-03-031-1/+1
* (more): handle 'q' to quitPascal Rigaux2001-02-241-1/+5
* call /usr/bin/insmod_ with full pathPascal Rigaux2001-02-221-1/+1
* (head_tail): fix usagePascal Rigaux2001-02-051-1/+1
* removed need of packdrake binaryFrancois Pons2001-01-051-1/+6
* report_bug: created, returns a stringPascal Rigaux2000-12-081-9/+12
wb">@diff2 == 1) { @new_flags = (@common, join('||', $diff1[0], $diff2[0])); } else { log::l("$line_nb: can not handle complicate flags for packages appearing twice ($name)"); $fatal_error++; } log::l("$line_nb: package $name appearing twice with different rates ($rate != " . $rates{$name} . ")") if $rate != $rates{$name}; } $rates{$name} = $rate; $flags{$name} = \@new_flags; } push @l, @l2; } else { push @l, [ $l2[0][0], $l2[-1][1] ]; } } $fatal_error and die "$fatal_error fatal errors in rpmsrate"; \%rates, \%flags, \@need_to_copy; } sub read_rpmsrate { my ($packages, $rpmsrate_flags_chosen, $file, $match_all_hardware) = @_; my ($rates, $flags, $need_to_copy) = read_rpmsrate_raw($file); my ($TYPEs, @probeall); if (!$match_all_hardware) { $TYPEs = detect_devices::matching_types(); @probeall = detect_devices::probeall(); } foreach (keys %$flags) { my @flags = @{$flags->{$_}}; my $p; if ($::isInstall) { $p = install::pkgs::packageByName($packages, $_) or next; if (my @l = map { /locales-(.*)/ ? qq(LOCALES"$1") : () } $p->requires_nosense) { if (@l > 1) { log::l("ERROR: package $_ is requiring many locales") if $_ ne 'lsb'; } else { push @flags, @l; } } } @flags = map { my ($user_flags, $known_flags) = partition { /^!?CAT_/ } split('\|\|', $_); my $ok = find { my $inv = s/^!//; return 0 if $::isStandalone && $inv; if (my ($p) = /^HW"(.*)"/) { $match_all_hardware ? 1 : ($inv xor find { $_->{description} =~ /$p/i } @probeall); } elsif (($p) = /^DRIVER"(.*)"/) { $match_all_hardware ? 1 : ($inv xor find { $_->{driver} =~ /$p/i } @probeall); } elsif (($p) = /^TYPE"(.*)"/) { $match_all_hardware ? 1 : ($inv xor $TYPEs->{$p}); } elsif (($p) = /^HW_CAT"(.*)"/) { $match_all_hardware ? 1 : ($inv xor detect_devices::probe_category($p)); } else { $inv xor $rpmsrate_flags_chosen->{$_}; } } @$known_flags; $ok ? 'TRUE' : @$user_flags ? join('||', @$user_flags) : 'FALSE'; } @flags; if ($::isInstall) { $p->set_rate($rates->{$_}); $p->set_rflags(member('FALSE', @flags) ? 'FALSE' : @flags); } else { $flags->{$_} = \@flags; } } push @{$packages->{needToCopy} ||= []}, @$need_to_copy if ref($packages); return ($rates, $flags); } sub simple_read_rpmsrate { my ($o_match_all_hardware) = @_; my ($rates, $flags) = read_rpmsrate({}, {}, $::prefix . '/usr/share/meta-task/rpmsrate-raw', $o_match_all_hardware); grep { member('TRUE', @{$flags->{$_}}) && $rates->{$_} >= 5 } keys %$flags; } sub detect_rpmsrate_hardware_packages { my ($o_match_all_hardware) = @_; grep { !/openoffice/ } simple_read_rpmsrate($o_match_all_hardware); } sub detect_graphical_drivers { my ($do_pkgs, $o_match_all_hardware) = @_; require Xconfig::card; require Xconfig::proprietary; my @cards; if ($o_match_all_hardware) { my $all_cards = Xconfig::card::readCardsDB("$ENV{SHARE_PATH}/ldetect-lst/Cards+"); @cards = values %$all_cards; } else { @cards = Xconfig::card::probe(); } my @drivers = grep { $_ } uniq(map { $_->{Driver2} } @cards); map { Xconfig::proprietary::pkgs_for_Driver2($_, $do_pkgs) } @drivers; } sub detect_network_drivers { my ($do_pkgs, $o_match_all_hardware) = @_; require network::connection; require network::thirdparty; my @l; foreach my $type (network::connection->get_types) { $type->can('get_thirdparty_settings') or next; my @network_settings; my @all_settings = @{$type->get_thirdparty_settings || []}; if ($o_match_all_hardware) { @network_settings = @all_settings; } else { my @connections = $type->get_connections(automatic_only => 1, fast_only => 1); @network_settings = map { network::thirdparty::find_settings(\@all_settings, $_->get_driver) } @connections; } foreach my $settings (@network_settings) { foreach (@network::thirdparty::thirdparty_types) { my @packages = network::thirdparty::get_required_packages($_, $settings); push @l, network::thirdparty::get_available_packages($_, $do_pkgs, @packages); } } } @l; } sub detect_hardware_packages { my ($do_pkgs, $o_match_all_hardware) = @_; ( ($::isInstall ? () : detect_rpmsrate_hardware_packages($o_match_all_hardware)), detect_graphical_drivers($do_pkgs, $o_match_all_hardware), detect_network_drivers($do_pkgs, $o_match_all_hardware), ); } sub detect_unused_hardware_packages { my ($do_pkgs) = @_; my @all_hardware_packages = detect_hardware_packages($do_pkgs, 'match_all_hardware'); my @used_hardware_packages = detect_hardware_packages($do_pkgs); my @unneeded_hardware_packages = difference2(\@all_hardware_packages, \@used_hardware_packages); $do_pkgs->are_installed(@unneeded_hardware_packages); } sub detect_unselected_locale_packages { my ($do_pkgs) = @_; require lang; my $locales_prefix = 'locales-'; my $locale = lang::read(); my $selected_locale = $locales_prefix . $locale->{lang}; my @available_locales = $do_pkgs->are_installed($locales_prefix . '*'); member($selected_locale, @available_locales) ? difference2(\@available_locales, [ $selected_locale ]) : (); } sub remove_unused_packages { my ($in, $do_pkgs) = @_; my $wait; $wait = $in->wait_message(N("Unused packages removal"), N("Finding unused hardware packages...")); my @unused_hardware_packages = detect_unused_hardware_packages($do_pkgs); undef $wait; $wait = $in->wait_message(N("Unused packages removal"), N("Finding unused localization packages...")); my @unselected_locales = detect_unselected_locale_packages($do_pkgs); undef $wait; @unused_hardware_packages || @unselected_locales or return; my $hardware = @unused_hardware_packages; my $locales = @unselected_locales; $in->ask_from( N("Unused packages removal"), N("We have detected that some packages are not needed for your system configuration.") . "\n" . N("We will remove the following packages, unless you choose otherwise:"), [ if_(@unused_hardware_packages, { text => N("Unused hardware support"), val => \$hardware, type => "bool" }, { label => N("Unused hardware support") . "\n" . join("\n", map { " " . $_ } sort(@unused_hardware_packages)), advanced => 1 }, ), if_(@unselected_locales, { text => N("Unused localization"), val => \$locales, type => "bool" }, { label => N("Unused localization") . "\n" . join("\n", map { " " . $_ } sort(@unselected_locales)), advanced => 1 }, ), ], if_($::isWizard, cancel => N("Skip")), ) && ($hardware || $locales) or return; #- we should have some gurpme $wait = $in->wait_message(N("Please wait"), N("Removing packages...")); run_program::run('urpme', '--auto', if_($hardware, @unused_hardware_packages), if_($locales, @unselected_locales), ); #- use script from One to list language files (/usr/share/locale mainly) and remove them? } 1;