summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mageia.org>2012-08-13 10:35:05 +0000
committerThierry Vignaud <tv@mageia.org>2012-08-13 10:35:05 +0000
commit7c45e7ef94a5b73492bbf578bfa0fbca18db335d (patch)
tree98f3e3855b2e830d7e362ba43961ad7bbfc92389
parentfce6564e0df5d5f23ed20599831a0c3973617d3e (diff)
downloaddrakx-backup-do-not-use-7c45e7ef94a5b73492bbf578bfa0fbca18db335d.tar
drakx-backup-do-not-use-7c45e7ef94a5b73492bbf578bfa0fbca18db335d.tar.gz
drakx-backup-do-not-use-7c45e7ef94a5b73492bbf578bfa0fbca18db335d.tar.bz2
drakx-backup-do-not-use-7c45e7ef94a5b73492bbf578bfa0fbca18db335d.tar.xz
drakx-backup-do-not-use-7c45e7ef94a5b73492bbf578bfa0fbca18db335d.zip
drakxservices: when listing services ensure disabled services that can be enabled are shown (mga#6843)
(backported from trunk)
-rw-r--r--perl-install/NEWS3
-rw-r--r--perl-install/services.pm18
2 files changed, 21 insertions, 0 deletions
diff --git a/perl-install/NEWS b/perl-install/NEWS
index 5f03e6081..fc5ca5d79 100644
--- a/perl-install/NEWS
+++ b/perl-install/NEWS
@@ -1,4 +1,7 @@
- drakauth: don't update UsePAM option in sshd configuration
+- drakxservices:
+ o when listing services ensure disabled services that can be enabled are
+ shown (mga#6843)
Version 14.21 - 11 May 2012
diff --git a/perl-install/services.pm b/perl-install/services.pm
index 6eab201be..31047e624 100644
--- a/perl-install/services.pm
+++ b/perl-install/services.pm
@@ -372,6 +372,7 @@ sub xinetd_services() {
sub _systemd_services() {
local $ENV{LANGUAGE} = 'C';
my @services;
+ my %loaded;
# Running system using systemd
log::explanations("Detected systemd running. Using systemctl introspection.");
foreach (run_program::rooted_get_stdout($::prefix, '/bin/systemctl', '--full', '--all', 'list-units')) {
@@ -381,9 +382,26 @@ sub _systemd_services() {
# also handled by systemd
if ($name !~ /.*\@$/g && (-e "$::prefix/lib/systemd/system/$name.service" or -e "$::prefix/etc/rc.d/init.d/$name") && ! -l "$::prefix/lib/systemd/system/$name.service") {
push @services, [ $name, !!run_program::rooted($::prefix, '/bin/systemctl', '--quiet', 'is-enabled', "$name.service") ];
+ $loaded{$name} = 1;
}
}
}
+ # list-units will not list disabled units that can be enabled
+ foreach (run_program::rooted_get_stdout($::prefix, '/bin/systemctl', '--full', 'list-unit-files')) {
+ if (my ($name) = m!^(\S+)\.service\s+disabled!) {
+ # We only look at non-template, non-linked service files in /lib
+ # We also check for any non-masked sysvinit files as these are
+ # also handled by systemd
+ if (!exists $loaded{$name} && $name !~ /.*\@$/g && (-e "$::prefix/lib/systemd/system/$name.service" or -e "$::prefix/etc/rc.d/init.d/$name") && ! -l "$::prefix/lib/systemd/system/$name.service") {
+ # Limit ourselves to "standard" targets which can be enabled
+ my $wantedby = cat_("$::prefix/lib/systemd/system/$name.service") =~ /^WantedBy=(graphical|multi-user).target$/sm ? $1 : '';
+ if ($wantedby) {
+ push @services, [ $name, 0 ];
+ }
+ }
+ }
+ }
+
@services;
}