mirror of
https://github.com/systemd/systemd.git
synced 2025-01-03 05:18:09 +03:00
units: rework systemd-nspawn@.service unit
- Unescape instance name so that we can take almost anything as instance name. - Introduce "machines.target" which consists of all enabled nspawns and can be used to start/stop them altogether - Look for container directory using -M instead of harcoding the path in /var/lib/container
This commit is contained in:
parent
8fa844dccf
commit
6a140df004
@ -549,6 +549,7 @@ nodist_systemunit_DATA = \
|
|||||||
units/initrd-udevadm-cleanup-db.service \
|
units/initrd-udevadm-cleanup-db.service \
|
||||||
units/initrd-switch-root.service \
|
units/initrd-switch-root.service \
|
||||||
units/systemd-nspawn@.service \
|
units/systemd-nspawn@.service \
|
||||||
|
units/machines.target \
|
||||||
units/systemd-update-done.service
|
units/systemd-update-done.service
|
||||||
|
|
||||||
if HAVE_UTMP
|
if HAVE_UTMP
|
||||||
|
17
units/machines.target
Normal file
17
units/machines.target
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
# 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=Containers
|
||||||
|
Documentation=man:systemd.special(7)
|
||||||
|
Requires=basic.target
|
||||||
|
Conflicts=rescue.service rescue.target
|
||||||
|
After=basic.target rescue.service rescue.target
|
||||||
|
Before=multi-user.target
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
@ -6,11 +6,13 @@
|
|||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
|
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Container %i
|
Description=Container %I
|
||||||
Documentation=man:systemd-nspawn(1)
|
Documentation=man:systemd-nspawn(1)
|
||||||
|
PartOf=machines.target
|
||||||
|
Before=machines.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
ExecStart=@bindir@/systemd-nspawn --quiet --keep-unit --boot --link-journal=try-guest --directory=/var/lib/container/%i
|
ExecStart=@bindir@/systemd-nspawn --quiet --keep-unit --boot --link-journal=try-guest --machine=%I
|
||||||
KillMode=mixed
|
KillMode=mixed
|
||||||
Type=notify
|
Type=notify
|
||||||
RestartForceExitStatus=133
|
RestartForceExitStatus=133
|
||||||
@ -18,4 +20,4 @@ SuccessExitStatus=133
|
|||||||
Delegate=yes
|
Delegate=yes
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=machines.target
|
||||||
|
Loading…
Reference in New Issue
Block a user