From aa9f06dc2d48164992bf98105b578c554b932065 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Mon, 24 Feb 2003 15:39:23 +0000 Subject: in standalone mode, only display a service as enabled at boot time only if it's really enabled in current runlevel. what's more it's more coherent with other "only show current runlevel status" tools like ntsysv. --- perl-install/services.pm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'perl-install') diff --git a/perl-install/services.pm b/perl-install/services.pm index c41c14190..171020e32 100644 --- a/perl-install/services.pm +++ b/perl-install/services.pm @@ -276,8 +276,14 @@ sub doit { #--- the listref of "on" services sub services { local $ENV{LANGUAGE} = 'C'; - my @raw_l = run_program::rooted_get_stdout($::prefix, '/sbin/chkconfig', '--list'); - my @l = sort { $a->[0] cmp $b->[0] } map { [ /([^\s:]+)/, /\bon\b/ ] } grep { !/:$/ } @raw_l; + my @raw_l = map { chomp; $_ } run_program::rooted_get_stdout($::prefix, '/sbin/chkconfig', '--list'); + my @l; + if ($::isInstall) { + @l = sort { $a->[0] cmp $b->[0] } map { [ /([^\s:]+)/, /\bon\b/ ] } grep { !/:$/ } @raw_l; + } else { + my $runlevel = my $runlevel = (split " ", `/sbin/runlevel`)[1]; + @l = sort { $a->[0] cmp $b->[0] } map { [ /([^\s:]+)/, /^\t/ ? /\bon\b/ : /\b$runlevel:on\b/ ] } grep { !/:$/ } @raw_l; + } [ map { $_->[0] } @l ], [ map { $_->[0] } grep { $_->[1] } @l ]; } -- cgit v1.2.1