summaryrefslogtreecommitdiffstats
path: root/perl-install/services.pm
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mageia.org>2012-05-23 18:25:15 +0000
committerThierry Vignaud <tv@mageia.org>2012-05-23 18:25:15 +0000
commit0ed0f5c5d226551186365fc41cc94dfdef8f9a57 (patch)
tree0dcc66d362fad3537acf58a3e973f3cd4210ccb3 /perl-install/services.pm
parent230a1313cec8798ea39f018ebf6b3058692a6f39 (diff)
downloaddrakx-0ed0f5c5d226551186365fc41cc94dfdef8f9a57.tar
drakx-0ed0f5c5d226551186365fc41cc94dfdef8f9a57.tar.gz
drakx-0ed0f5c5d226551186365fc41cc94dfdef8f9a57.tar.bz2
drakx-0ed0f5c5d226551186365fc41cc94dfdef8f9a57.tar.xz
drakx-0ed0f5c5d226551186365fc41cc94dfdef8f9a57.zip
(systemd_unit_exists) factorize
Diffstat (limited to 'perl-install/services.pm')
-rw-r--r--perl-install/services.pm10
1 files changed, 6 insertions, 4 deletions
diff --git a/perl-install/services.pm b/perl-install/services.pm
index 6eab201be..cef49bb5a 100644
--- a/perl-install/services.pm
+++ b/perl-install/services.pm
@@ -433,7 +433,7 @@ sub _legacy_services() {
if (my ($name, $l) = m!^(\S+)\s+(0:(on|off).*)!) {
# If we expect to use systemd (i.e. installer) only show those
# sysvinit scripts which are not masked by a native systemd unit.
- my $has_systemd_unit = (-e "$::prefix/lib/systemd/system/$name.service" or -l "$::prefix/lib/systemd/system/$name.service");
+ my $has_systemd_unit = systemd_unit_exists($name);
if (!$has_systemd || !$has_systemd_unit) {
if ($::isInstall) {
$on_off = $l =~ /\d+:on/g;
@@ -466,12 +466,14 @@ sub services() {
-
-
+sub systemd_unit_exists {
+ my ($name) = @_;
+ -e "$::prefix/lib/systemd/system/$name.service" or -l "$::prefix/lib/systemd/system/$name.service";
+}
sub service_exists {
my ($service) = @_;
- -x "$::prefix/etc/rc.d/init.d/$service" or -e "$::prefix/lib/systemd/system/$service.service" or -l "$::prefix/lib/systemd/system/$service.service";
+ -x "$::prefix/etc/rc.d/init.d/$service" or systemd_unit_exists($service);
}
sub restart ($) {