diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2001-08-08 18:26:31 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2001-08-08 18:26:31 +0000 |
commit | 157fe13a76e798fa8af5f79c792c704a593f6c93 (patch) | |
tree | 7dded9e6761033f09709722965d15b14ce7825bd | |
parent | b4fd82d0ced6a2118a51b060d2eff8c4f179b52b (diff) | |
download | drakx-backup-do-not-use-157fe13a76e798fa8af5f79c792c704a593f6c93.tar drakx-backup-do-not-use-157fe13a76e798fa8af5f79c792c704a593f6c93.tar.gz drakx-backup-do-not-use-157fe13a76e798fa8af5f79c792c704a593f6c93.tar.bz2 drakx-backup-do-not-use-157fe13a76e798fa8af5f79c792c704a593f6c93.tar.xz drakx-backup-do-not-use-157fe13a76e798fa8af5f79c792c704a593f6c93.zip |
add interactive_pkgs stuff
-rw-r--r-- | perl-install/Xconfigurator.pm | 6 | ||||
-rw-r--r-- | perl-install/any.pm | 4 | ||||
-rw-r--r-- | perl-install/bootlook.pm | 10 | ||||
-rw-r--r-- | perl-install/install_any.pm | 51 | ||||
-rw-r--r-- | perl-install/install_steps.pm | 2 | ||||
-rw-r--r-- | perl-install/install_steps_interactive.pm | 2 | ||||
-rw-r--r-- | perl-install/network/adsl.pm | 8 | ||||
-rw-r--r-- | perl-install/network/ethernet.pm | 12 | ||||
-rw-r--r-- | perl-install/network/isdn.pm | 4 | ||||
-rw-r--r-- | perl-install/network/modem.pm | 4 | ||||
-rw-r--r-- | perl-install/network/netconnect.pm | 13 | ||||
-rw-r--r-- | perl-install/network/network.pm | 9 | ||||
-rw-r--r-- | perl-install/network/tools.pm | 2 | ||||
-rw-r--r-- | perl-install/printer.pm | 15 | ||||
-rw-r--r-- | perl-install/printerdrake.pm | 9 | ||||
-rw-r--r-- | perl-install/proxy.pm | 2 | ||||
-rw-r--r-- | perl-install/standalone.pm | 21 | ||||
-rwxr-xr-x | perl-install/standalone/XFdrake | 4 | ||||
-rwxr-xr-x | perl-install/standalone/adduserdrake | 2 | ||||
-rwxr-xr-x | perl-install/standalone/drakgw | 5 | ||||
-rwxr-xr-x | perl-install/standalone/draknet | 10 | ||||
-rwxr-xr-x | perl-install/standalone/drakproxy | 5 | ||||
-rw-r--r-- | perl-install/tinyfirewall.pm | 2 |
23 files changed, 119 insertions, 83 deletions
diff --git a/perl-install/Xconfigurator.pm b/perl-install/Xconfigurator.pm index e15a5c899..4d420af95 100644 --- a/perl-install/Xconfigurator.pm +++ b/perl-install/Xconfigurator.pm @@ -2,7 +2,7 @@ package Xconfigurator; # $Id$ use diagnostics; use strict; -use vars qw($in $install @window_managers @depths @monitorSize2resolution @hsyncranges %min_hsync4wres @vsyncranges %depths @resolutions @resolutions_laptop %serversdriver @svgaservers @accelservers @allbutfbservers @allservers %vgamodes %videomemory @ramdac_name @ramdac_id @clockchip_name @clockchip_id %keymap_translate %standard_monitors $XF86firstchunk_text $keyboardsection_start $keyboardsection_start_v4 $keyboardsection_part2 $keyboardsection_part3 $keyboardsection_part3_v4 $keyboardsection_end $pointersection_text $monitorsection_text1 $monitorsection_text2 $monitorsection_text3 $monitorsection_text4 $modelines_text_Trident_TG_96xx $modelines_text_ext $modelines_text $devicesection_text $devicesection_text_v4 $screensection_text1 %lines @options %xkb_options $good_default_monitor $low_default_monitor $layoutsection_v4 $modelines_text_apple); +use vars qw($in @window_managers @depths @monitorSize2resolution @hsyncranges %min_hsync4wres @vsyncranges %depths @resolutions @resolutions_laptop %serversdriver @svgaservers @accelservers @allbutfbservers @allservers %vgamodes %videomemory @ramdac_name @ramdac_id @clockchip_name @clockchip_id %keymap_translate %standard_monitors $XF86firstchunk_text $keyboardsection_start $keyboardsection_start_v4 $keyboardsection_part2 $keyboardsection_part3 $keyboardsection_part3_v4 $keyboardsection_end $pointersection_text $monitorsection_text1 $monitorsection_text2 $monitorsection_text3 $monitorsection_text4 $modelines_text_Trident_TG_96xx $modelines_text_ext $modelines_text $devicesection_text $devicesection_text_v4 $screensection_text1 %lines @options %xkb_options $good_default_monitor $low_default_monitor $layoutsection_v4 $modelines_text_apple); use common; use log; @@ -404,7 +404,7 @@ NOTE THIS IS EXPERIMENTAL SUPPORT AND MAY FREEZE YOUR COMPUTER.", $xf3_ver)) . " $card->{server} = 'Xpmac'; } - -x "$prefix$card->{prog}" or $install && $install->($card->{use_xf4} ? 'XFree86-server' : "XFree86-$card->{server}", @l); + -x "$prefix$card->{prog}" or $in->do_pkgs->install->($card->{use_xf4} ? 'XFree86-server' : "XFree86-$card->{server}", @l); -x "$prefix$card->{prog}" or die "server $card->{server} is not available (should be in $prefix$card->{prog})"; #- check for Matrox G200 PCI cards, disable AGP in such cases, causes black screen else. @@ -1377,7 +1377,7 @@ sub show_info { #- Program entry point. sub main { - ($prefix, my $o, $in, my $cardOptions, $install) = @_; + ($prefix, my $o, $in, my $cardOptions) = @_; $o ||= {}; XF86check_link(''); diff --git a/perl-install/any.pm b/perl-install/any.pm index 86bdd4b8d..3e4fb99a0 100644 --- a/perl-install/any.pm +++ b/perl-install/any.pm @@ -403,12 +403,12 @@ sub inspect { #-----modem conf sub pppConfig { - my ($in, $modem, $prefix, $install) = @_; + my ($in, $modem, $prefix) = @_; $modem or return; symlinkf($modem->{device}, "$prefix/dev/modem") or log::l("creation of $prefix/dev/modem failed") if $modem->{device} ne "/dev/modem"; - $install->(qw(ppp)) unless $::testing; + $in->do_pkgs->install->('ppp') if !$::testing; my %toreplace; $toreplace{$_} = $modem->{$_} foreach qw(connection phone login passwd auth domain dns1 dns2); diff --git a/perl-install/bootlook.pm b/perl-install/bootlook.pm index d74159630..1cda66f6f 100644 --- a/perl-install/bootlook.pm +++ b/perl-install/bootlook.pm @@ -337,19 +337,19 @@ sub updateAurora if ($a_mode) { if ($a_c_button->get_active()) { symlinkf("/lib/aurora/Monitors/NewStyle-Categorizing-WsLib", "/etc/aurora/Monitor"); - $in->standalone::pkgs_install(q(Aurora-Monitor-NewStyle-Categorizing-WsLib)) if !(-e "/lib/aurora/Monitors/NewStyle-Categorizing-WsLib"); + $in->do_pkgs->install(q(Aurora-Monitor-NewStyle-Categorizing-WsLib)) if !(-e "/lib/aurora/Monitors/NewStyle-Categorizing-WsLib"); } if ($a_h_button->get_active()) { symlinkf("/lib/aurora/Monitors/NewStyle-WsLib", "/etc/aurora/Monitor"); - $in->standalone::pkgs_install(q(Aurora-Monitor-NewStyle-WsLib)) if !(-e "/lib/aurora/Monitors/NewStyle-WsLib"); + $in->do_pkgs->install(q(Aurora-Monitor-NewStyle-WsLib)) if !(-e "/lib/aurora/Monitors/NewStyle-WsLib"); } if ($a_v_button->get_active()) { symlinkf("/lib/aurora/Monitors/Traditional-WsLib", "/etc/aurora/Monitor"); - $in->standalone::pkgs_install(q(Aurora-Monitor-Traditional-WsLib)) if !(-e "/lib/aurora/Monitors/Traditional-WsLib"); + $in->do_pkgs->install(q(Aurora-Monitor-Traditional-WsLib)) if !(-e "/lib/aurora/Monitors/Traditional-WsLib"); } if ($a_g_button->get_active()) { symlinkf("/lib/aurora/Monitors/Traditional-Gtk+", "/etc/aurora/Monitor"); - $in->standalone::pkgs_install(q(Aurora-Monitor-Traditional-Gtk+)) if !(-e "/lib/aurora/Monitors/Traditional-Gtk+"); + $in->do_pkgs->install(q(Aurora-Monitor-Traditional-Gtk+)) if !(-e "/lib/aurora/Monitors/Traditional-Gtk+"); } } else { unlink "/etc/aurora/Monitor"; @@ -392,7 +392,7 @@ sub updateAutologin my ($usern,$deskt)=($user_combo->entry->get_text(), $desktop_combo->entry->get_text()); if ($x_yes_button->get_active()) { - $in->standalone::pkgs_install(q(autologin)) if $x_mode; + $in->do_pkgs->install(q(autologin)) if $x_mode; set_autologin('',$usern,$deskt); } else { set_autologin('',undef) if ($x_no_button->get_active()); diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm index b76941b94..5babb5bd5 100644 --- a/perl-install/install_any.pm +++ b/perl-install/install_any.pm @@ -959,4 +959,55 @@ sub remove_bigseldom_used { ); } + +################################################################################ +package interactive_pkgs; +use run_program; +use common; +use pkgs; + +sub interactive::do_pkgs { + my ($o) = @_; + bless { o => $o }, 'interactive_pkgs'; +} + +sub install { + my ($do, @l) = @_; + $do->{o}->pkg_install(@l); +} + +sub is_installed { + my ($do, @l) = @_; + foreach (@l) { + my $p = pkgs::packageByName($do->{o}->{packages}, $_); + $p && pkgs::packageFlagSelected($p) or return; + } + 1; +} + +sub remove { + my ($do, @l) = @_; + + @l = grep { + my $p = pkgs::packageByName($do->{o}->{packages}, $_); + pkgs::unselectPackage($do->{o}->{packages}, $p) if $p; + $p; + } + run_program::rooted($do->{o}->{prefix}, 'rpm', '-e', @l); +} + +sub remove_nodeps { + my ($do, @l) = @_; + + @l = grep { + my $p = pkgs::packageByName($do->{o}->{packages}, $_); + pkgs::packageSetFlagSelected($p, 0) if $p; + $p; + } + run_program::rooted($do->{o}->{prefix}, 'rpm', '-e', '--nodeps', @l); +} +################################################################################ + +package install_any; + 1; diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm index 3aa94cf65..00594b950 100644 --- a/perl-install/install_steps.pm +++ b/perl-install/install_steps.pm @@ -838,7 +838,7 @@ sub configureX { Xconfigurator::main($o->{prefix}, $o->{X}, class_discard->new, { allowFB => $o->{allowFB}, allowNVIDIA_rpms => install_any::allowNVIDIA_rpms($o->{packages}), - }, sub { $o->pkg_install(@_) }); + }); } $o->configureXAfter; } diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm index f9e0ffd6d..b0724180a 100644 --- a/perl-install/install_steps_interactive.pm +++ b/perl-install/install_steps_interactive.pm @@ -1145,7 +1145,7 @@ sub configureX { Xconfigurator::main($o->{prefix}, $o->{X}, $o, { allowFB => $o->{allowFB}, allowNVIDIA_rpms => install_any::allowNVIDIA_rpms($o->{packages}), - }, sub { $o->pkg_install(@_) }); + }); } $o->configureXAfter; } diff --git a/perl-install/network/adsl.pm b/perl-install/network/adsl.pm index 4e655e94b..a922585cc 100644 --- a/perl-install/network/adsl.pm +++ b/perl-install/network/adsl.pm @@ -6,7 +6,7 @@ use network::tools; use network::ethernet; use vars qw(@ISA @EXPORT); -use MDK::Common::Globals "network", qw($in $prefix $install $connect_file $disconnect_file); +use MDK::Common::Globals "network", qw($in $prefix $connect_file $disconnect_file); @ISA = qw(Exporter); @EXPORT = qw(adsl_ask_info adsl_detect adsl_conf adsl_conf_backend); @@ -21,7 +21,7 @@ Some connections use pptp, a few ones use dhcp. If you don't know, choose 'use pppoe'"), [__("use pppoe"), __("use pptp"), __("use dhcp")]) or return; $type =~ s/use //; if ($type eq 'pppoe') { - $install->("rp-$type"); + $in->do_pkgs->install("rp-$type"); $netcnx->{type} = "adsl_$type"; $netcnx->{"adsl_$type"} = {}; adsl_conf($netcnx->{"adsl_$type"}, $netc, $intf, $type) or goto conf_adsl_step1; @@ -33,11 +33,11 @@ If you don't know, choose 'use pppoe'"), [__("use pppoe"), __("use pptp"), __("u } } if ($type eq 'dhcp') { - $install->(qw(dhcpcd)); + $in->do_pkgs->install(qw(dhcpcd)); go_ethernet($netc, $intf, 'dhcp', '', '', $first_time) or goto conf_adsl_step1; } if ($type eq 'pptp') { - $install->(qw(pptp-adsl-fr)); + $in->do_pkgs->install(qw(pptp-adsl-fr)); $netcnx->{type} = "adsl_$type"; $netcnx->{"adsl_$type"} = {}; adsl_conf($netcnx->{"adsl_$type"}, $netc, $intf, $type) or goto conf_adsl_step1; diff --git a/perl-install/network/ethernet.pm b/perl-install/network/ethernet.pm index 0c5a70b19..adf3388bd 100644 --- a/perl-install/network/ethernet.pm +++ b/perl-install/network/ethernet.pm @@ -8,7 +8,7 @@ use common; use run_program; use network::tools; use vars qw(@ISA @EXPORT); -use MDK::Common::Globals "network", qw($in $prefix $install); +use MDK::Common::Globals "network", qw($in $prefix); @ISA = qw(Exporter); @EXPORT = qw(configureNetwork conf_network_card conf_network_card_backend go_ethernet); @@ -38,12 +38,12 @@ sub configure_cable { Default is dhcpcd"), sub { $_[0]{description} }, \@m )) { - $f->{c}==1 and $netcnx->{dhcp_client}="dhcpcd" and $install->(qw(dhcpcd)); - $f->{c}==3 and $netcnx->{dhcp_client}="dhcpxd" and $install->(qw(dhcpxd)); - $f->{c}==4 and $netcnx->{dhcp_client}="dhcp-client" and $install->(qw(dhcp-client)); + $f->{c}==1 and $netcnx->{dhcp_client}="dhcpcd" and $in->do_pkgs->install(qw(dhcpcd)); + $f->{c}==3 and $netcnx->{dhcp_client}="dhcpxd" and $in->do_pkgs->install(qw(dhcpxd)); + $f->{c}==4 and $netcnx->{dhcp_client}="dhcp-client" and $in->do_pkgs->install(qw(dhcp-client)); } } else { - $install->(qw(dhcpcd)); + $in->do_pkgs->install(qw(dhcpcd)); } go_ethernet($netc, $intf, 'dhcp', '', '', $first_time); write_cnx_script($netc, "cable", @@ -62,7 +62,7 @@ sub configure_lan { $::isInstall and $in->set_help('configureNetworkIP'); require Data::Dumper; configureNetwork($netc, $intf, $first_time) or return; - configureNetwork2($in, $prefix, $netc, $intf, $install); + configureNetwork2($in, $prefix, $netc, $intf); if ($::isStandalone and ($::expert or $in->ask_yesorno(_("Network configuration"), _("Do you want to restart the network"), 1))) { run_program::rooted($prefix, "/etc/rc.d/init.d/network stop"); diff --git a/perl-install/network/isdn.pm b/perl-install/network/isdn.pm index e80a625ba..24d11d7d4 100644 --- a/perl-install/network/isdn.pm +++ b/perl-install/network/isdn.pm @@ -8,7 +8,7 @@ use run_program; use log; use network::tools; use vars qw(@ISA @EXPORT); -use MDK::Common::Globals "network", qw($in $prefix $install); +use MDK::Common::Globals "network", qw($in $prefix); use MDK::Common::File; @ISA = qw(Exporter); @EXPORT = qw(isdn_write_config isdn_write_config_backend get_info_providers_backend isdn_ask_info isdn_ask_protocol isdn_ask isdn_detect isdn_detect_backend isdn_get_list isdn_get_info); @@ -59,7 +59,7 @@ We recommand the light configuration. $p && pkgs::packageFlagSelected($p) and pkgs::unselectPackage($in->{packages}, $p); } run_program::rooted($prefix, "rpm", "-e", "$rmpackage"); - $install->($instpackage, if_($isdn->{speed} =~ /128/, 'ibod'), 'isdn4k-utils'); + $in->do_pkgs->install($instpackage, if_($isdn->{speed} =~ /128/, 'ibod'), 'isdn4k-utils'); my $light = $e =~ /light/ ? 1 : 0; isdn_write_config_backend($isdn, $light, $netc); 1; diff --git a/perl-install/network/modem.pm b/perl-install/network/modem.pm index 206f8dfb0..f06c60219 100644 --- a/perl-install/network/modem.pm +++ b/perl-install/network/modem.pm @@ -7,7 +7,7 @@ use detect_devices; use mouse; use network::tools; use vars qw(@ISA @EXPORT); -use MDK::Common::Globals "network", qw($in $prefix $install); +use MDK::Common::Globals "network", qw($in $prefix); @ISA = qw(Exporter); @EXPORT = qw(pppConfig modem_detect_backend); @@ -51,7 +51,7 @@ sub pppConfig { { label => _("First DNS Server (optional)"), val => \$modem->{dns1} }, { label => _("Second DNS Server (optional)"), val => \$modem->{dns2} }, ]) or return; - any::pppConfig($in, $modem, $prefix, $install); + any::pppConfig($in, $modem, $prefix); $netc->{$_}='ppp0' foreach 'NET_DEVICE', 'NET_INTERFACE'; 1; } diff --git a/perl-install/network/netconnect.pm b/perl-install/network/netconnect.pm index b9ac8f677..e5dff7d89 100644 --- a/perl-install/network/netconnect.pm +++ b/perl-install/network/netconnect.pm @@ -17,12 +17,12 @@ use commands; #require Data::Dumper; use network::tools; -use MDK::Common::Globals "network", qw($in $prefix $install $connect_file $disconnect_file $connect_prog); +use MDK::Common::Globals "network", qw($in $prefix $connect_file $disconnect_file $connect_prog); #- intro is called only in standalone. sub intro { - my ($prefix, $netcnx, $in, $install) = @_; + my ($prefix, $netcnx, $in) = @_; my ($netc, $mouse, $intf) = ({}, {}, {}); my $text; my $connected; @@ -52,9 +52,9 @@ sub intro { \@l ); run_program::rooted($prefix, $connect_prog) if ($e->{c}==1); run_program::rooted($prefix, $disconnect_file) if ($e->{c}==2); - main($prefix, $netcnx, $netc, $mouse, $in, $intf, $install, 0, 0) if ($e->{c}==3); + main($prefix, $netcnx, $netc, $mouse, $in, $intf, 0, 0) if ($e->{c}==3); } else { - main($prefix, $netcnx, $netc, $mouse, $in, $intf, $install, 0, 0); + main($prefix, $netcnx, $netc, $mouse, $in, $intf, 0, 0); } } @@ -110,11 +110,10 @@ sub pre_func { } sub main { - my ($prefix, $netcnx, $netc, $mouse, $in, $intf, $install, $first_time, $direct_fr) = @_; + my ($prefix, $netcnx, $netc, $mouse, $in, $intf, $first_time, $direct_fr) = @_; MDK::Common::Globals::init( in => $in, prefix => $prefix, - install => $install, connect_file => "/etc/sysconfig/network-scripts/net_cnx_up", disconnect_file => "/etc/sysconfig/network-scripts/net_cnx_down", connect_prog => "/etc/sysconfig/network-scripts/net_cnx_pg" ); @@ -236,7 +235,7 @@ environnement to avoid hostname changing problem.")); step_5: - network::configureNetwork2($in, $prefix, $netc, $intf, $install); + network::configureNetwork2($in, $prefix, $netc, $intf); if ($netcnx->{type} =~ /modem/ || $netcnx->{type} =~ /isdn_external/) { output "$prefix$connect_prog", diff --git a/perl-install/network/network.pm b/perl-install/network/network.pm index ecf7823c2..628b9278a 100644 --- a/perl-install/network/network.pm +++ b/perl-install/network/network.pm @@ -390,7 +390,6 @@ sub read_all_conf { #- $prefix #- $netc #- $intf -#- $install : a function that takes a list of package and install them : ex sub { system("urpmi --auto --best-output " . join(' ', @_)); } #- $netc input #- NETWORKING : networking flag : string : "yes" by default #- FORWARD_IPV4 : forward IP flag : string : "false" by default @@ -411,20 +410,20 @@ sub read_all_conf { #- $intf->{$device}{DEVICE} : DEVICE = $device #- $intf->{$device}{BOOTPROTO} : boot prototype : "bootp" or "dhcp" or "pump" or ... sub configureNetwork2 { - my ($in, $prefix, $netc, $intf, $install) = @_; + my ($in, $prefix, $netc, $intf) = @_; my $etc = "$prefix/etc"; - $netc->{wireless_eth} and $install->('wireless-tools'); + $netc->{wireless_eth} and $in->do_pkgs->install('wireless-tools'); write_conf("$etc/sysconfig/network", $netc); write_resolv_conf("$etc/resolv.conf", $netc); write_interface_conf("$etc/sysconfig/network-scripts/ifcfg-$_->{DEVICE}", $_) foreach grep { $_->{DEVICE} } values %$intf; add2hosts("$etc/hosts", $netc->{HOSTNAME}, map { $_->{IPADDR} } values %$intf); if (grep { $_->{BOOTPROTO} =~ /^(dhcp)$/ } values %$intf) { - $::isStandalone ? $in->standalone::pkgs_install('dhcpcd') : $install->('dhcpcd'); + $in->do_pkgs->install('dhcpcd'); } if (grep { $_->{BOOTPROTO} =~ /^(pump|bootp)$/ } values %$intf) { - $::isStandalone ? $in->standalone::pkgs_install('pump') : $install->('pump'); + $in->do_pkgs->install('pump'); } #-res_init(); #- reinit the resolver so DNS changes take affect diff --git a/perl-install/network/tools.pm b/perl-install/network/tools.pm index 8102c1ae3..ecd1f1974 100644 --- a/perl-install/network/tools.pm +++ b/perl-install/network/tools.pm @@ -3,7 +3,7 @@ package network::tools; use common; use run_program; use vars qw(@ISA @EXPORT); -use MDK::Common::Globals "network", qw($in $prefix $install $disconnect_file $connect_prog $connect_file $disconnect_file); +use MDK::Common::Globals "network", qw($in $prefix $disconnect_file $connect_prog $connect_file $disconnect_file); @ISA = qw(Exporter); @EXPORT = qw(write_cnx_script write_secret_backend ask_connect_now connect_backend disconnect_backend read_providers_backend ask_info2 connected disconnected); diff --git a/perl-install/printer.pm b/perl-install/printer.pm index 91e11bdf3..6b5fe10df 100644 --- a/perl-install/printer.pm +++ b/perl-install/printer.pm @@ -100,21 +100,6 @@ sub stop_service ($) { || die "Could not stop $service!"; } -sub installed ($) { - my ($package) = @_; - open RPMCHECK, "rpm -qa --root $prefix/ | grep $package |" || - die "Could not run rpm!"; - my $found = 0; - while (<RPMCHECK>) { - if ($_ =~ m/^$package\-.+\-.+mdk/) { - $found = 1; - last; - } - } - close RPMCHECK; - return $found; -} - sub copy_printer_params($$) { my ($from, $to) = @_; map { $to->{$_} = $from->{$_} } grep { $_ ne 'configured' } keys %$from; diff --git a/perl-install/printerdrake.pm b/perl-install/printerdrake.pm index 49a392312..71b2159fb 100644 --- a/perl-install/printerdrake.pm +++ b/perl-install/printerdrake.pm @@ -131,7 +131,7 @@ complete => sub { #- LPD does not support filtered queues to a remote LPD server by itself #- It needs an additional program as "rlpr" - if ($printer->{SPOOLER} eq 'lpd') {$in->do_pkgs->install('rlpr');} + $printer->{SPOOLER} eq 'lpd' and $in->do_pkgs->install('rlpr'); 1; } @@ -336,8 +336,7 @@ complete => sub { join '', ("socket://$remotehost", $remoteport ? (":$remoteport") : ()); #- LPD and LPRng need netcat ('nc') to access to socket printers - if (($printer->{SPOOLER} eq 'lpd') || - ($printer->{SPOOLER} eq 'lprng')) {$in->do_pkgs->install('nc');} + $printer->{SPOOLER} eq 'lpd' || $printer->{SPOOLER} eq 'lprng' and $in->do_pkgs->install('nc'); 1; } @@ -742,8 +741,8 @@ sub main { # printerdrake does not work without foomatic, and for more convenience # we install some more stuff if (!$::testing) { - $in->do_pkgs->install(('foomatic', 'printer-utils','printer-testpages', - ($in->do_pkgs->is_installed("gimp") ? 'gimpprint' : ()))); + $in->do_pkgs->install('foomatic', 'printer-utils','printer-testpages', + if_($in->do_pkgs->is_installed('gimp'), 'gimpprint')); } # only experts should be asked for the spooler diff --git a/perl-install/proxy.pm b/perl-install/proxy.pm index 22d34d371..fdb5c3a4d 100644 --- a/perl-install/proxy.pm +++ b/perl-install/proxy.pm @@ -9,7 +9,7 @@ use c; sub main { - my ($prefix, $in, $install) = @_; + my ($prefix, $in) = @_; my $proxy_cfg = {}; my $config_file = "$prefix/usr/lib/wgetrc"; diff --git a/perl-install/standalone.pm b/perl-install/standalone.pm index 7cb1d2dd7..60f21b729 100644 --- a/perl-install/standalone.pm +++ b/perl-install/standalone.pm @@ -11,6 +11,7 @@ c::bindtextdomain('libDrakX', "/usr/share/locale"); +################################################################################ package interactive_pkgs; sub interactive::do_pkgs { @@ -21,22 +22,20 @@ sub interactive::do_pkgs { sub install { my ($o, @l) = @_; $o->{in}->suspend; - my $ret = system('urpmi', '--auto', '--best-output', @l); + my $ret = system('urpmi', '--auto', '--best-output', @l) == 0; $o->{in}->resume; $ret; } -sub install_if { - my ($o, $deps, @l) = @_; - my @deps = deref($deps); - system('rpm', '-q', @deps) == 0 or return; - install($o, @l); +sub is_installed { + my ($o, @l) = @_; + system('rpm', '-q', @l) == 0; } sub remove { my ($o, @l) = @_; $o->{in}->suspend; - my $ret = system('rpm', '-e', @l); + my $ret = system('rpm', '-e', @l) == 0; $o->{in}->resume; $ret; } @@ -44,14 +43,12 @@ sub remove { sub remove_nodeps { my ($o, @l) = @_; $o->{in}->suspend; - my $ret = system('rpm', '-e', '--nodeps', @l); + my $ret = system('rpm', '-e', '--nodeps', @l) == 0; $o->{in}->resume; $ret; } +################################################################################ -sub is_installed { - my ($o, $pkg) = @_; - system('rpm', '-q', $pkg) == 0; -} +package standalone; 1; diff --git a/perl-install/standalone/XFdrake b/perl-install/standalone/XFdrake index d98dba20f..840e0f68e 100755 --- a/perl-install/standalone/XFdrake +++ b/perl-install/standalone/XFdrake @@ -47,7 +47,7 @@ my $in = interactive->vnew('su', 'X'); -r '/etc/modules.conf' and modules::mergein_conf('/etc/modules.conf'); my $f = "/usr/X11R6/lib/X11/Cards"; -$in->standalone::pkgs_install('XFree86', 'XFree86-75dpi-fonts') if (! -e $f); +$in->do_pkgs->install('XFree86', 'XFree86-75dpi-fonts') if !-e $f; -e $f or die "install XFree86 first!\n"; `pidof xfs` > 0 or system("/etc/rc.d/init.d/xfs start") if !$i->{skiptest}; @@ -82,7 +82,7 @@ eval { $::isEmbedded and kill USR2, $::CCPID; Xconfigurator::main('', $i, $in, { allowFB => $::expert, - allowNVIDIA_rpms => $allowNVIDIA_rpms }, sub { $in->standalone::pkgs_install(@_) }); + allowNVIDIA_rpms => $allowNVIDIA_rpms }); !$::isEmbedded and $in->exit(0); kill USR1, $::CCPID; goto begin; diff --git a/perl-install/standalone/adduserdrake b/perl-install/standalone/adduserdrake index 8584aa4ae..e8c98929a 100755 --- a/perl-install/standalone/adduserdrake +++ b/perl-install/standalone/adduserdrake @@ -36,7 +36,7 @@ any::addUsers('', $users); any::write_passwd_user('', $_, $isMD5) foreach @$users; system("pwconv") if $isShadow; -#$in->pkgs_install("autologin") if $o->{autologin}; +#$in->do_pkgs->install("autologin") if $o->{autologin}; #any::set_autologin('', $o->{autologin}, $o->{desktop}); $in->exit(0) if $in; diff --git a/perl-install/standalone/drakgw b/perl-install/standalone/drakgw index d4b7136b9..3a9632fec 100755 --- a/perl-install/standalone/drakgw +++ b/perl-install/standalone/drakgw @@ -304,7 +304,7 @@ my %rpm2file = ( ipchains => "/sbin/ipchains", bind => "/usr/sbin/named", "caching-nameserver" => "/var/named/named.local"); -$in->standalone::pkgs_install(grep { !-e $rpm2file{$_} } keys %rpm2file); +$in->do_pkgs->install(grep { !-e $rpm2file{$_} } keys %rpm2file); -e $rpm2file{$_} or fatal_quit(_("Problems installing package $_")) foreach keys %rpm2file; @@ -657,6 +657,9 @@ Click on Configure to launch the setup wizard.", $setup_state)); #------------------------------------------------- #- $Log$ +#- Revision 1.47 2001/08/08 18:26:31 prigaux +#- add interactive_pkgs stuff +#- #- Revision 1.46 2001/08/06 13:11:35 yduret #- use MDK::Common; #- use network::netconnect; and update functions call from netconnect diff --git a/perl-install/standalone/draknet b/perl-install/standalone/draknet index 8ec55a712..f61f7f822 100755 --- a/perl-install/standalone/draknet +++ b/perl-install/standalone/draknet @@ -279,7 +279,7 @@ my $button_wizard = new Gtk::Button _("Configure"); $button_wizard->signal_connect( clicked => sub { $::isWizard = 1; system("draknet --wizard"); -# netconnect::intro('', $netcnx, $in, sub { $in->standalone::pkgs_install(@_) }); +# netconnect::intro('', $netcnx, $in); $combo1->entry->set_text((-e "/etc/sysconfig/network-scripts/draknet_conf." . $combo1->entry->get_text) ? $combo1->entry->get_text : "default"); network::netconnect::load_conf($netcnx, $netc, $intf); update(); @@ -349,7 +349,7 @@ Gtk->main; Gtk->exit(0); dd: -network::netconnect::intro('', $netcnx, $in, sub { $in->standalone::pkgs_install(@_) }); +network::netconnect::intro('', $netcnx, $in); $in->exit(0); @@ -357,13 +357,13 @@ sub apply { $old_profile=$netcnx->{PROFILE} ? $netcnx->{PROFILE} : "default"; network::netconnect::save_conf($netcnx, $netc, $intf); - $netcnx->{type} eq 'modem' and any::pppConfig($in, $netcnx->{$netcnx->{type}}, '', sub { $in->standalone::pkgs_install(@_) }); + $netcnx->{type} eq 'modem' and any::pppConfig($in, $netcnx->{$netcnx->{type}}, ''); $netcnx->{type} eq 'isdn_internal' and network::isdn::isdn_write_config_backend($netcnx->{$netcnx->{type}}, 1, $netc); #$light - $netcnx->{type} eq 'isdn_external' and any::pppConfig($in, $netcnx->{$netcnx->{type}}, '', sub { $in->standalone::pkgs_install(@_) }); + $netcnx->{type} eq 'isdn_external' and any::pppConfig($in, $netcnx->{$netcnx->{type}}, ''); $netcnx->{type} eq 'adsl_ppoe' and adsl_conf_backend($netcnx->{$netcnx->{type}}, $netc, 'pppoe'); $netcnx->{type} eq 'adsl_pptp' and adsl_conf_backend($netcnx->{$netcnx->{type}}, $netc, 'pptp');; - network::configureNetwork2($in, $prefix, $netc, $intf, sub { $in->standalone::pkgs_install(@_) }); + network::configureNetwork2($in, $prefix, $netc, $intf); $netcnx->{type} =~ /adsl/ or system("/sbin/chkconfig --del adsl 2> /dev/null"); system("$prefix/etc/rc.d/init.d/network restart"); $button_apply->set_sensitive(0); diff --git a/perl-install/standalone/drakproxy b/perl-install/standalone/drakproxy index 6a10e9a41..66307e460 100755 --- a/perl-install/standalone/drakproxy +++ b/perl-install/standalone/drakproxy @@ -35,7 +35,7 @@ $::Wizard_title = _("Proxy handling"); my $in = interactive::vnew('su', 'default'); if ($::isWizard || ($::isEmbedded && ref($in) =~ /gtk/)) { - proxy::main('', $in, sub { $in->standalone::pkgs_install(@_) }); + proxy::main('', $in); $in->exit(0); } @@ -67,6 +67,9 @@ Gtk->exit(0); #------------------------------------------------- #- $Log$ +#- Revision 1.6 2001/08/08 18:26:31 prigaux +#- add interactive_pkgs stuff +#- #- Revision 1.5 2001/06/12 12:45:57 odin #- ui for drakproxy almost done #- diff --git a/perl-install/tinyfirewall.pm b/perl-install/tinyfirewall.pm index 3a88e09d9..014495c07 100644 --- a/perl-install/tinyfirewall.pm +++ b/perl-install/tinyfirewall.pm @@ -235,7 +235,7 @@ sub main { $dialog->vbox->pack_start($label,1,1,20); $dialog->show_all; Gtk->main_iteration while Gtk->events_pending; - if ($in->standalone::pkgs_install(Kernel22() ? "ipchains" : "iptables", "Bastille")) { + if (!$in->do_pkgs->install(Kernel22() ? "ipchains" : "iptables", "Bastille")) { $in->ask_warn('', _("Failure installing the needed packages : %s and Bastille. Try to install them manually.", Kernel22() ? "ipchains" : "iptables") ); $dialog->destroy; |