From: Darshaka Pathirana Date: Sat, 19 Nov 2016 00:51:54 +0000 (+0100) Subject: Enable and disable services by using systemd.presets X-Git-Tag: v0.28.0~11 X-Git-Url: https://git.grml.org/?p=grml-live.git;a=commitdiff_plain;h=6e61fc1fc4b79cc4506783c03e441a3686d287d2;hp=5b0d1600825c2fe273b47adaf6278cba3c241f5c Enable and disable services by using systemd.presets By using systemd.presets we can implement our own policy which services needs to be enabled or disabled on boot-time. This issue was initially triggered by a problem with the wpa_supplicant@*.service which failed on boot with an "Dependency failed for WPA supplicant daemon (interface-specific version)" error. See: http://paste.grml.org/2862/ --- diff --git a/etc/grml/fai/config/scripts/GRMLBASE/15-initsetup b/etc/grml/fai/config/scripts/GRMLBASE/15-initsetup index f94cd3f..ba29908 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/15-initsetup +++ b/etc/grml/fai/config/scripts/GRMLBASE/15-initsetup @@ -16,14 +16,6 @@ systemd_setup() { echo "Enabling user '$USERNAME' for autologin" sed -i "s/\$USERNAME/$USERNAME/" "$target"/etc/systemd/system/getty@tty*.service.d/override.conf - # enable TTY logins - local service - for file in "${target}"/etc/systemd/system/getty@tty*.service.d ; do - service=$(basename "$file" .d) - $ROOTCMD systemctl enable "$service" || echo "failed to enable $service" - done - unset service - # FIXME - ssh-keygen isn't executed yet before ssh-bootoption + ssh services $ROOTCMD systemctl enable ssh-bootoption.service || echo "failed to enable ssh-bootoption.service" $ROOTCMD systemctl enable ssh-keygen.service || echo "failed to enable ssh-keygen.service" @@ -32,25 +24,6 @@ systemd_setup() { # "Failed to unmount transient /etc/machine-id file in our private namespace: Invalid argument" $ROOTCMD systemctl mask systemd-machine-id-commit.service || echo "failed to mask $systemd-machine-id-commit.service" - # disable unwanted services - local service - for service in \ - cron.service \ - lvm2-lvmetad.service \ - lvm2-lvmetad.socket \ - lvm2-lvmpolld.socket \ - lvm2-monitor.service \ - mdadm-raid.service \ - smartd.service \ - ssh.service \ - swap.target \ - systemd-timesyncd.service \ - uuidd.service - do - $ROOTCMD systemctl disable ${service} || echo "failed to disable $service" - done - unset service - # TODO -> # * *proper* integration for grml-autoconfig