From b3a692b8cc1dd4f260eaf6af6a48a8909217c6b4 Mon Sep 17 00:00:00 2001 From: Jason Mehring Date: Fri, 24 Jul 2015 05:05:44 -0400 Subject: [PATCH] vm-systemd: Add systemd drop-in support which include conditionals to prevent services from starting Added all the drop-ins and remove older .service overrides --- .../30_qubes.conf} | 1 - .../30_qubes.conf} | 1 - .../30_qubes.conf} | 1 - .../{ntpd.service => chronyd.service.d/30_qubes.conf} | 1 - .../{crond.service => cron.service.d/30_qubes.conf} | 3 ++- vm-systemd/crond.service.d/30_qubes.conf | 11 +++++++++++ vm-systemd/{cups.path => cups.path.d/30_qubes.conf} | 1 - .../{cups.socket => cups.service.d/30_qubes.conf} | 1 - .../{cups.service => cups.socket.d/30_qubes.conf} | 1 - vm-systemd/getty@tty.service.d/30_qubes.conf | 2 ++ vm-systemd/network-manager.service.d/30_qubes.conf | 3 +++ .../{chronyd.service => ntpd.service.d/30_qubes.conf} | 1 - vm-systemd/qubes-mount-home.service | 4 ++-- 13 files changed, 20 insertions(+), 11 deletions(-) rename vm-systemd/{ModemManager.service => ModemManager.service.d/30_qubes.conf} (71%) rename vm-systemd/{NetworkManager-wait-online.service => NetworkManager-wait-online.service.d/30_qubes.conf} (62%) rename vm-systemd/{NetworkManager.service => NetworkManager.service.d/30_qubes.conf} (77%) rename vm-systemd/{ntpd.service => chronyd.service.d/30_qubes.conf} (56%) rename vm-systemd/{crond.service => cron.service.d/30_qubes.conf} (85%) create mode 100644 vm-systemd/crond.service.d/30_qubes.conf rename vm-systemd/{cups.path => cups.path.d/30_qubes.conf} (58%) rename vm-systemd/{cups.socket => cups.service.d/30_qubes.conf} (57%) rename vm-systemd/{cups.service => cups.socket.d/30_qubes.conf} (56%) create mode 100644 vm-systemd/getty@tty.service.d/30_qubes.conf create mode 100644 vm-systemd/network-manager.service.d/30_qubes.conf rename vm-systemd/{chronyd.service => ntpd.service.d/30_qubes.conf} (55%) diff --git a/vm-systemd/ModemManager.service b/vm-systemd/ModemManager.service.d/30_qubes.conf similarity index 71% rename from vm-systemd/ModemManager.service rename to vm-systemd/ModemManager.service.d/30_qubes.conf index f530073..c8f3d99 100644 --- a/vm-systemd/ModemManager.service +++ b/vm-systemd/ModemManager.service.d/30_qubes.conf @@ -1,4 +1,3 @@ -.include /lib/systemd/system/ModemManager.service [Unit] ConditionPathExists=|/var/run/qubes-service/network-manager ConditionPathExists=|/var/run/qubes-service/modem-manager diff --git a/vm-systemd/NetworkManager-wait-online.service b/vm-systemd/NetworkManager-wait-online.service.d/30_qubes.conf similarity index 62% rename from vm-systemd/NetworkManager-wait-online.service rename to vm-systemd/NetworkManager-wait-online.service.d/30_qubes.conf index 00f3eb5..30836e5 100644 --- a/vm-systemd/NetworkManager-wait-online.service +++ b/vm-systemd/NetworkManager-wait-online.service.d/30_qubes.conf @@ -1,4 +1,3 @@ -.include /lib/systemd/system/NetworkManager-wait-online.service [Unit] ConditionPathExists=/var/run/qubes-service/network-manager # For /rw diff --git a/vm-systemd/NetworkManager.service b/vm-systemd/NetworkManager.service.d/30_qubes.conf similarity index 77% rename from vm-systemd/NetworkManager.service rename to vm-systemd/NetworkManager.service.d/30_qubes.conf index 1349161..5a35315 100644 --- a/vm-systemd/NetworkManager.service +++ b/vm-systemd/NetworkManager.service.d/30_qubes.conf @@ -1,4 +1,3 @@ -.include /lib/systemd/system/NetworkManager.service [Unit] ConditionPathExists=/var/run/qubes-service/network-manager # For /rw diff --git a/vm-systemd/ntpd.service b/vm-systemd/chronyd.service.d/30_qubes.conf similarity index 56% rename from vm-systemd/ntpd.service rename to vm-systemd/chronyd.service.d/30_qubes.conf index 21e93db..3c37ba3 100644 --- a/vm-systemd/ntpd.service +++ b/vm-systemd/chronyd.service.d/30_qubes.conf @@ -1,3 +1,2 @@ -.include /lib/systemd/system/ntpd.service [Unit] ConditionPathExists=/var/run/qubes-service/ntpd diff --git a/vm-systemd/crond.service b/vm-systemd/cron.service.d/30_qubes.conf similarity index 85% rename from vm-systemd/crond.service rename to vm-systemd/cron.service.d/30_qubes.conf index c1876d0..316131f 100644 --- a/vm-systemd/crond.service +++ b/vm-systemd/cron.service.d/30_qubes.conf @@ -1,6 +1,7 @@ -.include /lib/systemd/system/crond.service [Unit] ConditionPathExists=/var/run/qubes-service/crond + +[Unit] # For /rw After=qubes-misc-post.service diff --git a/vm-systemd/crond.service.d/30_qubes.conf b/vm-systemd/crond.service.d/30_qubes.conf new file mode 100644 index 0000000..316131f --- /dev/null +++ b/vm-systemd/crond.service.d/30_qubes.conf @@ -0,0 +1,11 @@ +[Unit] +ConditionPathExists=/var/run/qubes-service/crond + +[Unit] +# For /rw +After=qubes-misc-post.service + +[Service] +ExecStartPre=/bin/mkdir --mode=0700 -p /rw/cron +ExecStartPre=/bin/mount --bind /rw/cron /var/spool/cron +ExecStopPost=/bin/umount /var/spool/cron diff --git a/vm-systemd/cups.path b/vm-systemd/cups.path.d/30_qubes.conf similarity index 58% rename from vm-systemd/cups.path rename to vm-systemd/cups.path.d/30_qubes.conf index 57ebc9c..7762255 100644 --- a/vm-systemd/cups.path +++ b/vm-systemd/cups.path.d/30_qubes.conf @@ -1,3 +1,2 @@ -.include /lib/systemd/system/cups.path [Unit] ConditionPathExists=/var/run/qubes-service/cups diff --git a/vm-systemd/cups.socket b/vm-systemd/cups.service.d/30_qubes.conf similarity index 57% rename from vm-systemd/cups.socket rename to vm-systemd/cups.service.d/30_qubes.conf index 0295630..7762255 100644 --- a/vm-systemd/cups.socket +++ b/vm-systemd/cups.service.d/30_qubes.conf @@ -1,3 +1,2 @@ -.include /lib/systemd/system/cups.socket [Unit] ConditionPathExists=/var/run/qubes-service/cups diff --git a/vm-systemd/cups.service b/vm-systemd/cups.socket.d/30_qubes.conf similarity index 56% rename from vm-systemd/cups.service rename to vm-systemd/cups.socket.d/30_qubes.conf index 73e2796..7762255 100644 --- a/vm-systemd/cups.service +++ b/vm-systemd/cups.socket.d/30_qubes.conf @@ -1,3 +1,2 @@ -.include /lib/systemd/system/cups.service [Unit] ConditionPathExists=/var/run/qubes-service/cups diff --git a/vm-systemd/getty@tty.service.d/30_qubes.conf b/vm-systemd/getty@tty.service.d/30_qubes.conf new file mode 100644 index 0000000..5f26fd2 --- /dev/null +++ b/vm-systemd/getty@tty.service.d/30_qubes.conf @@ -0,0 +1,2 @@ +[Unit] +ConditionPathExists=/var/run/qubes-service/getty@tty diff --git a/vm-systemd/network-manager.service.d/30_qubes.conf b/vm-systemd/network-manager.service.d/30_qubes.conf new file mode 100644 index 0000000..24d1573 --- /dev/null +++ b/vm-systemd/network-manager.service.d/30_qubes.conf @@ -0,0 +1,3 @@ +# Disable sysinit version of network-manager (wheezy) +[Unit] +ConditionPathExists=!/var/run/qubes-service diff --git a/vm-systemd/chronyd.service b/vm-systemd/ntpd.service.d/30_qubes.conf similarity index 55% rename from vm-systemd/chronyd.service rename to vm-systemd/ntpd.service.d/30_qubes.conf index 22de124..3c37ba3 100644 --- a/vm-systemd/chronyd.service +++ b/vm-systemd/ntpd.service.d/30_qubes.conf @@ -1,3 +1,2 @@ -.include /lib/systemd/system/chronyd.service [Unit] ConditionPathExists=/var/run/qubes-service/ntpd diff --git a/vm-systemd/qubes-mount-home.service b/vm-systemd/qubes-mount-home.service index bbed16c..5398872 100644 --- a/vm-systemd/qubes-mount-home.service +++ b/vm-systemd/qubes-mount-home.service @@ -6,8 +6,8 @@ Before=qubes-gui-agent.service Type=oneshot RemainAfterExit=yes ExecStart=/usr/lib/qubes/init/mount-home.sh -# Fedora and Debian have different paths for fuser, so use 'which' -ExecStop=/bin/sh -c '`/usr/bin/which fuser` -kMm /home' ; /bin/umount /home +# Fedora and Debian have different paths for fuser +ExecStop=/bin/sh -c 'fuser -kMm /home' ; /bin/umount /home ExecStopPost=-/bin/umount /rw [Install]