systemd: while disabling service, disable also its activators

This time it is for cups, which have socket-based and path-based
activators. When activator tires to start the service which is disabled
by condition file it enters infinite loop (as service wont start, but
will not report an error).
This commit is contained in:
Marek Marczykowski-Górecki 2013-12-16 21:10:37 +01:00
parent a0f3ce9e93
commit c04d4e4fea
4 changed files with 23 additions and 4 deletions

View File

@ -49,7 +49,7 @@ install-vm:
install -m 0644 vm-systemd/qubes-*.timer $(DESTDIR)/lib/systemd/system/
install -m 0644 vm-systemd/NetworkManager.service $(DESTDIR)/usr/lib/qubes/init/
install -m 0644 vm-systemd/NetworkManager-wait-online.service $(DESTDIR)/usr/lib/qubes/init/
install -m 0644 vm-systemd/cups.service $(DESTDIR)/usr/lib/qubes/init/
install -m 0644 vm-systemd/cups.* $(DESTDIR)/usr/lib/qubes/init/
install -m 0644 vm-systemd/ntpd.service $(DESTDIR)/usr/lib/qubes/init/
install -D -m 0440 misc/qubes.sudoers $(DESTDIR)/etc/sudoers.d/qubes

View File

@ -451,10 +451,14 @@ The Qubes core startup configuration for SystemD init.
/usr/lib/qubes/init/NetworkManager.service
/usr/lib/qubes/init/NetworkManager-wait-online.service
/usr/lib/qubes/init/cups.service
/usr/lib/qubes/init/cups.socket
/usr/lib/qubes/init/cups.path
/usr/lib/qubes/init/ntpd.service
%ghost %attr(0644,root,root) /etc/systemd/system/NetworkManager.service
%ghost %attr(0644,root,root) /etc/systemd/system/NetworkManager-wait-online.service
%ghost %attr(0644,root,root) /etc/systemd/system/cups.service
%ghost %attr(0644,root,root) /etc/systemd/system/cups.socket
%ghost %attr(0644,root,root) /etc/systemd/system/cups.path
%post systemd
@ -464,10 +468,19 @@ done
/bin/systemctl enable qubes-update-check.timer 2> /dev/null
UNITDIR=/lib/systemd/system
OVERRIDEDIR=/usr/lib/qubes/init
# Install overriden services only when original exists
for srv in cups NetworkManager NetworkManager-wait-online ntpd; do
if [ -f /lib/systemd/system/$srv.service ]; then
cp /usr/lib/qubes/init/$srv.service /etc/systemd/system/$srv.service
if [ -f $UNITDIR/$srv.service ]; then
cp $OVERRIDEDIR/$srv.service /etc/systemd/system/
fi
if [ -f $UNITDIR/$srv.socket -a -f $OVERRIDEDIR/$srv.socket ]; then
cp $OVERRIDEDIR/$srv.socket /etc/systemd/system/
fi
if [ -f $UNITDIR/$srv.path -a -f $OVERRIDEDIR/$srv.path ]; then
cp $OVERRIDEDIR/$srv.service /etc/systemd/system/
fi
done
@ -518,6 +531,6 @@ if [ "$1" != 0 ] ; then
exit 0
fi
for srv in qubes-dvm qubes-meminfo-writer qubes-sysinit qubes-misc-post qubes-netwatcher qubes-network qubes-qrexec-agenT; DO
for srv in qubes-dvm qubes-meminfo-writer qubes-sysinit qubes-misc-post qubes-netwatcher qubes-network qubes-qrexec-agenT; do
/bin/systemctl disable $srv.service
do

3
vm-systemd/cups.path Normal file
View File

@ -0,0 +1,3 @@
.include /lib/systemd/system/cups.path
[Unit]
ConditionPathExists=/var/run/qubes-service/cups

3
vm-systemd/cups.socket Normal file
View File

@ -0,0 +1,3 @@
.include /lib/systemd/system/cups.socket
[Unit]
ConditionPathExists=/var/run/qubes-service/cups