From 6bf5ba6748589304e2908255239173b17045e4f2 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Thu, 16 Jan 2003 12:16:50 +0000 Subject: "je n'en veux + de cette engeance" (c) pixel : make explanations provided by log and not anymore by standalone, thus preventing using standalone in drakx (which is bad) --- perl-install/bootlook.pm | 11 ++++++----- perl-install/harddrake/TODO | 4 +--- perl-install/harddrake/sound.pm | 13 ++++--------- perl-install/harddrake/v4l.pm | 2 +- perl-install/log.pm | 2 ++ perl-install/standalone.pm | 13 +++++++------ perl-install/standalone/drakTermServ | 12 ++++++------ perl-install/standalone/drakautoinst | 2 +- perl-install/standalone/drakbug | 2 +- perl-install/standalone/drakgw | 16 ++++++++-------- perl-install/standalone/draksec | 14 +++++++------- perl-install/standalone/drakxtv | 4 ++-- perl-install/standalone/service_harddrake | 2 +- 13 files changed, 47 insertions(+), 50 deletions(-) (limited to 'perl-install') diff --git a/perl-install/bootlook.pm b/perl-install/bootlook.pm index 51f300475..4ead2206d 100644 --- a/perl-install/bootlook.pm +++ b/perl-install/bootlook.pm @@ -27,6 +27,7 @@ use interactive; use standalone; use Xconfig::various; use any; +use log; use bootloader; use fs; use ugtk2 qw(:helpers :wrappers :create); @@ -182,10 +183,10 @@ sub { #lilo installation if (-f $themes{path}.$combo{lilo}->entry->get_text() . $themes{lilo}{file}) { use MDK::Common::File; - standalone::explanations(N("Backup %s to %s.old",$lilomsg,$lilomsg)); + log::explanations(N("Backup %s to %s.old",$lilomsg,$lilomsg)); cp_af($lilomsg, "/boot/message-graphic.old"); #can't use this anymore or $in->ask_warn(N("Error"), N("unable to backup lilo message")); - standalone::explanations(N("Copy %s to %s", $themes{path} . $combo{lilo}->entry->get_text() . $themes{lilo}{file},$lilomsg)); + log::explanations(N("Copy %s to %s", $themes{path} . $combo{lilo}->entry->get_text() . $themes{lilo}{file},$lilomsg)); cp_af($themes{path} . $combo{lilo}->entry->get_text() . $themes{lilo}{file}, $lilomsg); #can't use this anymore or $in->ask_warn(N("Error"), N("can't change lilo message")); } else { @@ -220,7 +221,7 @@ THEME=" . $combo{boot}->entry->get_text() . " LOGO_CONSOLE=" . ($keep_logo ? 'yes' : 'no') . "\n"; if (-f $boot_conf_file) { eval { output($boot_conf_file, $bootsplash_cont) }; - $@ and $in->ask_warn(N("Error"), N("Can't write /etc/sysconfig/bootsplash.")) or standalone::explanations(N("Write %s",$boot_conf_file)); + $@ and $in->ask_warn(N("Error"), N("Can't write /etc/sysconfig/bootsplash.")) or log::explanations(N("Write %s",$boot_conf_file)); } else { $in->ask_warn(N("Error"), N("Can't write /etc/sysconfig/bootsplash\nFile not found.")); $error = 1; @@ -236,7 +237,7 @@ LOGO_CONSOLE=" . ($keep_logo ? 'yes' : 'no') . "\n"; N("Can't launch mkinitrd -f /boot/initrd-%s.img %s.", $_,$_)); $error = 1; } else { - standalone::explanations(N("Make initrd 'mkinitrd -f /boot/initrd-%s.img %s'.", $_,$_)); + log::explanations(N("Make initrd 'mkinitrd -f /boot/initrd-%s.img %s'.", $_,$_)); } } } @@ -246,7 +247,7 @@ N("Can't relaunch LiLo! Launch \"lilo\" as root in command line to complete LiLo theme installation.")); $error = 1; } else { - standalone::explanations(N("Relaunch 'lilo'")); + log::explanations(N("Relaunch 'lilo'")); } $in->ask_warn($error ? N("Error") : N("Notice"), $error ? N("Theme installation failed!") : N("LiLo and Bootsplash themes installation successfull")); diff --git a/perl-install/harddrake/TODO b/perl-install/harddrake/TODO index bb9e8019d..6612961f7 100644 --- a/perl-install/harddrake/TODO +++ b/perl-install/harddrake/TODO @@ -9,11 +9,9 @@ *** enable the user to force a module (isa, isapnp, ...) *** print "(not loaded)" if module isn't loaded *** add bus_position to make unique id in ui -*** cdrom (must be done by harddrake): +*** cdrom (must be done by diskdrake): **** ide-scsi / ide-cd switch -**** supermount switch *** use fbgtk+2 when booting on fbcon for smoother GUI => interactive::fbgtk -*** translate all fields *** write dialogs in ugtk rather in interactive to make them transcient *** help: **** print fields in black and their description in blue as for information fields diff --git a/perl-install/harddrake/sound.pm b/perl-install/harddrake/sound.pm index 953c76336..365bc42fe 100644 --- a/perl-install/harddrake/sound.pm +++ b/perl-install/harddrake/sound.pm @@ -21,6 +21,7 @@ use run_program; use modules; use list_modules; use detect_devices; +use log; my $has_nvaudio = -x '/lib/modules/' . c::kernel_version() . '/'; @@ -139,15 +140,9 @@ sub get_alternative { $alsa2oss{$driver} || $oss2alsa{$driver}; } -sub explain { - require standalone; - standalone::explanations(@_) unless $::isInstall; -} - - sub do_switch { my ($old_driver, $new_driver) = @_; - explain("removing old $old_driver\n"); + log::explanations("removing old $old_driver\n"); rooted("service sound stop") unless $blacklisted; rooted("service alsa stop") if $old_driver =~ /^snd-/ && !$blacklisted; unload($old_driver); # run_program("/sbin/modprobe -r $driver"); # just in case ... @@ -159,7 +154,7 @@ sub do_switch { rooted("/sbin/chkconfig --add alsa"); load($new_driver); # service alsa is buggy } else { run_program::run("/sbin/chkconfig --del alsa") } - explain("loading new $new_driver\n"); + log::explanations("loading new $new_driver\n"); rooted("/sbin/chkconfig --add sound"); # just in case ... rooted("service sound start") unless $blacklisted; } @@ -213,7 +208,7 @@ To use alsa, one can either use: ])) { return if $new_driver eq $driver; - explain("switching audio driver from '$driver' to '$new_driver'\n"); + log::explanations("switching audio driver from '$driver' to '$new_driver'\n"); $in->ask_warn(N("Warning"), N("The old \"%s\" driver is blacklisted.\n It has been reported to oopses the kernel on unloading.\n The new \"%s\" driver'll only be used on next bootstrap.", $driver, $new_driver)) if $blacklisted; diff --git a/perl-install/harddrake/v4l.pm b/perl-install/harddrake/v4l.pm index bb41dfc6f..e7763471c 100644 --- a/perl-install/harddrake/v4l.pm +++ b/perl-install/harddrake/v4l.pm @@ -240,7 +240,7 @@ If your card is misdetected, you can force the right tuner and card types here. join(' ', map { if_($conf{$_} ne -1, "$_=$conf{$_}") } qw(card pll tuner gbuffers)); if ($options) { log::l("[harddrake::bttv] $options"); -# standalone::explanations("modified file /etc/modules.conf ($options)") if $::isStandalone; +# log::explanations("modified file /etc/modules.conf ($options)") if $::isStandalone; modules::set_options("bttv", $options); } } diff --git a/perl-install/log.pm b/perl-install/log.pm index 3295ba8f9..3f281b5c6 100644 --- a/perl-install/log.pm +++ b/perl-install/log.pm @@ -55,4 +55,6 @@ sub closeLog() { } else { close LOG; close LOG2 } } +sub explanations { c::syslog(c::LOG_INFO()|c::LOG_LOCAL1(), "@_") } + 1; diff --git a/perl-install/standalone.pm b/perl-install/standalone.pm index aacabdc72..de2f04a12 100644 --- a/perl-install/standalone.pm +++ b/perl-install/standalone.pm @@ -6,8 +6,8 @@ use common qw(N); use Config; #- for sanity (if a use standalone is made during install, MANY problems will happen) +require 'log.pm'; #- "require log" causes some pb, perl thinking that "log" is the log() function if ($::isInstall) { - require 'log.pm'; #- "require log" causes some pb, perl thinking that "log" is the log() function log::l('ERROR: use standalone made during install :-('); log::l('backtrace: ' . backtrace()); } @@ -147,7 +147,7 @@ Copyright (C) 1999-2002 MandrakeSoft by sub on_request_help { my ($o, $link) = @_; my $browser = $ENV{BROWSER} || MDK::Common::Func::find { -x "/usr/bin/$_" } qw(mozilla konqueror galeon) or $o->ask_warn('',N("No browser is installed on your system, Please install one if you want to browse the help system")); - standalone::explanations("Connection to help system at $link"); + log::explanations("Connection to help system at $link"); system("$browser $link &"); } @@ -156,6 +156,7 @@ package pkgs_interactive; use run_program; use common; +require 'log.pm'; our @ISA = qw(); #- tell perl_checker this is a class @@ -175,7 +176,7 @@ sub install { } else { $wait = $o->{in}->wait_message('', N("Installing packages...")); } - standalone::explanations("installed packages @l"); + log::explanations("installed packages @l"); my $ret = system('urpmi', '--allow-medium-change', '--auto', '--best-output', @l) == 0; if ($o->{in}->isa('interactive::newt')) { @@ -222,7 +223,7 @@ sub are_installed { sub remove { my ($o, @l) = @_; $o->{in}->suspend; - standalone::explanations("removed packages @l"); + log::explanations("removed packages @l"); my $ret = system('rpm', '-e', @l) == 0; $o->{in}->resume; $ret; @@ -231,7 +232,7 @@ sub remove { sub remove_nodeps { my ($o, @l) = @_; $o->{in}->suspend; - standalone::explanations("removed (with --nodeps) packages @l"); + log::explanations("removed (with --nodeps) packages @l"); my $ret = system('rpm', '-e', '--nodeps', @l) == 0; $o->{in}->resume; $ret; @@ -244,7 +245,7 @@ package standalone; #- stuff will go to special /var/log/explanations file my $standalone_name; -sub explanations { c::syslog(c::LOG_INFO()|c::LOG_LOCAL1(), "@_") } +sub explanations { log::explanations("@_") } our @common_functs = qw(renamef linkf symlinkf output substInFile mkdir_p rm_rf cp_af touch setVarsInSh setExportedVarsInSh setExportedVarsInCsh update_gnomekderc); our @builtin_functs = qw(chmod chown unlink link symlink rename system); diff --git a/perl-install/standalone/drakTermServ b/perl-install/standalone/drakTermServ index 6bb553732..fb4e6b225 100755 --- a/perl-install/standalone/drakTermServ +++ b/perl-install/standalone/drakTermServ @@ -862,7 +862,7 @@ sub maintain_clients { `perl -pi -e 's/Enable=false/Enable=true/' /usr/share/config/kdm/kdmrc`; # This file had 2 "Enable=" entries, one for xdmcp and one for debug change_gdm_xdmcp("true"); - standalone::explanations("Modified files /etc/inittab, /etc/X11/xdm/xdm-config, /usr/share/config/kdm/kdmrc, /etc/X11/gdm/gdm.conf"); + log::explanations("Modified files /etc/inittab, /etc/X11/xdm/xdm-config, /usr/share/config/kdm/kdmrc, /etc/X11/gdm/gdm.conf"); # just xdmcp in hosts.allow is enough for xdm & kdm, but gdm doesn't work - x11 doesn't help either update_hosts_allow("enable"); } else { @@ -870,7 +870,7 @@ sub maintain_clients { `perl -pi -e 's/DisplayManager.requestPort:/\! DisplayManager.requestPort:/' /etc/X11/xdm/xdm-config`; `perl -pi -e 's/Enable=true/Enable=false/' /usr/share/config/kdm/kdmrc`; change_gdm_xdmcp("false"); - standalone::explanations("Modified files /etc/inittab, /etc/X11/xdm/xdm-config, /usr/share/config/kdm/kdmrc, /etc/X11/gdm/gdm.conf"); + log::explanations("Modified files /etc/inittab, /etc/X11/xdm/xdm-config, /usr/share/config/kdm/kdmrc, /etc/X11/gdm/gdm.conf"); update_hosts_allow("disable"); } $in->ask_warn('', N("Need to restart the Display Manager for full changes to take effect. \n(service dm restart - at the console)")); @@ -1455,12 +1455,12 @@ sub update_hosts_allow { return; } if (!$has_all) { - standalone::explanations("Modified file /etc/hosts.allow"); + log::explanations("Modified file /etc/hosts.allow"); append_to_file("/etc/hosts.allow", "ALL:\t$subnet\n"); } $has_all = `grep ALL /etc/hosts.deny`; if (!$has_all) { - standalone::explanations("Modified file /etc/hosts.deny"); + log::explanations("Modified file /etc/hosts.deny"); append_to_file("/etc/hosts.deny", "ALL:\tALL\n"); } } @@ -1469,7 +1469,7 @@ sub update_hosts_allow { for (my $i = 0; $i < @allow; $i++) { if ($allow[$i] =~ /^ALL:\t$subnet/) { splice(@allow, $i, 1); - standalone::explanations("Modified file /etc/hosts.allow"); + log::explanations("Modified file /etc/hosts.allow"); output("/etc/hosts.allow", @allow); last; } @@ -1478,7 +1478,7 @@ sub update_hosts_allow { for (my $i = 0; $i < @deny; $i++) { if ($deny[$i] =~ /^ALL:\tALL/) { splice(@deny, $i, 1); - standalone::explanations("Modified file /etc/hosts.deny"); + log::explanations("Modified file /etc/hosts.deny"); output("/etc/hosts.deny", @deny); last; } diff --git a/perl-install/standalone/drakautoinst b/perl-install/standalone/drakautoinst index c227c2842..329a03b5b 100755 --- a/perl-install/standalone/drakautoinst +++ b/perl-install/standalone/drakautoinst @@ -75,7 +75,7 @@ my $floppy = detect_devices::floppy(); my $dev = devices::make($floppy); $in->ask_okcancel('', N("Insert a blank floppy in drive %s", $floppy), 1) or quit_global($in, 0); { - standalone::explanations(N("Creating auto install floppy")); + log::explanations(N("Creating auto install floppy")); my $w = $in->wait_message('', N("Creating auto install floppy")); commands::dd("if=$imagefile", "of=$dev", "bs=1440", "count=1024"); common::sync(); diff --git a/perl-install/standalone/drakbug b/perl-install/standalone/drakbug index 5e9c952c1..772450a22 100755 --- a/perl-install/standalone/drakbug +++ b/perl-install/standalone/drakbug @@ -178,7 +178,7 @@ sub connect_bugzilla { exec $ENV{BROWSER},$url if exists $ENV{BROWSER}; my @browser = qw(mozilla konqueror galeon); foreach (@browser) { - if (-e "/usr/bin/$_") { standalone::explanations("Contacting $url with $_\n "); exec $_,$url } + if (-e "/usr/bin/$_") { log::explanations("Contacting $url with $_\n "); exec $_,$url } } $in->ask_warn('', N("No browser available! Please install one")); } diff --git a/perl-install/standalone/drakgw b/perl-install/standalone/drakgw index e84d71fa3..a8236197d 100755 --- a/perl-install/standalone/drakgw +++ b/perl-install/standalone/drakgw @@ -63,13 +63,13 @@ pur_gtk_mode() if $::isEmbedded && $in->isa('interactive::gtk'); sub sys { system(@_) == 0 or log::l("[drakgw] Warning, sys failed for $_[0]") } sub outpend { - standalone::explanations("modified file $_[0]"); + log::explanations("modified file $_[0]"); my $f = shift; local *F; open F, ">>$f" or die "outpend in file $f failed: $!\n"; print F foreach @_; } sub start_daemons () { my $cups_used = 0; - standalone::explanations("Starting daemons"); + log::explanations("Starting daemons"); if (-f "/etc/rc.d/init.d/cups") { if (system("/etc/rc.d/init.d/cups status >/dev/null") == 0) { $cups_used = 1; @@ -91,7 +91,7 @@ sub start_daemons () { } sub stop_daemons () { - standalone::explanations("Stopping daemons"); + log::explanations("Stopping daemons"); foreach (qw(dhcpd named)) { system("/etc/rc.d/init.d/$_ status >/dev/null 2>/dev/null") == 0 and sys("/etc/rc.d/init.d/$_ stop"); } @@ -238,7 +238,7 @@ I am about to setup your Local Area Network with that adapter.", $format->($devi ) or goto step_ask_confirm; defined $device or quit_global($in, 0); } -standalone::explanations("Choosing network device: $device"); +log::explanations("Choosing network device: $device"); my $lan_address = "192.168.1.0"; @@ -314,7 +314,7 @@ if (!($lan_address =~ s/\.0$//)) { N("The Local Network did not finish with `.0', bailing out.")); quit_global($in, 0); } -standalone::explanations("Using LAN address <$lan_address>"); +log::explanations("Using LAN address <$lan_address>"); #- test for potential conflict with other networks @@ -339,7 +339,7 @@ $wait_configuring = $in->wait_message(N("Configuring..."), #- setup the /etc/sysconfig/network-script/ script if ($reconf_dhcp_server_intf) { - standalone::explanations("Reconfiguring network parameters of $device"); + log::explanations("Reconfiguring network parameters of $device"); my $network_scripts = "/etc/sysconfig/network-scripts"; my $ifcfg = "$network_scripts/ifcfg-$device"; renamef($ifcfg, "$network_scripts/old.ifcfg-$device"); @@ -390,7 +390,7 @@ substInFile { s/^FORWARD_IPV4.*\n//; $_ .= "FORWARD_IPV4=true\n" if eof } $sysco #- setup the DHCP server if ($reconf_dhcp_server_intf) { - standalone::explanations("Configuring a DHCP server on $lan_address.0"); + log::explanations("Configuring a DHCP server on $lan_address.0"); renamef($dhcpd_conf, "$dhcpd_conf.old"); output($dhcpd_conf, qq(subnet $lan_address.0 netmask $netmask { # default gateway @@ -441,7 +441,7 @@ substInFile { s/^INTERFACES\n//; $_ .= "INTERFACES=\"$device\"\n" if eof } $sysc #- Modify the root location block in /etc/cups/cupsd.conf if (-f $cups_conf) { - standalone::explanations("Updating CUPS configuration accordingly"); + log::explanations("Updating CUPS configuration accordingly"); substInFile { s/^ServerName[^:].*\n//; $_ .= "ServerName $server_ip\n" if eof; diff --git a/perl-install/standalone/draksec b/perl-install/standalone/draksec index ed5b2508e..012c26711 100755 --- a/perl-install/standalone/draksec +++ b/perl-install/standalone/draksec @@ -208,25 +208,25 @@ my $bok = gtksignal_connect(new Gtk2::Button(N("Ok")), my $secadmin_value = $secadmin_entry->get_text(); my $w; - standalone::explanations("Configuring msec"); + log::explanations("Configuring msec"); if ($seclevel_value ne security::level::get_string()) { $w = wait_msg(N("Please wait, setting security level...")); - standalone::explanations("Setting security level"); + log::explanations("Setting security level"); security::level::set($seclevel_value); remove_wait_msg($w); } $w = wait_msg(N("Please wait, setting security options...")); - standalone::explanations("Setting security administrator option"); + log::explanations("Setting security administrator option"); $msec->config_check('MAIL_WARN', $secadmin_check_value == 1 ? 'yes' : 'no'); if ($secadmin_value ne $msec->get_check_value('MAIL_USER') && $secadmin_check_value) { - standalone::explanations("Setting security administrator contact"); + log::explanations("Setting security administrator contact"); $msec->config_check('MAIL_USER', $secadmin_value); } - standalone::explanations("Setting security periodic checks"); + log::explanations("Setting security periodic checks"); foreach my $key (keys %security_checks_value) { if ($security_checks_value{$key}->entry->get_text() ne $msec->get_check_value($key)) { $msec->config_check($key, $security_checks_value{$key}->entry->get_text()); @@ -234,13 +234,13 @@ my $bok = gtksignal_connect(new Gtk2::Button(N("Ok")), } foreach my $domain (keys %options_values) { - standalone::explanations("Setting msec functions related to $domain"); + log::explanations("Setting msec functions related to $domain"); foreach my $key (keys %{$options_values{$domain}}) { my $opt = $options_values{$domain}{$key}; $msec->config_function($key, $opt =~ /Combo/ ? $opt->entry->get_text() : $opt->get_text()); } } - standalone::explanations("Applying msec changes"); + log::explanations("Applying msec changes"); run_program::rooted($::prefix, "/usr/sbin/msec"); remove_wait_msg($w); diff --git a/perl-install/standalone/drakxtv b/perl-install/standalone/drakxtv index 2f1c39f4f..29f4e6065 100755 --- a/perl-install/standalone/drakxtv +++ b/perl-install/standalone/drakxtv @@ -41,7 +41,7 @@ sub scan4channels { #{ exec {'consolehelper'} $0, ("urpmi", "xawtv") or die N("consolehelper missing"); # }; if (! -x "/usr/bin/scantv") { -# standalone::explanations("package xawtv isn't installed"); +# log::explanations("package xawtv isn't installed"); $in->ask_warn("XawTV isn't installed!", formatAlaTeX(N("XawTV isn't installed! @@ -120,7 +120,7 @@ You can install it by typing \"urpmi xawtv\" as root, in a console."))); $in->ask_warn(N("There was an error while scanning for TV channels"), N("XawTV isn't installed!")) } else { - standalone::explanations("created file $home/.xawtv"); + log::explanations("created file $home/.xawtv"); $in->ask_warn(N("Have a nice day!"), N("Now, you can run xawtv (under X Window!) !\n")) unless $use_X; }; diff --git a/perl-install/standalone/service_harddrake b/perl-install/standalone/service_harddrake index 6fc2611d1..fb440aebc 100755 --- a/perl-install/standalone/service_harddrake +++ b/perl-install/standalone/service_harddrake @@ -70,6 +70,6 @@ foreach (@harddrake::data::tree) { } # output new hw config -standalone::explanations "created file $last_boot_config"; +log::explanations "created file $last_boot_config"; store \%config, $last_boot_config; $in->exit(0); -- cgit v1.2.1