From 9629507c573aebcf8c1051a7ed508097dcc0439c Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Tue, 1 Aug 2000 18:28:23 +0000 Subject: no_comment --- perl-install/ChangeLog | 10 ++++++ perl-install/install2.pm | 4 +-- perl-install/install_steps.pm | 6 +++- perl-install/install_steps_interactive.pm | 21 +++++++---- perl-install/services.pm | 58 +++++++++++++++++++------------ perl-install/standalone/drakxservices | 4 ++- 6 files changed, 70 insertions(+), 33 deletions(-) diff --git a/perl-install/ChangeLog b/perl-install/ChangeLog index f0beaed5a..e40bda0db 100644 --- a/perl-install/ChangeLog +++ b/perl-install/ChangeLog @@ -1,3 +1,13 @@ +2000-08-01 Pixel + + * install2.pm (miscellaneous): modify as chmouel want (aka, "" + instead of "no" for MOUSE and KEYBOARD in sysconfig/usb) + + * services.pm: separation between interaction and action. + * install_steps.pm (servicesConfig): the job is now done here + * install_steps_interactive.pm (servicesConfig): only the asking + part + 2000-08-01 François Pons * pkgs.pm: fixed the below fixe, now ok. diff --git a/perl-install/install2.pm b/perl-install/install2.pm index 926f547d5..9adfdbdaa 100644 --- a/perl-install/install2.pm +++ b/perl-install/install2.pm @@ -417,8 +417,8 @@ sub miscellaneous { my $f = "$o->{prefix}/etc/sysconfig/usb"; my %usb = getVarsFromSh($f); - $usb{MOUSE} = bool2yesno($o->{mouse}{device} eq "usbmouse"); - $usb{KEYBOARD} = bool2yesno(int grep { /^keybdev\.c: Adding keyboard/ } detect_devices::syslog()); + $usb{MOUSE} = $o->{mouse}{device} eq "usbmouse" && "yes" + $usb{KEYBOARD} = (int grep { /^keybdev\.c: Adding keyboard/ } detect_devices::syslog()) && "yes"; $usb{ZIP} = bool2yesno(-d "/proc/scsi/usb"); setVarsInSh($f, \%usb); diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm index 7adef9ce2..dfae6ebc1 100644 --- a/perl-install/install_steps.pm +++ b/perl-install/install_steps.pm @@ -638,7 +638,11 @@ sub timeConfig { } #------------------------------------------------------------------------------ -sub servicesConfig {} +sub servicesConfig { + my ($o) = @_; + require services; + services::doit($o, $o->{services}, $o->{prefix}) if $o->{services}; +} #------------------------------------------------------------------------------ sub printerConfig { my($o) = @_; diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm index 17961735d..998ac5c07 100644 --- a/perl-install/install_steps_interactive.pm +++ b/perl-install/install_steps_interactive.pm @@ -24,7 +24,6 @@ use raid; use mouse; use modules; use lang; -use services; use loopback; use keyboard; use any; @@ -463,7 +462,17 @@ sub configureNetwork($) { #- my $wait = $o->wait_message(_("Hostname"), _("Determining host name and domain...")); #- network::guessHostname($o->{prefix}, $o->{netc}, $o->{intf}); #- } - $o->configureNetworkNet($o->{netc}, $last ||= {}, @l) if $last->{BOOTPROTO} !~ /^(dhcp|bootp)$/; + if ($last->{BOOTPROTO} =~ /^(dhcp|bootp)$/) { + $o->ask_from_entries_ref(_("Configuring network"), +_("Please enter your host name if you know it. +Some DHCP servers require the hostname to work. +Your host name should be a fully-qualified host name, +such as ``mybox.mylab.myco.com''."), + [_("Host name:")], [ \$o->{netc}{HOSTNAME} ]); + } else { + $o->configureNetworkNet($o->{netc}, $last ||= {}, @l); + } + $o->miscellaneousNetwork(); } install_steps::configureNetwork($o); @@ -520,8 +529,6 @@ You may also enter the IP address of the gateway if you have one"), [(map { \$netc->{$_} } qw(HOSTNAME dnsServer GATEWAY)), {val => \$netc->{GATEWAYDEV}, list => \@devices}] ); - - $o->miscellaneousNetwork(); } #------------------------------------------------------------------------------ @@ -633,7 +640,9 @@ sub timeConfig { #------------------------------------------------------------------------------ sub servicesConfig { my ($o) = @_; - services::drakxservices($o, $o->{prefix}); + require services; + $o->{services} = services::ask($o, $o->{prefix}); + install_steps::servicesConfig($o); } #------------------------------------------------------------------------------ @@ -1053,8 +1062,6 @@ consult the Errata available from http://www.linux-mandrake.com/. Information on configuring your system is available in the post install chapter of the Official Linux-Mandrake User's Guide.")) if $alldone && !$::g_auto_install && !$::oo->{oem}; - - $::global_wait = $o->wait_message('', _("Shutting down")); } diff --git a/perl-install/services.pm b/perl-install/services.pm index 4f3c1d81f..b06f04d7e 100644 --- a/perl-install/services.pm +++ b/perl-install/services.pm @@ -10,7 +10,8 @@ use common qw(:common :functional :system :file); use commands; use run_program; -my %services = ( +sub description { + my %services = ( anacron => __("Anacron a periodic command scheduler."), apmd => __("apmd is used for monitoring batery status and logging it via syslog. It can also be used for shutting down the machine when the battery is low."), @@ -67,33 +68,43 @@ syslog => __("Syslog is the facility by which many daemons use to log messages to various system log files. It is a good idea to always run syslog."), usb => __("This startup script try to load your modules for your usb mouse."), xfs => __("Starts and stops the X Font Server at boot time and shutdown."), -); + ); + my ($name, $prefix) = @_; + my $s = $services{$name}; + if ($s) { + $s = translate($s); + } else { + ($s = cat_("$prefix/etc/rc.d/init.d/$_")) =~ s/\\\s*\n#\s*//mg; + ($s) = $s =~ /^# description:\s+(.*?)^(?:[^#]|# {0,2}\S)/sm; + $s =~ s/^#\s*//m; + } + $s =~ s/\n/ /gm; $s =~ s/\s+$//; + $s; +} -sub drakxservices { - my ($in, $prefix) = @_; +sub services { + my ($prefix) = @_; my $cmd = $prefix ? "chroot $prefix" : ""; - my @services = map { [/(\S+)/, /:on/ ] } sort `LANGUAGE=C $cmd chkconfig --list`; - my @l = map { $_->[0] } @services; - my @before = map { $_->[1] } @services; - my @descr = map { - my $s = $services{$_}; - if ($s) { - $s = translate($s); - } else { - ($s = cat_("$prefix/etc/rc.d/init.d/$_")) =~ s/\\\s*\n#\s*//mg; - ($s) = $s =~ /^# description:\s+(.*?)^(?:[^#]|# {0,2}\S)/sm; - $s =~ s/^#\s*//m; - } - $s =~ s/\n/ /gm; $s =~ s/\s+$//; - $s; - } @l; + my @l = map { [ /(\S+)/, /:on/ ] } sort `LANGUAGE=C $cmd chkconfig --list`; + [ map { $_->[0] } @l ], [ map { $_->[1] } @l ]; +} +sub ask { + my ($in, $prefix) = @_; + my ($l, $before) = services($prefix); my $after = $in->ask_many_from_list_with_help("drakxservices", _("Choose which services should be automatically started at boot time"), - \@l, \@descr, \@before) or return; + $l, [ map { description($_, $prefix) } @$l ], $before) or return; + [ grep_index { $after->[$::i] } @$l ]; +} +sub doit { + my ($in, $on_services, $prefix) = @_; + my ($l, $before) = services($prefix); + mapn { - my ($name, $before, $after) = @_; + my ($name, $before) = @_; + my $after = member($name, @$on_services); if ($before != $after) { my $script = "/etc/rc.d/init.d/$name"; run_program::rooted($prefix, "chkconfig", $after ? "--add" : "--del", $name); @@ -104,5 +115,8 @@ sub drakxservices { run_program::rooted($prefix, $script, "stop"); } } - } \@l, \@before, $after; + } $l, $before; } + + +1; diff --git a/perl-install/standalone/drakxservices b/perl-install/standalone/drakxservices index 6825ef6c9..63318a031 100755 --- a/perl-install/standalone/drakxservices +++ b/perl-install/standalone/drakxservices @@ -13,6 +13,8 @@ local $_ = join '', @ARGV; $::isStandalone = 1; -services::drakxservices(my $in = vnew interactive('su')); +my $in = vnew interactive('su'); +my $l = services::ask($in); +services::doit($in, $l) if $l; $in->exit(0); -- cgit v1.2.1