mirror of
https://github.com/systemd/systemd
synced 2024-10-15 04:24:19 +00:00
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.
This commit is contained in:
parent
c261a5d014
commit
f4466bdbf9
|
@ -32,6 +32,7 @@
|
||||||
<filename>emergency.target</filename>,
|
<filename>emergency.target</filename>,
|
||||||
<filename>exit.target</filename>,
|
<filename>exit.target</filename>,
|
||||||
<filename>final.target</filename>,
|
<filename>final.target</filename>,
|
||||||
|
<filename>first-boot-complete.target</filename>,
|
||||||
<filename>getty.target</filename>,
|
<filename>getty.target</filename>,
|
||||||
<filename>getty-pre.target</filename>,
|
<filename>getty-pre.target</filename>,
|
||||||
<filename>graphical.target</filename>,
|
<filename>graphical.target</filename>,
|
||||||
|
@ -878,6 +879,17 @@
|
||||||
stopped.</para>
|
stopped.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</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>
|
<varlistentry>
|
||||||
<term><filename>getty-pre.target</filename></term>
|
<term><filename>getty-pre.target</filename></term>
|
||||||
<listitem>
|
<listitem>
|
||||||
|
|
14
units/first-boot-complete.target
Normal file
14
units/first-boot-complete.target
Normal file
|
@ -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
|
|
@ -17,6 +17,7 @@ units = [
|
||||||
['emergency.target', ''],
|
['emergency.target', ''],
|
||||||
['exit.target', ''],
|
['exit.target', ''],
|
||||||
['final.target', ''],
|
['final.target', ''],
|
||||||
|
['first-boot-complete.target', ''],
|
||||||
['getty.target', '',
|
['getty.target', '',
|
||||||
'multi-user.target.wants/'],
|
'multi-user.target.wants/'],
|
||||||
['getty-pre.target', ''],
|
['getty-pre.target', ''],
|
||||||
|
|
|
@ -12,8 +12,8 @@ Description=Commit a transient machine-id on disk
|
||||||
Documentation=man:systemd-machine-id-commit.service(8)
|
Documentation=man:systemd-machine-id-commit.service(8)
|
||||||
DefaultDependencies=no
|
DefaultDependencies=no
|
||||||
Conflicts=shutdown.target
|
Conflicts=shutdown.target
|
||||||
Before=sysinit.target shutdown.target
|
Before=shutdown.target
|
||||||
After=local-fs.target
|
After=local-fs.target first-boot-complete.target
|
||||||
ConditionPathIsReadWrite=/etc
|
ConditionPathIsReadWrite=/etc
|
||||||
ConditionPathIsMountPoint=/etc/machine-id
|
ConditionPathIsMountPoint=/etc/machine-id
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue