Allow to disable services

There might be some services that are enabled in live environment but
not useful for the installed environment and needs disabling by default
This commit is contained in:
Bhushan Shah 2015-08-31 17:58:51 +05:30
parent 8a5266166a
commit 829ae3e9e4

View File

@ -26,6 +26,7 @@ def run():
""" Setup systemd services """
services = libcalamares.job.configuration['services']
targets = libcalamares.job.configuration['targets']
disable = libcalamares.job.configuration['disable']
# enable services
for svc in services:
@ -51,4 +52,15 @@ def run():
libcalamares.utils.debug("Cannot enable systemd target {}".format(tgt['name']))
libcalamares.utils.debug("systemctl enable call in chroot returned error code {}".format(ec))
for dbl in disable:
ec = libcalamares.utils.chroot_call(['systemctl', 'disable', '{}.service'.format(dbl['name'])])
if ec != 0:
if dbl['mandatory']:
return "Cannot disable systemd service {}".format(dbl['name']), \
"systemctl disable call in chroot returned error code {}".format(ec)
else:
libcalamares.utils.debug("Cannot disable systemd service {}".format(dbl['name']))
libcalamares.utils.debug("systemctl disable call in chroot returned error code {}".format(ec))
return None