summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDexter Morgan <dmorgan@mageia.org>2011-11-06 21:02:30 +0000
committerDexter Morgan <dmorgan@mageia.org>2011-11-06 21:02:30 +0000
commit2317b8d9f1c7f15baef2bff4ebc31a5b9c30260e (patch)
tree7dc0916e24fcc6629d1471109c0f38db93730235
parent01bf0daf9e63026bb188e84824fceb12e0e057cd (diff)
downloaddrakx-2317b8d9f1c7f15baef2bff4ebc31a5b9c30260e.tar
drakx-2317b8d9f1c7f15baef2bff4ebc31a5b9c30260e.tar.gz
drakx-2317b8d9f1c7f15baef2bff4ebc31a5b9c30260e.tar.bz2
drakx-2317b8d9f1c7f15baef2bff4ebc31a5b9c30260e.tar.xz
drakx-2317b8d9f1c7f15baef2bff4ebc31a5b9c30260e.zip
Use systemctl when we have a service file
-rw-r--r--perl-install/services.pm17
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");
+ }
}
}