diff options
author | Harald Seiler <hws@denx.de> | 2020-09-06 21:23:36 +0200 |
---|---|---|
committer | Harald Seiler <hws@denx.de> | 2020-10-19 16:28:22 +0200 |
commit | f4466bdbf9c39e9b303809f93c04a80795606503 (patch) | |
tree | c4fea7954df3a7dbcd9d66ce88533e427295512b | |
parent | c261a5d01469a3f5b6c448c066ea7ad6d14a5300 (diff) | |
download | systemd-f4466bdbf9c39e9b303809f93c04a80795606503.tar.gz |
units: add first-boot-complete.target for first boot ordering
Add a new target for synchronizing units that wish to run once during
the first boot of the system. The machine-id will be committed to disk
only after the target has been reached, thus ensuring that all units
ordered before it had a chance to complete.
-rw-r--r-- | man/systemd.special.xml | 12 | ||||
-rw-r--r-- | units/first-boot-complete.target | 14 | ||||
-rw-r--r-- | units/meson.build | 1 | ||||
-rw-r--r-- | units/systemd-machine-id-commit.service | 4 |
4 files changed, 29 insertions, 2 deletions
diff --git a/man/systemd.special.xml b/man/systemd.special.xml index e43d765c9f..1434ead7d5 100644 --- a/man/systemd.special.xml +++ b/man/systemd.special.xml @@ -32,6 +32,7 @@ <filename>emergency.target</filename>, <filename>exit.target</filename>, <filename>final.target</filename>, + <filename>first-boot-complete.target</filename>, <filename>getty.target</filename>, <filename>getty-pre.target</filename>, <filename>graphical.target</filename>, @@ -879,6 +880,17 @@ </listitem> </varlistentry> <varlistentry> + <term><filename>first-boot-complete.target</filename></term> + <listitem> + <para>This passive target is intended as a synchronization point for units that need to run once + during the first boot. Only after all units ordered before this target have finished, will the + <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry> + be committed to disk, marking the first boot as completed. If the boot is aborted at any time + before that, the next boot will re-run any units with <varname>ConditionFirstBoot=yes</varname>. + </para> + </listitem> + </varlistentry> + <varlistentry> <term><filename>getty-pre.target</filename></term> <listitem> <para>A special passive target unit. Users of this target diff --git a/units/first-boot-complete.target b/units/first-boot-complete.target new file mode 100644 index 0000000000..98b236e9ff --- /dev/null +++ b/units/first-boot-complete.target @@ -0,0 +1,14 @@ +# 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=First Boot Complete +Documentation=man:systemd.special(7) +RefuseManualStart=yes +ConditionFirstBoot=yes diff --git a/units/meson.build b/units/meson.build index e94e7f7efd..40ffca5058 100644 --- a/units/meson.build +++ b/units/meson.build @@ -17,6 +17,7 @@ units = [ ['emergency.target', ''], ['exit.target', ''], ['final.target', ''], + ['first-boot-complete.target', ''], ['getty.target', '', 'multi-user.target.wants/'], ['getty-pre.target', ''], diff --git a/units/systemd-machine-id-commit.service b/units/systemd-machine-id-commit.service index e3acb0f326..5616a35701 100644 --- a/units/systemd-machine-id-commit.service +++ b/units/systemd-machine-id-commit.service @@ -12,8 +12,8 @@ Description=Commit a transient machine-id on disk Documentation=man:systemd-machine-id-commit.service(8) DefaultDependencies=no Conflicts=shutdown.target -Before=sysinit.target shutdown.target -After=local-fs.target +Before=shutdown.target +After=local-fs.target first-boot-complete.target ConditionPathIsReadWrite=/etc ConditionPathIsMountPoint=/etc/machine-id |