]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
units: Add new system-update-pre.target
authorHans de Goede <hdegoede@redhat.com>
Tue, 19 Jun 2018 08:50:41 +0000 (10:50 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 19 Jun 2018 11:42:19 +0000 (13:42 +0200)
systemd offline-updates allows dropping multiple system update units
to be added to system-update.target.wants.

As documented in systemd.offline-updates(7) only 1 of these units
should actually be active (based on the /system-update symlink) and
when that unit is done it should reboot the system.

In some cases it is desirable to run a unit whenever booting in
offline-updates mode indepedent of which update unit is going to
handle the update. One example of this is integration with bootloader
code which checks if the previous boot was succesful.

Since the active unit will reboot the system when it is done, there
is no guarantee that adding such a unit to system-update.target.wants
will get it executed always.

This commit adds a system-update-pre.target which can be used for
units which should always run when booting in offline-updates mode.

man/systemd.offline-updates.xml
units/meson.build
units/system-update-pre.target [new file with mode: 0644]
units/system-update.target

index 258d4467845a937c75191b529923472d0e8e737c..c11004c88222848a263500e536eb9ae82f0146d0 100644 (file)
       <listitem>
         <para>The update service should declare <varname>DefaultDependencies=false</varname>,
         <varname>Requires=sysinit.target</varname>, <varname>After=sysinit.target</varname>,
+        <varname>After=system-update-pre.target</varname>
         and explicitly pull in any other services it requires.</para>
       </listitem>
     </orderedlist>
index 77d52c10830e5962d73e7bedda38e6d5fd299f14..e4ac6ced64365c906c2b85cbfd1bca578e45892e 100644 (file)
@@ -77,6 +77,7 @@ units = [
         ['sysinit.target',                      ''],
         ['syslog.socket',                       ''],
         ['system-update.target',                ''],
+        ['system-update-pre.target',            ''],
         ['system-update-cleanup.service',       ''],
         ['systemd-ask-password-console.path',   '',
          'sysinit.target.wants/'],
diff --git a/units/system-update-pre.target b/units/system-update-pre.target
new file mode 100644 (file)
index 0000000..dbd9ad9
--- /dev/null
@@ -0,0 +1,16 @@
+#  SPDX-License-Identifier: LGPL-2.1+
+#
+#  This file is part of systemd.
+#
+#  systemd is free software; you can redistribute it and/or modify it
+#  under the terms of the GNU Lesser General Public License as published by
+#  the Free Software Foundation; either version 2.1 of the License, or
+#  (at your option) any later version.
+
+[Unit]
+Description=Offline System Update (Pre)
+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
index c46bfe754a98ecda4a3ad3c63cd3dd670da7e870..b52a494892a633ebab48082baf76bae794c5e0ab 100644 (file)
@@ -14,4 +14,5 @@ Documentation=man:systemd.special(7) man:systemd-system-update-generator(8)
 Requires=sysinit.target
 After=sysinit.target
 AllowIsolate=yes
+Wants=system-update-pre.target
 Wants=system-update-cleanup.service