mirror of
https://github.com/systemd/systemd.git
synced 2024-11-25 11:13:34 +08:00
846acb6798
We unregister binfmt_misc twice during shutdown with this change: 1. A previous commit added support for doing that in the final shutdown phase, i.e. when we do the aggressive umount loop. This is the robust thing to do, in case the earlier ("clean") shutdown phase didn't work for some reason. 2. This commit adds support for doing that when systemd-binfmt.service is stopped. This is a good idea so that people can order mounts before the service if they want to register binaries from such mounts, as in that case we'll undo the registration on shutdown again, before unmounting those mounts. And all that, just because of that weird "F" flag the kernel introduced that can pin files... Fixes: #14981
33 lines
1.2 KiB
SYSTEMD
33 lines
1.2 KiB
SYSTEMD
# 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=Set Up Additional Binary Formats
|
|
Documentation=man:systemd-binfmt.service(8) man:binfmt.d(5)
|
|
Documentation=https://www.kernel.org/doc/html/latest/admin-guide/binfmt-misc.html
|
|
Documentation=https://www.freedesktop.org/wiki/Software/systemd/APIFileSystems
|
|
DefaultDependencies=no
|
|
Conflicts=shutdown.target
|
|
After=proc-sys-fs-binfmt_misc.automount
|
|
After=proc-sys-fs-binfmt_misc.mount
|
|
Before=sysinit.target shutdown.target
|
|
ConditionPathIsReadWrite=/proc/sys/
|
|
ConditionDirectoryNotEmpty=|/lib/binfmt.d
|
|
ConditionDirectoryNotEmpty=|/usr/lib/binfmt.d
|
|
ConditionDirectoryNotEmpty=|/usr/local/lib/binfmt.d
|
|
ConditionDirectoryNotEmpty=|/etc/binfmt.d
|
|
ConditionDirectoryNotEmpty=|/run/binfmt.d
|
|
|
|
[Service]
|
|
Type=oneshot
|
|
RemainAfterExit=yes
|
|
ExecStart=@rootlibexecdir@/systemd-binfmt
|
|
ExecStop=@rootlibexecdir@/systemd-binfmt --unregister
|
|
TimeoutSec=90s
|