summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2003-08-06 22:13:31 +0000
committerPascal Rigaux <pixel@mandriva.com>2003-08-06 22:13:31 +0000
commitd08a0346e9fcd6db8510da4ca4e880c48db0e99e (patch)
tree86681e30007a4cf8bf88457aac13db32c8015cdb
parente227f3e3a1fd834f04221c84bb75166c49af54af (diff)
downloaddrakx-d08a0346e9fcd6db8510da4ca4e880c48db0e99e.tar
drakx-d08a0346e9fcd6db8510da4ca4e880c48db0e99e.tar.gz
drakx-d08a0346e9fcd6db8510da4ca4e880c48db0e99e.tar.bz2
drakx-d08a0346e9fcd6db8510da4ca4e880c48db0e99e.tar.xz
drakx-d08a0346e9fcd6db8510da4ca4e880c48db0e99e.zip
create services_raw() which returns all the info out of "chkconfig --list"
-rw-r--r--perl-install/services.pm23
1 files changed, 18 insertions, 5 deletions
diff --git a/perl-install/services.pm b/perl-install/services.pm
index 86657fd3e..7e9c5b295 100644
--- a/perl-install/services.pm
+++ b/perl-install/services.pm
@@ -273,19 +273,32 @@ sub doit {
}
}
+sub services_raw() {
+ local $ENV{LANGUAGE} = 'C';
+ my (@services, @xinetd_services);
+ foreach (run_program::rooted_get_stdout($::prefix, '/sbin/chkconfig', '--list')) {
+ if (my ($name, $on_off) = m!^\t(\S+):\s*(on|off)!) {
+ push @xinetd_services, [ $name, $on_off eq 'on' ];
+ } elsif (my ($name, $l) = m!^(\S+)\s+(0:(on|off).*)!) {
+ push @services, [ $name, [ $l =~ /(\d+):on/g ] ];
+ }
+ }
+ \@services, \@xinetd_services;
+}
+
#- returns:
#--- the listref of installed services
#--- the listref of "on" services
sub services() {
- local $ENV{LANGUAGE} = 'C';
- my @raw_l = map { chomp; $_ } run_program::rooted_get_stdout($::prefix, '/sbin/chkconfig', '--list');
- my @l;
+ my ($services, $xinetd_services) = services_raw();
+ my @l = @$xinetd_services;
if ($::isInstall) {
- @l = sort { $a->[0] cmp $b->[0] } map { [ /([^\s:]+)/, /\bon\b/ ] } grep { !/:$/ } @raw_l;
+ push @l, map { [ $_->[0], @{$_->[1]} > 1 ] } @$services;
} else {
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;
+ push @l, map { [ $_->[0], member($runlevel, @{$_->[1]}) ] } @$services;
}
+ @l = sort { $a->[0] cmp $b->[0] } @l;
[ map { $_->[0] } @l ], [ map { $_->[0] } grep { $_->[1] } @l ];
}