summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/NEWS4
-rw-r--r--perl-install/services.pm18
2 files changed, 22 insertions, 0 deletions
diff --git a/perl-install/NEWS b/perl-install/NEWS
index e935117df..1cf44c1ee 100644
--- a/perl-install/NEWS
+++ b/perl-install/NEWS
@@ -1,3 +1,7 @@
+- drakxservices:
+ o when listing services ensure disabled services that can be enabled are
+ shown (mga#6843)
+
Version 14.31 - 24 July 2012
- drakauth: don't update UsePAM option in sshd configuration
diff --git a/perl-install/services.pm b/perl-install/services.pm
index 6927b71b8..0b1359af2 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;
}