Prepare for reusing libvirtd socket unit files with other daemons by
making various parts of their config conditionally defined by the make
rules.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
src/remote/Makefile.inc.am | 3 +++
src/remote/libvirtd-admin.socket.in | 15 ++++++++-------
src/remote/libvirtd-ro.socket.in | 15 ++++++++-------
src/remote/libvirtd-tcp.socket.in | 13 +++++++------
src/remote/libvirtd-tls.socket.in | 13 +++++++------
src/remote/libvirtd.socket.in | 11 ++++++-----
6 files changed, 39 insertions(+), 31 deletions(-)
diff --git a/src/remote/Makefile.inc.am b/src/remote/Makefile.inc.am
index 6b09fc9294..c56f9230f2 100644
--- a/src/remote/Makefile.inc.am
+++ b/src/remote/Makefile.inc.am
@@ -292,6 +292,9 @@ endif WITH_SASL
LIBVIRTD_UNIT_VARS = \
$(COMMON_UNIT_VARS) \
+ -e 's|[@]name[@]|Libvirt|g' \
+ -e 's|[@]service[@]|libvirtd|g' \
+ -e 's|[@]sockprefix[@]|libvirt|g' \
$(NULL)
libvirtd.service: remote/libvirtd.service.in $(top_builddir)/config.status
diff --git a/src/remote/libvirtd-admin.socket.in b/src/remote/libvirtd-admin.socket.in
index bbab4ea355..dcce7fdc93 100644
--- a/src/remote/libvirtd-admin.socket.in
+++ b/src/remote/libvirtd-admin.socket.in
@@ -1,14 +1,15 @@
[Unit]
-Description=Libvirt admin socket
-Before=libvirtd.service
-BindsTo=libvirtd.socket
-After=libvirtd.socket
+Description=@name@ admin socket
+Before=@service@.service
+BindsTo=@service@.socket
+After=@service@.socket
+@deps@
[Socket]
-# The directory must match the @sysconfdir(a)/libvirt/libvirtd.conf unix_sock_dir setting
+# The directory must match the @sysconfdir@/libvirt/@service@.conf unix_sock_dir setting
# when using systemd version < 227
-ListenStream=@localstatedir@/run/libvirt/libvirt-admin-sock
-Service=libvirtd.service
+ListenStream=@localstatedir@/run/libvirt/@sockprefix@-admin-sock
+Service=@service@.service
SocketMode=0600
[Install]
diff --git a/src/remote/libvirtd-ro.socket.in b/src/remote/libvirtd-ro.socket.in
index 5f8b1892d5..a287f78201 100644
--- a/src/remote/libvirtd-ro.socket.in
+++ b/src/remote/libvirtd-ro.socket.in
@@ -1,14 +1,15 @@
[Unit]
-Description=Libvirt local read-only socket
-Before=libvirtd.service
-BindsTo=libvirtd.socket
-After=libvirtd.socket
+Description=@name@ local read-only socket
+Before=@service@.service
+BindsTo=@service@.socket
+After=@service@.socket
+@deps@
[Socket]
-# The directory must match the @sysconfdir(a)/libvirt/libvirtd.conf unix_sock_dir setting
+# The directory must match the @sysconfdir@/libvirt/@service@.conf unix_sock_dir setting
# when using systemd version < 227
-ListenStream=@localstatedir@/run/libvirt/libvirt-sock-ro
-Service=libvirtd.service
+ListenStream=@localstatedir@/run/libvirt/@sockprefix@-sock-ro
+Service=@service@.service
SocketMode=0666
[Install]
diff --git a/src/remote/libvirtd-tcp.socket.in b/src/remote/libvirtd-tcp.socket.in
index 1103036c45..dd60317d47 100644
--- a/src/remote/libvirtd-tcp.socket.in
+++ b/src/remote/libvirtd-tcp.socket.in
@@ -1,14 +1,15 @@
[Unit]
-Description=Libvirt non-TLS IP socket
-Before=libvirtd.service
-BindsTo=libvirtd.socket
-After=libvirtd.socket
+Description=@name@ non-TLS IP socket
+Before=@service@.service
+BindsTo=@service@.socket
+After=@service@.socket
+@deps@
[Socket]
-# This must match the @sysconfdir(a)/libvirt/libvirtd.conf tcp_port setting
+# This must match the @sysconfdir@/libvirt/@service@.conf tcp_port setting
# when using systemd version < 227
ListenStream=16509
-Service=libvirtd.service
+Service=@service@.service
[Install]
WantedBy=sockets.target
diff --git a/src/remote/libvirtd-tls.socket.in b/src/remote/libvirtd-tls.socket.in
index e2b1f839de..8b89737fff 100644
--- a/src/remote/libvirtd-tls.socket.in
+++ b/src/remote/libvirtd-tls.socket.in
@@ -1,14 +1,15 @@
[Unit]
-Description=Libvirt TLS IP socket
-Before=libvirtd.service
-BindsTo=libvirtd.socket
-After=libvirtd.socket
+Description=@name@ TLS IP socket
+Before=@service@.service
+BindsTo=@service@.socket
+After=@service@.socket
+@deps@
[Socket]
-# This must match the @sysconfdir(a)/libvirt/libvirtd.conf tls_port setting
+# This must match the @sysconfdir@/libvirt/@service@.conf tls_port setting
# when using systemd version < 227
ListenStream=16514
-Service=libvirtd.service
+Service=@service@.service
[Install]
WantedBy=sockets.target
diff --git a/src/remote/libvirtd.socket.in b/src/remote/libvirtd.socket.in
index 872f70eb21..cb61409e23 100644
--- a/src/remote/libvirtd.socket.in
+++ b/src/remote/libvirtd.socket.in
@@ -1,12 +1,13 @@
[Unit]
-Description=Libvirt local socket
-Before=libvirtd.service
+Description=@name@ local socket
+Before=@service@.service
+@deps@
[Socket]
-# The directory must match the @sysconfdir(a)/libvirt/libvirtd.conf unix_sock_dir setting
+# The directory must match the @sysconfdir@/libvirt/@service@.conf unix_sock_dir setting
# when using systemd version < 227
-ListenStream=@localstatedir@/run/libvirt/libvirt-sock
-Service=libvirtd.service
+ListenStream=@localstatedir@/run/libvirt/@sockprefix@-sock
+Service=@service@.service
SocketMode=0666
[Install]
--
2.21.0