diff options
Diffstat (limited to 'perl-install')
-rw-r--r-- | perl-install/services.pm | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/perl-install/services.pm b/perl-install/services.pm index 813112d06..7c6e58ed2 100644 --- a/perl-install/services.pm +++ b/perl-install/services.pm @@ -291,11 +291,18 @@ sub ask { sub _set_service { my ($service, $enable) = @_; - my $script = "/etc/rc.d/init.d/$service"; - run_program::rooted($::prefix, "chkconfig", $enable ? "--add" : "--del", $service); - #- FIXME: handle services with no chkconfig line and with no Default-Start levels in LSB header - if ($enable && cat_("$::prefix$script") =~ /^#\s+chkconfig:\s+-/m) { - run_program::rooted($::prefix, "chkconfig", "--level", "35", $service, "on"); + + if ( -f "/lib/systemd/system/$service.service" ) { + run_program::rooted($::prefix, "systemctl", $enable ? "enable" : "disable", $service . ".service"); + } + else + { + my $script = "/etc/rc.d/init.d/$service"; + run_program::rooted($::prefix, "chkconfig", $enable ? "--add" : "--del", $service); + #- FIXME: handle services with no chkconfig line and with no Default-Start levels in LSB header + if ($enable && cat_("$::prefix$script") =~ /^#\s+chkconfig:\s+-/m) { + run_program::rooted($::prefix, "chkconfig", "--level", "35", $service, "on"); + } } } |