summaryrefslogtreecommitdiffstats
path: root/units
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2024-05-08 11:11:43 +0200
committerLennart Poettering <lennart@poettering.net>2024-06-25 09:57:42 +0200
commitf59665881191b7439bdbb5c7795f5ab6f2df1506 (patch)
treea7c046274fa13a5cd92360e5eab9b03b56bebb52 /units
parentimportd: add simple varlink API (diff)
downloadsystemd-f59665881191b7439bdbb5c7795f5ab6f2df1506.tar.xz
systemd-f59665881191b7439bdbb5c7795f5ab6f2df1506.zip
importd: allow activation in early boot, and make it socket activatable
Previously, importd was only accessible via D-Bus, which required it to be a late boot service. Now that we have Varlink we can rearrange things to become early-boot activated, just after the image directories are mounted. This will later allow us to have generator that auto-downloads images on boot.
Diffstat (limited to 'units')
-rw-r--r--units/meson.build5
-rw-r--r--units/systemd-importd.service.in8
-rw-r--r--units/systemd-importd.socket24
3 files changed, 36 insertions, 1 deletions
diff --git a/units/meson.build b/units/meson.build
index b231341a1f..bdc34e6f2c 100644
--- a/units/meson.build
+++ b/units/meson.build
@@ -362,6 +362,11 @@ units = [
'symlinks' : ['dbus-org.freedesktop.import1.service'],
},
{
+ 'file' : 'systemd-importd.socket',
+ 'conditions' : ['ENABLE_IMPORTD'],
+ 'symlinks' : ['sockets.target.wants/'],
+ },
+ {
'file' : 'systemd-initctl.service.in',
'conditions' : ['HAVE_SYSV_COMPAT'],
},
diff --git a/units/systemd-importd.service.in b/units/systemd-importd.service.in
index daa93776e1..e119d40929 100644
--- a/units/systemd-importd.service.in
+++ b/units/systemd-importd.service.in
@@ -8,9 +8,15 @@
# (at your option) any later version.
[Unit]
-Description=Virtual Machine and Container Download Service
+Description=Disk Image Download Service
Documentation=man:systemd-importd.service(8)
Documentation=man:org.freedesktop.import1(5)
+DefaultDependencies=no
+After=systemd-importd.socket
+WantsMountsFor=/var/lib/machines /var/lib/portables /var/lib/extensions /var/lib/confexts
+After=systemd-remount-fs.service
+Before=shutdown.target
+Conflicts=shutdown.target
[Service]
Type=notify
diff --git a/units/systemd-importd.socket b/units/systemd-importd.socket
new file mode 100644
index 0000000000..d1c9c22a4c
--- /dev/null
+++ b/units/systemd-importd.socket
@@ -0,0 +1,24 @@
+# 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=Disk Image Download Service Socket
+Documentation=man:systemd-importd.service(8)
+Documentation=man:org.freedesktop.import1(5)
+DefaultDependencies=no
+WantsMountsFor=/var/lib/machines /var/lib/portables /var/lib/extensions /var/lib/confexts
+After=systemd-remount-fs.service
+Before=sockets.target
+Conflicts=shutdown.target
+Before=shutdown.target
+
+[Socket]
+ListenStream=/run/systemd/io.systemd.Import
+FileDescriptorName=varlink
+SocketMode=0666