From c7668c1ce04fa85370432d197d2ccd9411e85649 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 20 Jun 2018 12:46:18 +0200 Subject: [PATCH] units: make system-update-pre.target a passive unit (#9349) This is an additional synchronization point normally not needed. Hence, let's make it passive, i.e. pull it in from the unit which wants to be ordered before the update service rather than by the update service itself. --- NEWS | 6 ++++++ man/systemd.special.xml | 15 +++++++++------ units/system-update-pre.target | 1 - units/system-update.target | 3 +-- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/NEWS b/NEWS index da2d9defca..643ae5df0e 100644 --- a/NEWS +++ b/NEWS @@ -326,6 +326,12 @@ CHANGES WITH 239 in spe: system namespacing options. One such service is systemd-udevd.service wher this is now used by default. + * A new unit "system-update-pre.target" is added, which defines an + optional synchronization point for offline system updates, as + implemented by the pre-existing "system-update.target" unit. It + allows ordering services before the service that executes the actual + update process in a generic way. + Contributions from: Adam Duskett, Alan Jenkins, Alessandro Casale, Alexander Kurtz, Alex Gartrell, Anssi Hannula, Arnaud Rebillout, Brian J. Murrell, Bruno Vernay, Chris Lesiak, Christian Brauner, Christian diff --git a/man/systemd.special.xml b/man/systemd.special.xml index 2776276a1d..fb12805fff 100644 --- a/man/systemd.special.xml +++ b/man/systemd.special.xml @@ -78,6 +78,7 @@ swap.target, sysinit.target, system-update.target, + system-update-pre.target, time-sync.target, timers.target, umount.target, @@ -658,6 +659,7 @@ system-update.target + system-update-pre.target system-update-cleanup.service A special target unit that is used for offline system updates. @@ -667,12 +669,13 @@ systemd.offline-updates7. - Updates should happen before the system-update.target is - reached, and the services which implement them should cause the machine to reboot. As - a safety measure, if this does not happen, and /system-update - still exists after system-update.target is reached, - system-update-cleanup.service will remove this symlink and - reboot the machine. + Updates should happen before the system-update.target is reached, and the services + which implement them should cause the machine to reboot. The main units executing the update should order + themselves after system-update-pre.target but not pull it in. Services which want to run + during system updates only, but before the actual system update is executed should order themselves before + this unit and pull it in. As a safety measure, if this does not happen, and + /system-update still exists after system-update.target is reached, + system-update-cleanup.service will remove this symlink and reboot the machine. diff --git a/units/system-update-pre.target b/units/system-update-pre.target index dbd9ad92ec..163b75c220 100644 --- a/units/system-update-pre.target +++ b/units/system-update-pre.target @@ -13,4 +13,3 @@ Documentation=man:systemd.offline-updates(7) Documentation=man:systemd.special(7) man:systemd-system-update-generator(8) RefuseManualStart=yes After=sysinit.target -Before=system-update.target diff --git a/units/system-update.target b/units/system-update.target index b52a494892..be007e306d 100644 --- a/units/system-update.target +++ b/units/system-update.target @@ -12,7 +12,6 @@ Description=Offline System Update Documentation=man:systemd.offline-updates(7) Documentation=man:systemd.special(7) man:systemd-system-update-generator(8) Requires=sysinit.target -After=sysinit.target +After=sysinit.target system-update.target AllowIsolate=yes -Wants=system-update-pre.target Wants=system-update-cleanup.service