2020-11-09 12:23:58 +08:00
|
|
|
# SPDX-License-Identifier: LGPL-2.1-or-later
|
2017-11-19 00:35:03 +08:00
|
|
|
#
|
2014-06-13 19:10:30 +08:00
|
|
|
# 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=Create System Users
|
|
|
|
Documentation=man:sysusers.d(5) man:systemd-sysusers.service(8)
|
2022-09-14 19:39:10 +08:00
|
|
|
|
2022-09-15 21:54:18 +08:00
|
|
|
ConditionNeedsUpdate=|/etc
|
|
|
|
ConditionCredential=|sysusers.extra
|
|
|
|
|
2014-06-13 19:10:30 +08:00
|
|
|
DefaultDependencies=no
|
2014-08-27 03:17:22 +08:00
|
|
|
After=systemd-remount-fs.service
|
2023-08-12 06:54:32 +08:00
|
|
|
After=systemd-tmpfiles-setup-dev-early.service
|
|
|
|
Before=systemd-tmpfiles-setup-dev.service
|
2022-09-14 19:39:10 +08:00
|
|
|
Before=sysinit.target systemd-update-done.service
|
units: add ordering dependencies on initrd-switch-root.target
For shutdown, we queue shutdown.target/start, so in every unit which should be
stopped *before* shutdown, we need both Conflicts and an ordering dependency
with shutdown.target (either Before= or After= would work, because stop jobs
are always ordered before start jobs).
For initrd transition, we queue initrd-switch-root.service/isolate. This
automatically creates a /stop job for every running unit without
IgnoreOnIsolate. But no ordering dependency is created, unless the unit has a
(possibly transitive) ordering dependency on initrd-switch-root.service.
Since most units must stop before the transition, we should add the ordering
dependency. It is nicer to use Before=initrd-switch-root.target for this.
initrd-switch-root.target is ordered before initrd-switch-root.service, so
the effect it the same when both are in a transaction.
Fixes #23745.
To also cover the case where somebody is emergency mode in the initrd and
queues initrd-switch-root.service/start (not isolate), also add
Conflicts=initrd-switch-root.target, so various units are stopped properly.
This extends 2525682565b372b9b83c848bfe89c025fed47a1d to cover all the other
services that are touched. It could be consider "operator error", but it's
easy to make and it's nicer if we can make this more foolproof.
2022-09-14 19:39:10 +08:00
|
|
|
Conflicts=shutdown.target initrd-switch-root.target
|
|
|
|
Before=shutdown.target initrd-switch-root.target
|
2022-09-14 19:39:10 +08:00
|
|
|
|
2014-06-13 19:10:30 +08:00
|
|
|
[Service]
|
|
|
|
Type=oneshot
|
|
|
|
RemainAfterExit=yes
|
2019-12-18 16:14:57 +08:00
|
|
|
ExecStart=systemd-sysusers
|
2015-04-17 09:41:18 +08:00
|
|
|
TimeoutSec=90s
|
2021-03-11 17:34:20 +08:00
|
|
|
|
|
|
|
# Optionally, pick up a root password and shell for the root user from a
|
|
|
|
# credential passed to the service manager. This is useful for importing this
|
|
|
|
# data from nspawn's --set-credential= switch.
|
2023-06-08 20:09:36 +08:00
|
|
|
ImportCredential=passwd.hashed-password.root
|
|
|
|
ImportCredential=passwd.plaintext-password.root
|
|
|
|
ImportCredential=passwd.shell.root
|
2022-07-13 17:06:04 +08:00
|
|
|
|
|
|
|
# Also, allow configuring extra sysusers lines via a credential
|
2023-06-08 20:09:36 +08:00
|
|
|
ImportCredential=sysusers.*
|