diff options
author | Thierry Vignaud <tv@mageia.org> | 2012-05-23 18:25:15 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mageia.org> | 2012-05-23 18:25:15 +0000 |
commit | 8cbb71cf1b7e01aaaf689930efc911366c962465 (patch) | |
tree | 0dcc66d362fad3537acf58a3e973f3cd4210ccb3 /perl-install | |
parent | d6721a3d771fdf7f27d239cf6e5f10e7b0f32e00 (diff) | |
download | drakx-backup-do-not-use-8cbb71cf1b7e01aaaf689930efc911366c962465.tar drakx-backup-do-not-use-8cbb71cf1b7e01aaaf689930efc911366c962465.tar.gz drakx-backup-do-not-use-8cbb71cf1b7e01aaaf689930efc911366c962465.tar.bz2 drakx-backup-do-not-use-8cbb71cf1b7e01aaaf689930efc911366c962465.tar.xz drakx-backup-do-not-use-8cbb71cf1b7e01aaaf689930efc911366c962465.zip |
(systemd_unit_exists) factorize
Diffstat (limited to 'perl-install')
-rw-r--r-- | perl-install/services.pm | 10 |
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 ($) { |