aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAngelo Naselli <anaselli@linux.it>2016-05-05 22:32:46 +0200
committerAngelo Naselli <anaselli@linux.it>2016-05-05 22:32:46 +0200
commit3092a85563c21fc857dc58019e8df564fa8e21cc (patch)
tree70ce453c6088a4117ada8cd913f1ca91b8d592f4
parentb8b3eda6e3eb2b42ff94ff00882591627820c538 (diff)
downloadmanatools-3092a85563c21fc857dc58019e8df564fa8e21cc.tar
manatools-3092a85563c21fc857dc58019e8df564fa8e21cc.tar.gz
manatools-3092a85563c21fc857dc58019e8df564fa8e21cc.tar.bz2
manatools-3092a85563c21fc857dc58019e8df564fa8e21cc.tar.xz
manatools-3092a85563c21fc857dc58019e8df564fa8e21cc.zip
fixed disabling and enabling legacy services (github isse 3)
-rw-r--r--lib/ManaTools/Shared/Services.pm6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/ManaTools/Shared/Services.pm b/lib/ManaTools/Shared/Services.pm
index 686e4584..785b828d 100644
--- a/lib/ManaTools/Shared/Services.pm
+++ b/lib/ManaTools/Shared/Services.pm
@@ -393,10 +393,14 @@ sub set_service {
my @xinetd_services = map { $_->[0] } $self->xinetd_services();
+ # NOTE EnableUnitFiles and DisableUnitFiles don't work with legacy services
+ # and return file not found
+ my $legacy = -e "/etc/rc.d/init.d/$service";
+
if (MDK::Common::DataStructure::member($service, @xinetd_services)) {
$ENV{PATH} = "/usr/bin:/usr/sbin";
ManaTools::Shared::RunProgram::rooted("", "/usr/sbin/chkconfig", $enable ? "--add" : "--del", $service);
- } elsif ($self->_running_systemd() || $self->_has_systemd()) {
+ } elsif (!$legacy && ($self->_running_systemd() || $self->_has_systemd())) {
$service = $service . ".service";
my $dbus_object = $self->dbus_systemd1_object;
if ($enable) {