From ee32a1df3e137b60d05ebcf3c8a05a826c71c433 Mon Sep 17 00:00:00 2001 From: Colin Guthrie Date: Tue, 24 Apr 2012 20:10:38 +0000 Subject: services: Use systemd utility functions to determin how to handle enabling/disabling of services. --- perl-install/services.pm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'perl-install') diff --git a/perl-install/services.pm b/perl-install/services.pm index 02a9e38c6..70c88b03d 100644 --- a/perl-install/services.pm +++ b/perl-install/services.pm @@ -301,14 +301,18 @@ sub ask { sub _set_service { my ($service, $enable) = @_; - if (-f "/lib/systemd/system/$service.service") { + my @xinetd_services = map { $_->[0] } xinetd_services(); + + if (member($service, @xinetd_services)) { + run_program::rooted($::prefix, "chkconfig", $enable ? "--add" : "--del", $service); + } elsif (running_systemd() or has_systemd()) { if (-l "/lib/systemd/system/$service.service") { $service = basename(readlink("/lib/systemd/system/$service.service")); } else { $service = $service . ".service"; } - run_program::rooted($::prefix, "systemctl", $enable ? "enable" : "disable", $service); + run_program::rooted($::prefix, "/bin/systemctl", $enable ? "enable" : "disable", $service); } else { my $script = "/etc/rc.d/init.d/$service"; run_program::rooted($::prefix, "chkconfig", $enable ? "--add" : "--del", $service); -- cgit v1.2.1