summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorColin Guthrie <colin@mageia.org>2012-04-24 20:10:29 +0000
committerColin Guthrie <colin@mageia.org>2012-04-24 20:10:29 +0000
commit5e46be878b79d8f599ce615590b6d62339a9198e (patch)
tree265cda5f27177eb850c7e0568d5c2618eb0a6f20 /perl-install
parent2006454d4511f4e4170a4084d214d83b0170d06b (diff)
downloaddrakx-5e46be878b79d8f599ce615590b6d62339a9198e.tar
drakx-5e46be878b79d8f599ce615590b6d62339a9198e.tar.gz
drakx-5e46be878b79d8f599ce615590b6d62339a9198e.tar.bz2
drakx-5e46be878b79d8f599ce615590b6d62339a9198e.tar.xz
drakx-5e46be878b79d8f599ce615590b6d62339a9198e.zip
services: Read descriptions from systemd units.
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/services.pm22
1 files changed, 14 insertions, 8 deletions
diff --git a/perl-install/services.pm b/perl-install/services.pm
index 3814cedba..29e275d47 100644
--- a/perl-install/services.pm
+++ b/perl-install/services.pm
@@ -127,14 +127,20 @@ xinetd => N_("Starts other deamons on demand."),
if ($s) {
$s = translate($s);
} else {
- my $file = find { -e $_ } map { "$::prefix$_/$name" } '/etc/rc.d/init.d', '/etc/init.d', '/etc/xinetd.d';
- $s = cat_($file);
- $s =~ s/\\\s*\n#\s*//mg;
- $s =
- $s =~ /^#\s+(?:Short-)?[dD]escription:\s+(.*?)^(?:[^#]|# {0,2}\S)/sm ? $1 :
- $s =~ /^#\s*(.*?)^[^#]/sm ? $1 : '';
-
- $s =~ s/#\s*//mg;
+ my $file = "$::prefix/lib/systemd/system/$name.service";
+ if (-e $file) {
+ $s = cat_($file);
+ $s = $s =~ /^Description=(.*)/mg ? $1 : '';
+ } else {
+ $file = find { -e $_ } map { "$::prefix$_/$name" } '/etc/rc.d/init.d', '/etc/init.d', '/etc/xinetd.d';
+ $s = cat_($file);
+ $s =~ s/\\\s*\n#\s*//mg;
+ $s =
+ $s =~ /^#\s+(?:Short-)?[dD]escription:\s+(.*?)^(?:[^#]|# {0,2}\S)/sm ? $1 :
+ $s =~ /^#\s*(.*?)^[^#]/sm ? $1 : '';
+
+ $s =~ s/#\s*//mg;
+ }
}
$s =~ s/\n/ /gm; $s =~ s/\s+$//;
$s;