--- /dev/null
+# SPDX-License-Identifier: LGPL-2.1-or-later
+#
+# 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=Virtual Machine and Container Slice
+Documentation=man:systemd.special(7)
--- /dev/null
+# SPDX-License-Identifier: LGPL-2.1-or-later
+#
+# 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=Virtual Machines and Containers
+Documentation=man:systemd.special(7)
+Before=default.target
+
+[Install]
+WantedBy=default.target
{ 'file' : 'exit.target' },
{ 'file' : 'graphical-session-pre.target' },
{ 'file' : 'graphical-session.target' },
+ {
+ 'file' : 'machine.slice',
+ 'conditions' : ['ENABLE_MACHINED'],
+ },
+ {
+ 'file' : 'machines.target',
+ 'conditions' : ['ENABLE_MACHINED'],
+ },
{ 'file' : 'paths.target' },
{ 'file' : 'printer.target' },
{ 'file' : 'session.slice' },
{ 'file' : 'systemd-tmpfiles-clean.service' },
{ 'file' : 'systemd-tmpfiles-clean.timer' },
{ 'file' : 'systemd-tmpfiles-setup.service' },
+ {
+ 'file' : 'systemd-nspawn@.service.in',
+ 'conditions' : ['ENABLE_NSPAWN'],
+ },
+ {
+ 'file' : 'systemd-vmspawn@.service.in',
+ 'conditions' : ['ENABLE_VMSPAWN'],
+ },
{ 'file' : 'timers.target' },
{
'file' : 'xdg-desktop-autostart.target',
]
foreach unit : units
- file = unit.get('file')
+ source = unit.get('file')
+
+ if source.endswith('.in')
+ needs_jinja = true
+ name = source.substring(0, -3)
+ assert(name + '.in' == source)
+ else
+ needs_jinja = false
+ name = source
+ endif
+ source = files(source)
install = true
foreach cond : unit.get('conditions', [])
endif
endforeach
- if install
- install_data(file,
+ if needs_jinja
+ t = custom_target(
+ name,
+ input : source,
+ output : name,
+ command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'],
+ install : install,
+ install_dir : userunitdir)
+ elif install
+ install_data(source,
install_dir : userunitdir)
+ endif
+ if install
foreach target : unit.get('symlinks', [])
if target.endswith('/')
# '/' is only allowed at the end of the target
assert(target.replace('/', '') + '/' == target)
- install_symlink(file,
- pointing_to : '..' / file,
+ install_symlink(name,
+ pointing_to : '..' / name,
install_dir : userunitdir / target)
else
install_symlink(target,
- pointing_to : file,
+ pointing_to : name,
install_dir : userunitdir)
endif
endforeach
--- /dev/null
+# SPDX-License-Identifier: LGPL-2.1-or-later
+#
+# 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=Container %i
+Documentation=man:systemd-nspawn(1)
+PartOf=machines.target
+Before=machines.target
+
+[Service]
+ExecStart=systemd-nspawn --quiet --keep-unit --register=yes --boot --network-veth -U --settings=override --machine=%i
+ExecStopPost=systemd-nspawn --cleanup --machine=%i
+KillMode=mixed
+Type=notify
+RestartForceExitStatus=133
+SuccessExitStatus=133
+Slice=machine.slice
+Delegate=yes
+DelegateSubgroup=supervisor
+CoredumpReceive=yes
+TasksMax=16384
+{{SERVICE_WATCHDOG}}
+
+[Install]
+WantedBy=machines.target
--- /dev/null
+# SPDX-License-Identifier: LGPL-2.1-or-later
+#
+# 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=Virtual Machine %i
+Documentation=man:systemd-vmspawn(1)
+PartOf=machines.target
+Before=machines.target
+
+[Service]
+ExecStart=systemd-vmspawn --quiet --keep-unit --register=yes --network-tap --machine=%i
+KillMode=mixed
+Type=notify
+Slice=machine.slice
+{{SERVICE_WATCHDOG}}
+
+[Install]
+WantedBy=machines.target