Merge pull request #229 from bhush9/disable-services

Allow to disable services
This commit is contained in:
Teo Mrnjavac 2015-08-31 16:59:15 +02:00
commit aacf6a41e1
2 changed files with 16 additions and 0 deletions

View File

@ -26,6 +26,7 @@ def run():
""" Setup systemd services """ """ Setup systemd services """
services = libcalamares.job.configuration['services'] services = libcalamares.job.configuration['services']
targets = libcalamares.job.configuration['targets'] targets = libcalamares.job.configuration['targets']
disable = libcalamares.job.configuration['disable']
# enable services # enable services
for svc in services: for svc in services:
@ -51,4 +52,15 @@ def run():
libcalamares.utils.debug("Cannot enable systemd target {}".format(tgt['name'])) libcalamares.utils.debug("Cannot enable systemd target {}".format(tgt['name']))
libcalamares.utils.debug("systemctl enable call in chroot returned error code {}".format(ec)) 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 return None

View File

@ -11,3 +11,7 @@ services:
targets: targets:
- name: "graphical" - name: "graphical"
mandatory: true mandatory: true
disable:
- name: "pacman-init"
mandatory: false