systemd: use presets to enable services, call preset-all

This way the services will be enabled/disabled regardless of its initial
state.
This commit is contained in:
Marek Marczykowski-Górecki 2015-04-07 02:30:59 +02:00
parent 2951e1ba02
commit 343ce1814c
2 changed files with 21 additions and 20 deletions

View File

@ -584,11 +584,7 @@ The Qubes core startup configuration for SystemD init.
%post systemd
for srv in qubes-dvm qubes-sysinit qubes-misc-post qubes-mount-home qubes-netwatcher qubes-network qubes-firewall qubes-updates-proxy qubes-qrexec-agent; do
/bin/systemctl --no-reload enable $srv.service 2> /dev/null
done
/bin/systemctl --no-reload enable qubes-update-check.timer 2> /dev/null
/bin/systemctl --no-reload preset-all
# Set default "runlevel"
rm -f /etc/systemd/system/default.target
@ -598,9 +594,7 @@ grep '^[[:space:]]*[^#;]' /lib/systemd/system-preset/75-qubes-vm.preset | while
case "$action" in
(disable)
if [ -f /lib/systemd/system/$unit_name.service ]; then
if fgrep -q '[Install]' /lib/systemd/system/$unit_name; then
/bin/systemctl --no-reload preset $unit_name 2> /dev/null
else
if ! fgrep -q '[Install]' /lib/systemd/system/$unit_name; then
# forcibly disable
ln -sf /dev/null /etc/systemd/system/$unit_name
fi
@ -611,16 +605,6 @@ done
rm -f /etc/systemd/system/getty.target.wants/getty@tty*.service
# Enable some services
/bin/systemctl --no-reload enable iptables.service 2> /dev/null
/bin/systemctl --no-reload enable ip6tables.service 2> /dev/null
/bin/systemctl --no-reload enable rsyslog.service 2> /dev/null
/bin/systemctl --no-reload enable ntpd.service 2> /dev/null
/bin/systemctl --no-reload enable crond.service 2> /dev/null
# Enable cups only when it is real SystemD service
[ -e /lib/systemd/system/cups.service ] && /bin/systemctl --no-reload enable cups.service 2> /dev/null
/bin/systemctl daemon-reload
exit 0
@ -641,8 +625,6 @@ exit 0
%installOverridenServices crond
exit 0
%triggerin systemd -- haveged
/bin/systemctl enable haveged.service 2> /dev/null
exit 0
%postun systemd

View File

@ -49,3 +49,22 @@ disable smartd.service
disable upower.service
disable irqbalance.service
disable colord.service
enable qubes-sysinit.service
enable qubes-db.service
enable qubes-gui-agent.service
enable qubes-update-check.timer
enable qubes-update-check.timer
enable qubes-misc-post.service
enable qubes-updates-proxy.service
enable qubes-dvm.service
enable qubes-network.service
enable qubes-qrexec-agent.service
enable qubes-mount-home.service
enable qubes-firewall.service
enable qubes-netwatcher.service
enable qubes-meminfo-writer.service
enable iptables.service
enable ip6tables.service
enable haveged.service
enable chronyd.service