[libvirt PATCH 2/5] meson: Use initconfdir

Andrea Bolognani posted 5 patches 1 year, 2 months ago
[libvirt PATCH 2/5] meson: Use initconfdir
Posted by Andrea Bolognani 1 year, 2 months ago
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
 docs/manpages/libvirt-guests.rst        |  2 +-
 docs/manpages/meson.build               |  1 +
 src/ch/virtchd.service.in               |  2 +-
 src/interface/virtinterfaced.service.in |  2 +-
 src/libxl/virtxend.service.in           |  2 +-
 src/locking/virtlockd.service.in        |  2 +-
 src/logging/virtlogd.service.in         |  2 +-
 src/lxc/virtlxcd.service.in             |  2 +-
 src/meson.build                         |  1 +
 src/network/virtnetworkd.service.in     |  2 +-
 src/node_device/virtnodedevd.service.in |  2 +-
 src/nwfilter/virtnwfilterd.service.in   |  2 +-
 src/qemu/virtqemud.service.in           |  2 +-
 src/remote/libvirtd.service.in          |  2 +-
 src/remote/virtproxyd.service.in        |  2 +-
 src/secret/virtsecretd.service.in       |  2 +-
 src/storage/virtstoraged.service.in     |  2 +-
 src/vbox/virtvboxd.service.in           |  2 +-
 src/vz/virtvzd.service.in               |  2 +-
 tools/libvirt-guests.service.in         |  2 +-
 tools/libvirt-guests.sh.in              |  5 +++--
 tools/meson.build                       |  1 +
 tools/virt-pki-validate.in              | 13 +++++++------
 23 files changed, 31 insertions(+), 26 deletions(-)

diff --git a/docs/manpages/libvirt-guests.rst b/docs/manpages/libvirt-guests.rst
index bea08e3bff..f27eaad6e4 100644
--- a/docs/manpages/libvirt-guests.rst
+++ b/docs/manpages/libvirt-guests.rst
@@ -42,7 +42,7 @@ FILES
 ``libvirt-guests`` defines several variables to control service behavior.
 The default value of these variables can be overridden in:
 
-* ``@SYSCONFDIR@/sysconfig/libvirt-guests``
+* ``@INITCONFDIR@/libvirt-guests``
 
 The following variables are supported:
 
diff --git a/docs/manpages/meson.build b/docs/manpages/meson.build
index afcadaefbd..bdc17011a8 100644
--- a/docs/manpages/meson.build
+++ b/docs/manpages/meson.build
@@ -88,6 +88,7 @@ endforeach
 docs_man_conf = configuration_data({
   'SYSCONFDIR': sysconfdir,
   'RUNSTATEDIR': runstatedir,
+  'INITCONFDIR': initconfdir,
   'VERSION': meson.project_version(),
 })
 
diff --git a/src/ch/virtchd.service.in b/src/ch/virtchd.service.in
index 8c22b02c9e..a07c04a845 100644
--- a/src/ch/virtchd.service.in
+++ b/src/ch/virtchd.service.in
@@ -18,7 +18,7 @@ Documentation=https://libvirt.org
 [Service]
 Type=notify
 Environment=VIRTCHD_ARGS="--timeout 120"
-EnvironmentFile=-@sysconfdir@/sysconfig/virtchd
+EnvironmentFile=-@initconfdir@/virtchd
 ExecStart=@sbindir@/virtchd $VIRTCHD_ARGS
 ExecReload=/bin/kill -HUP $MAINPID
 KillMode=process
diff --git a/src/interface/virtinterfaced.service.in b/src/interface/virtinterfaced.service.in
index cb860ff1c4..1be3ab32dc 100644
--- a/src/interface/virtinterfaced.service.in
+++ b/src/interface/virtinterfaced.service.in
@@ -14,7 +14,7 @@ Documentation=https://libvirt.org
 [Service]
 Type=notify
 Environment=VIRTINTERFACED_ARGS="--timeout 120"
-EnvironmentFile=-@sysconfdir@/sysconfig/virtinterfaced
+EnvironmentFile=-@initconfdir@/virtinterfaced
 ExecStart=@sbindir@/virtinterfaced $VIRTINTERFACED_ARGS
 ExecReload=/bin/kill -HUP $MAINPID
 Restart=on-failure
diff --git a/src/libxl/virtxend.service.in b/src/libxl/virtxend.service.in
index 9171d4fdf8..abb1972777 100644
--- a/src/libxl/virtxend.service.in
+++ b/src/libxl/virtxend.service.in
@@ -19,7 +19,7 @@ ConditionPathExists=/proc/xen/capabilities
 [Service]
 Type=notify
 Environment=VIRTXEND_ARGS="--timeout 120"
-EnvironmentFile=-@sysconfdir@/sysconfig/virtxend
+EnvironmentFile=-@initconfdir@/virtxend
 ExecStart=@sbindir@/virtxend $VIRTXEND_ARGS
 ExecReload=/bin/kill -HUP $MAINPID
 Restart=on-failure
diff --git a/src/locking/virtlockd.service.in b/src/locking/virtlockd.service.in
index 19271d1e7d..23054369d5 100644
--- a/src/locking/virtlockd.service.in
+++ b/src/locking/virtlockd.service.in
@@ -8,7 +8,7 @@ Documentation=https://libvirt.org
 
 [Service]
 Environment=VIRTLOCKD_ARGS=
-EnvironmentFile=-@sysconfdir@/sysconfig/virtlockd
+EnvironmentFile=-@initconfdir@/virtlockd
 ExecStart=@sbindir@/virtlockd $VIRTLOCKD_ARGS
 ExecReload=/bin/kill -USR1 $MAINPID
 # Losing the locks is a really bad thing that will
diff --git a/src/logging/virtlogd.service.in b/src/logging/virtlogd.service.in
index 8ab5478517..158124e4d3 100644
--- a/src/logging/virtlogd.service.in
+++ b/src/logging/virtlogd.service.in
@@ -7,7 +7,7 @@ Documentation=man:virtlogd(8)
 Documentation=https://libvirt.org
 
 [Service]
-EnvironmentFile=-@sysconfdir@/sysconfig/virtlogd
+EnvironmentFile=-@initconfdir@/virtlogd
 ExecStart=@sbindir@/virtlogd $VIRTLOGD_ARGS
 ExecReload=/bin/kill -USR1 $MAINPID
 # Losing the logs is a really bad thing that will
diff --git a/src/lxc/virtlxcd.service.in b/src/lxc/virtlxcd.service.in
index 9946db9462..2623f7375a 100644
--- a/src/lxc/virtlxcd.service.in
+++ b/src/lxc/virtlxcd.service.in
@@ -18,7 +18,7 @@ Documentation=https://libvirt.org
 [Service]
 Type=notify
 Environment=VIRTLXCD_ARGS="--timeout 120"
-EnvironmentFile=-@sysconfdir@/sysconfig/virtlxcd
+EnvironmentFile=-@initconfdir@/virtlxcd
 ExecStart=@sbindir@/virtlxcd $VIRTLXCD_ARGS
 ExecReload=/bin/kill -HUP $MAINPID
 KillMode=process
diff --git a/src/meson.build b/src/meson.build
index ad7796f03d..c2b882d464 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -808,6 +808,7 @@ if conf.has('WITH_LIBVIRTD')
         'runstatedir': runstatedir,
         'sbindir': sbindir,
         'sysconfdir': sysconfdir,
+        'initconfdir': initconfdir,
         'name': unit['name'],
         'service': unit['service'],
         'sockprefix': unit['sockprefix'],
diff --git a/src/network/virtnetworkd.service.in b/src/network/virtnetworkd.service.in
index 05ce672b73..48423e777d 100644
--- a/src/network/virtnetworkd.service.in
+++ b/src/network/virtnetworkd.service.in
@@ -17,7 +17,7 @@ Documentation=https://libvirt.org
 [Service]
 Type=notify
 Environment=VIRTNETWORKD_ARGS="--timeout 120"
-EnvironmentFile=-@sysconfdir@/sysconfig/virtnetworkd
+EnvironmentFile=-@initconfdir@/virtnetworkd
 ExecStart=@sbindir@/virtnetworkd $VIRTNETWORKD_ARGS
 ExecReload=/bin/kill -HUP $MAINPID
 Restart=on-failure
diff --git a/src/node_device/virtnodedevd.service.in b/src/node_device/virtnodedevd.service.in
index cd9de362fd..3ceed30f29 100644
--- a/src/node_device/virtnodedevd.service.in
+++ b/src/node_device/virtnodedevd.service.in
@@ -14,7 +14,7 @@ Documentation=https://libvirt.org
 [Service]
 Type=notify
 Environment=VIRTNODEDEVD_ARGS="--timeout 120"
-EnvironmentFile=-@sysconfdir@/sysconfig/virtnodedevd
+EnvironmentFile=-@initconfdir@/virtnodedevd
 ExecStart=@sbindir@/virtnodedevd $VIRTNODEDEVD_ARGS
 ExecReload=/bin/kill -HUP $MAINPID
 Restart=on-failure
diff --git a/src/nwfilter/virtnwfilterd.service.in b/src/nwfilter/virtnwfilterd.service.in
index ab65419e0c..37fa54d684 100644
--- a/src/nwfilter/virtnwfilterd.service.in
+++ b/src/nwfilter/virtnwfilterd.service.in
@@ -14,7 +14,7 @@ Documentation=https://libvirt.org
 [Service]
 Type=notify
 Environment=VIRTNWFILTERD_ARGS="--timeout 120"
-EnvironmentFile=-@sysconfdir@/sysconfig/virtnwfilterd
+EnvironmentFile=-@initconfdir@/virtnwfilterd
 ExecStart=@sbindir@/virtnwfilterd $VIRTNWFILTERD_ARGS
 ExecReload=/bin/kill -HUP $MAINPID
 Restart=on-failure
diff --git a/src/qemu/virtqemud.service.in b/src/qemu/virtqemud.service.in
index 315359e287..032cbcbbf0 100644
--- a/src/qemu/virtqemud.service.in
+++ b/src/qemu/virtqemud.service.in
@@ -20,7 +20,7 @@ Documentation=https://libvirt.org
 [Service]
 Type=notify
 Environment=VIRTQEMUD_ARGS="--timeout 120"
-EnvironmentFile=-@sysconfdir@/sysconfig/virtqemud
+EnvironmentFile=-@initconfdir@/virtqemud
 ExecStart=@sbindir@/virtqemud $VIRTQEMUD_ARGS
 ExecReload=/bin/kill -HUP $MAINPID
 KillMode=process
diff --git a/src/remote/libvirtd.service.in b/src/remote/libvirtd.service.in
index 30588279f8..11507207a1 100644
--- a/src/remote/libvirtd.service.in
+++ b/src/remote/libvirtd.service.in
@@ -28,7 +28,7 @@ Documentation=https://libvirt.org
 [Service]
 Type=notify
 Environment=LIBVIRTD_ARGS="--timeout 120"
-EnvironmentFile=-@sysconfdir@/sysconfig/libvirtd
+EnvironmentFile=-@initconfdir@/libvirtd
 ExecStart=@sbindir@/libvirtd $LIBVIRTD_ARGS
 ExecReload=/bin/kill -HUP $MAINPID
 KillMode=process
diff --git a/src/remote/virtproxyd.service.in b/src/remote/virtproxyd.service.in
index f9bb6b84a9..dd3bdf3429 100644
--- a/src/remote/virtproxyd.service.in
+++ b/src/remote/virtproxyd.service.in
@@ -14,7 +14,7 @@ Documentation=https://libvirt.org
 [Service]
 Type=notify
 Environment=VIRTPROXYD_ARGS="--timeout 120"
-EnvironmentFile=-@sysconfdir@/sysconfig/virtproxyd
+EnvironmentFile=-@initconfdir@/virtproxyd
 ExecStart=@sbindir@/virtproxyd $VIRTPROXYD_ARGS
 ExecReload=/bin/kill -HUP $MAINPID
 Restart=on-failure
diff --git a/src/secret/virtsecretd.service.in b/src/secret/virtsecretd.service.in
index 6d298c5334..774cfc3ecd 100644
--- a/src/secret/virtsecretd.service.in
+++ b/src/secret/virtsecretd.service.in
@@ -14,7 +14,7 @@ Documentation=https://libvirt.org
 [Service]
 Type=notify
 Environment=VIRTSECRETD_ARGS="--timeout 120"
-EnvironmentFile=-@sysconfdir@/sysconfig/virtsecretd
+EnvironmentFile=-@initconfdir@/virtsecretd
 ExecStart=@sbindir@/virtsecretd $VIRTSECRETD_ARGS
 ExecReload=/bin/kill -HUP $MAINPID
 Restart=on-failure
diff --git a/src/storage/virtstoraged.service.in b/src/storage/virtstoraged.service.in
index eda4d86d37..e1a1ea6820 100644
--- a/src/storage/virtstoraged.service.in
+++ b/src/storage/virtstoraged.service.in
@@ -16,7 +16,7 @@ Documentation=https://libvirt.org
 [Service]
 Type=notify
 Environment=VIRTSTORAGED_ARGS="--timeout 120"
-EnvironmentFile=-@sysconfdir@/sysconfig/virtstoraged
+EnvironmentFile=-@initconfdir@/virtstoraged
 ExecStart=@sbindir@/virtstoraged $VIRTSTORAGED_ARGS
 ExecReload=/bin/kill -HUP $MAINPID
 Restart=on-failure
diff --git a/src/vbox/virtvboxd.service.in b/src/vbox/virtvboxd.service.in
index 6f447276e9..e73206591a 100644
--- a/src/vbox/virtvboxd.service.in
+++ b/src/vbox/virtvboxd.service.in
@@ -15,7 +15,7 @@ Documentation=https://libvirt.org
 [Service]
 Type=notify
 Environment=VIRTVBOXD_ARGS="--timeout 120"
-EnvironmentFile=-@sysconfdir@/sysconfig/virtvboxd
+EnvironmentFile=-@initconfdir@/virtvboxd
 ExecStart=@sbindir@/virtvboxd $VIRTVBOXD_ARGS
 ExecReload=/bin/kill -HUP $MAINPID
 Restart=on-failure
diff --git a/src/vz/virtvzd.service.in b/src/vz/virtvzd.service.in
index 2b1165c92b..bd98d96262 100644
--- a/src/vz/virtvzd.service.in
+++ b/src/vz/virtvzd.service.in
@@ -15,7 +15,7 @@ Documentation=https://libvirt.org
 [Service]
 Type=notify
 Environment=VIRTVZD_ARGS="--timeout 120"
-EnvironmentFile=-@sysconfdir@/sysconfig/virtvzd
+EnvironmentFile=-@initconfdir@/virtvzd
 ExecStart=@sbindir@/virtvzd $VIRTVZD_ARGS
 ExecReload=/bin/kill -HUP $MAINPID
 Restart=on-failure
diff --git a/tools/libvirt-guests.service.in b/tools/libvirt-guests.service.in
index 1c569c320d..c547218f2a 100644
--- a/tools/libvirt-guests.service.in
+++ b/tools/libvirt-guests.service.in
@@ -14,7 +14,7 @@ Documentation=man:libvirt-guests(8)
 Documentation=https://libvirt.org
 
 [Service]
-EnvironmentFile=-@sysconfdir@/sysconfig/libvirt-guests
+EnvironmentFile=-@initconfdir@/libvirt-guests
 # Hack just call traditional service until we factor
 # out the code
 ExecStart=@libexecdir@/libvirt-guests.sh start
diff --git a/tools/libvirt-guests.sh.in b/tools/libvirt-guests.sh.in
index 87f96af14d..016014215f 100644
--- a/tools/libvirt-guests.sh.in
+++ b/tools/libvirt-guests.sh.in
@@ -18,6 +18,7 @@
 
 sysconfdir="@sysconfdir@"
 localstatedir="@localstatedir@"
+initconfdir="@initconfdir@"
 libvirtd="@sbindir@"/libvirtd
 
 # Source function library.
@@ -39,8 +40,8 @@ START_DELAY=0
 BYPASS_CACHE=0
 SYNC_TIME=0
 
-test -f "$sysconfdir"/sysconfig/libvirt-guests &&
-    . "$sysconfdir"/sysconfig/libvirt-guests
+test -f "$initconfdir"/libvirt-guests &&
+    . "$initconfdir"/libvirt-guests
 
 LISTFILE="$localstatedir"/lib/libvirt/libvirt-guests
 VAR_SUBSYS_LIBVIRT_GUESTS="$localstatedir"/lock/subsys/libvirt-guests
diff --git a/tools/meson.build b/tools/meson.build
index fad7f202ad..f2d58cfdcb 100644
--- a/tools/meson.build
+++ b/tools/meson.build
@@ -241,6 +241,7 @@ tools_conf = configuration_data({
   'sbindir': sbindir,
   'schemadir': pkgdatadir / 'schemas',
   'sysconfdir': sysconfdir,
+  'initconfdir': initconfdir,
 })
 
 configure_file(
diff --git a/tools/virt-pki-validate.in b/tools/virt-pki-validate.in
index 7100eafb63..c91f247ba5 100644
--- a/tools/virt-pki-validate.in
+++ b/tools/virt-pki-validate.in
@@ -73,6 +73,7 @@ echo Found "$CERTOOL"
 #
 SYSCONFDIR="@sysconfdir@"
 PKI="$SYSCONFDIR/pki"
+INITCONFDIR="@initconfdir@"
 if [ ! -d "$PKI" ]
 then
     echo the $PKI directory is missing, it is usually
@@ -294,24 +295,24 @@ fi
 
 if [ "$SERVER" = "1" ]
 then
-    if [ -r "$SYSCONFDIR"/sysconfig/libvirtd ]
+    if [ -r "$INITCONFDIR"/libvirtd ]
     then
-        if grep "^LIBVIRTD_ARGS.*--listen" "$SYSCONFDIR"/sysconfig/libvirtd \
+        if grep "^LIBVIRTD_ARGS.*--listen" "$INITCONFDIR"/libvirtd \
             >/dev/null 2>&1
         then
             :
         else
-            echo Make sure "$SYSCONFDIR"/sysconfig/libvirtd is setup to listen to
+            echo Make sure "$INITCONFDIR"/libvirtd is setup to listen to
             echo TCP/IP connections and restart the libvirtd service
         fi
     fi
-    if [ -r "$SYSCONFDIR"/sysconfig/iptables ]
+    if [ -r "$INITCONFDIR"/iptables ]
     then
-        if grep "$PORT" "$SYSCONFDIR"/sysconfig/iptables >/dev/null 2>&1
+        if grep "$PORT" "$INITCONFDIR"/iptables >/dev/null 2>&1
         then
             :
         else
-            echo Make sure "$SYSCONFDIR"/sysconfig/iptables is setup to allow
+            echo Make sure "$INITCONFDIR"/iptables is setup to allow
             echo incoming TCP/IP connections on port $PORT and
             echo restart the iptables service
         fi
-- 
2.40.1
Re: [libvirt PATCH 2/5] meson: Use initconfdir
Posted by Martin Kletzander 1 year, 2 months ago
On Tue, May 02, 2023 at 07:15:49PM +0200, Andrea Bolognani wrote:
>Signed-off-by: Andrea Bolognani <abologna@redhat.com>
>---
> docs/manpages/libvirt-guests.rst        |  2 +-
> docs/manpages/meson.build               |  1 +
> src/ch/virtchd.service.in               |  2 +-
> src/interface/virtinterfaced.service.in |  2 +-
> src/libxl/virtxend.service.in           |  2 +-
> src/locking/virtlockd.service.in        |  2 +-
> src/logging/virtlogd.service.in         |  2 +-
> src/lxc/virtlxcd.service.in             |  2 +-
> src/meson.build                         |  1 +
> src/network/virtnetworkd.service.in     |  2 +-
> src/node_device/virtnodedevd.service.in |  2 +-
> src/nwfilter/virtnwfilterd.service.in   |  2 +-
> src/qemu/virtqemud.service.in           |  2 +-
> src/remote/libvirtd.service.in          |  2 +-
> src/remote/virtproxyd.service.in        |  2 +-
> src/secret/virtsecretd.service.in       |  2 +-
> src/storage/virtstoraged.service.in     |  2 +-
> src/vbox/virtvboxd.service.in           |  2 +-
> src/vz/virtvzd.service.in               |  2 +-
> tools/libvirt-guests.service.in         |  2 +-
> tools/libvirt-guests.sh.in              |  5 +++--
> tools/meson.build                       |  1 +
> tools/virt-pki-validate.in              | 13 +++++++------
> 23 files changed, 31 insertions(+), 26 deletions(-)
>
>diff --git a/docs/manpages/libvirt-guests.rst b/docs/manpages/libvirt-guests.rst
>index bea08e3bff..f27eaad6e4 100644
>--- a/docs/manpages/libvirt-guests.rst
>+++ b/docs/manpages/libvirt-guests.rst
>@@ -42,7 +42,7 @@ FILES
> ``libvirt-guests`` defines several variables to control service behavior.
> The default value of these variables can be overridden in:
>
>-* ``@SYSCONFDIR@/sysconfig/libvirt-guests``
>+* ``@INITCONFDIR@/libvirt-guests``
>
> The following variables are supported:
>
>diff --git a/docs/manpages/meson.build b/docs/manpages/meson.build
>index afcadaefbd..bdc17011a8 100644
>--- a/docs/manpages/meson.build
>+++ b/docs/manpages/meson.build
>@@ -88,6 +88,7 @@ endforeach
> docs_man_conf = configuration_data({
>   'SYSCONFDIR': sysconfdir,
>   'RUNSTATEDIR': runstatedir,
>+  'INITCONFDIR': initconfdir,
>   'VERSION': meson.project_version(),
> })
>
>diff --git a/src/ch/virtchd.service.in b/src/ch/virtchd.service.in
>index 8c22b02c9e..a07c04a845 100644
>--- a/src/ch/virtchd.service.in
>+++ b/src/ch/virtchd.service.in
>@@ -18,7 +18,7 @@ Documentation=https://libvirt.org
> [Service]
> Type=notify
> Environment=VIRTCHD_ARGS="--timeout 120"
>-EnvironmentFile=-@sysconfdir@/sysconfig/virtchd
>+EnvironmentFile=-@initconfdir@/virtchd
> ExecStart=@sbindir@/virtchd $VIRTCHD_ARGS
> ExecReload=/bin/kill -HUP $MAINPID
> KillMode=process
>diff --git a/src/interface/virtinterfaced.service.in b/src/interface/virtinterfaced.service.in
>index cb860ff1c4..1be3ab32dc 100644
>--- a/src/interface/virtinterfaced.service.in
>+++ b/src/interface/virtinterfaced.service.in
>@@ -14,7 +14,7 @@ Documentation=https://libvirt.org
> [Service]
> Type=notify
> Environment=VIRTINTERFACED_ARGS="--timeout 120"
>-EnvironmentFile=-@sysconfdir@/sysconfig/virtinterfaced
>+EnvironmentFile=-@initconfdir@/virtinterfaced
> ExecStart=@sbindir@/virtinterfaced $VIRTINTERFACED_ARGS
> ExecReload=/bin/kill -HUP $MAINPID
> Restart=on-failure
>diff --git a/src/libxl/virtxend.service.in b/src/libxl/virtxend.service.in
>index 9171d4fdf8..abb1972777 100644
>--- a/src/libxl/virtxend.service.in
>+++ b/src/libxl/virtxend.service.in
>@@ -19,7 +19,7 @@ ConditionPathExists=/proc/xen/capabilities
> [Service]
> Type=notify
> Environment=VIRTXEND_ARGS="--timeout 120"
>-EnvironmentFile=-@sysconfdir@/sysconfig/virtxend
>+EnvironmentFile=-@initconfdir@/virtxend
> ExecStart=@sbindir@/virtxend $VIRTXEND_ARGS
> ExecReload=/bin/kill -HUP $MAINPID
> Restart=on-failure
>diff --git a/src/locking/virtlockd.service.in b/src/locking/virtlockd.service.in
>index 19271d1e7d..23054369d5 100644
>--- a/src/locking/virtlockd.service.in
>+++ b/src/locking/virtlockd.service.in
>@@ -8,7 +8,7 @@ Documentation=https://libvirt.org
>
> [Service]
> Environment=VIRTLOCKD_ARGS=
>-EnvironmentFile=-@sysconfdir@/sysconfig/virtlockd
>+EnvironmentFile=-@initconfdir@/virtlockd
> ExecStart=@sbindir@/virtlockd $VIRTLOCKD_ARGS
> ExecReload=/bin/kill -USR1 $MAINPID
> # Losing the locks is a really bad thing that will
>diff --git a/src/logging/virtlogd.service.in b/src/logging/virtlogd.service.in
>index 8ab5478517..158124e4d3 100644
>--- a/src/logging/virtlogd.service.in
>+++ b/src/logging/virtlogd.service.in
>@@ -7,7 +7,7 @@ Documentation=man:virtlogd(8)
> Documentation=https://libvirt.org
>
> [Service]
>-EnvironmentFile=-@sysconfdir@/sysconfig/virtlogd
>+EnvironmentFile=-@initconfdir@/virtlogd
> ExecStart=@sbindir@/virtlogd $VIRTLOGD_ARGS
> ExecReload=/bin/kill -USR1 $MAINPID
> # Losing the logs is a really bad thing that will
>diff --git a/src/lxc/virtlxcd.service.in b/src/lxc/virtlxcd.service.in
>index 9946db9462..2623f7375a 100644
>--- a/src/lxc/virtlxcd.service.in
>+++ b/src/lxc/virtlxcd.service.in
>@@ -18,7 +18,7 @@ Documentation=https://libvirt.org
> [Service]
> Type=notify
> Environment=VIRTLXCD_ARGS="--timeout 120"
>-EnvironmentFile=-@sysconfdir@/sysconfig/virtlxcd
>+EnvironmentFile=-@initconfdir@/virtlxcd
> ExecStart=@sbindir@/virtlxcd $VIRTLXCD_ARGS
> ExecReload=/bin/kill -HUP $MAINPID
> KillMode=process
>diff --git a/src/meson.build b/src/meson.build
>index ad7796f03d..c2b882d464 100644
>--- a/src/meson.build
>+++ b/src/meson.build
>@@ -808,6 +808,7 @@ if conf.has('WITH_LIBVIRTD')
>         'runstatedir': runstatedir,
>         'sbindir': sbindir,
>         'sysconfdir': sysconfdir,
>+        'initconfdir': initconfdir,
>         'name': unit['name'],
>         'service': unit['service'],
>         'sockprefix': unit['sockprefix'],
>diff --git a/src/network/virtnetworkd.service.in b/src/network/virtnetworkd.service.in
>index 05ce672b73..48423e777d 100644
>--- a/src/network/virtnetworkd.service.in
>+++ b/src/network/virtnetworkd.service.in
>@@ -17,7 +17,7 @@ Documentation=https://libvirt.org
> [Service]
> Type=notify
> Environment=VIRTNETWORKD_ARGS="--timeout 120"
>-EnvironmentFile=-@sysconfdir@/sysconfig/virtnetworkd
>+EnvironmentFile=-@initconfdir@/virtnetworkd
> ExecStart=@sbindir@/virtnetworkd $VIRTNETWORKD_ARGS
> ExecReload=/bin/kill -HUP $MAINPID
> Restart=on-failure
>diff --git a/src/node_device/virtnodedevd.service.in b/src/node_device/virtnodedevd.service.in
>index cd9de362fd..3ceed30f29 100644
>--- a/src/node_device/virtnodedevd.service.in
>+++ b/src/node_device/virtnodedevd.service.in
>@@ -14,7 +14,7 @@ Documentation=https://libvirt.org
> [Service]
> Type=notify
> Environment=VIRTNODEDEVD_ARGS="--timeout 120"
>-EnvironmentFile=-@sysconfdir@/sysconfig/virtnodedevd
>+EnvironmentFile=-@initconfdir@/virtnodedevd
> ExecStart=@sbindir@/virtnodedevd $VIRTNODEDEVD_ARGS
> ExecReload=/bin/kill -HUP $MAINPID
> Restart=on-failure
>diff --git a/src/nwfilter/virtnwfilterd.service.in b/src/nwfilter/virtnwfilterd.service.in
>index ab65419e0c..37fa54d684 100644
>--- a/src/nwfilter/virtnwfilterd.service.in
>+++ b/src/nwfilter/virtnwfilterd.service.in
>@@ -14,7 +14,7 @@ Documentation=https://libvirt.org
> [Service]
> Type=notify
> Environment=VIRTNWFILTERD_ARGS="--timeout 120"
>-EnvironmentFile=-@sysconfdir@/sysconfig/virtnwfilterd
>+EnvironmentFile=-@initconfdir@/virtnwfilterd
> ExecStart=@sbindir@/virtnwfilterd $VIRTNWFILTERD_ARGS
> ExecReload=/bin/kill -HUP $MAINPID
> Restart=on-failure
>diff --git a/src/qemu/virtqemud.service.in b/src/qemu/virtqemud.service.in
>index 315359e287..032cbcbbf0 100644
>--- a/src/qemu/virtqemud.service.in
>+++ b/src/qemu/virtqemud.service.in
>@@ -20,7 +20,7 @@ Documentation=https://libvirt.org
> [Service]
> Type=notify
> Environment=VIRTQEMUD_ARGS="--timeout 120"
>-EnvironmentFile=-@sysconfdir@/sysconfig/virtqemud
>+EnvironmentFile=-@initconfdir@/virtqemud
> ExecStart=@sbindir@/virtqemud $VIRTQEMUD_ARGS
> ExecReload=/bin/kill -HUP $MAINPID
> KillMode=process
>diff --git a/src/remote/libvirtd.service.in b/src/remote/libvirtd.service.in
>index 30588279f8..11507207a1 100644
>--- a/src/remote/libvirtd.service.in
>+++ b/src/remote/libvirtd.service.in
>@@ -28,7 +28,7 @@ Documentation=https://libvirt.org
> [Service]
> Type=notify
> Environment=LIBVIRTD_ARGS="--timeout 120"
>-EnvironmentFile=-@sysconfdir@/sysconfig/libvirtd
>+EnvironmentFile=-@initconfdir@/libvirtd
> ExecStart=@sbindir@/libvirtd $LIBVIRTD_ARGS
> ExecReload=/bin/kill -HUP $MAINPID
> KillMode=process
>diff --git a/src/remote/virtproxyd.service.in b/src/remote/virtproxyd.service.in
>index f9bb6b84a9..dd3bdf3429 100644
>--- a/src/remote/virtproxyd.service.in
>+++ b/src/remote/virtproxyd.service.in
>@@ -14,7 +14,7 @@ Documentation=https://libvirt.org
> [Service]
> Type=notify
> Environment=VIRTPROXYD_ARGS="--timeout 120"
>-EnvironmentFile=-@sysconfdir@/sysconfig/virtproxyd
>+EnvironmentFile=-@initconfdir@/virtproxyd
> ExecStart=@sbindir@/virtproxyd $VIRTPROXYD_ARGS
> ExecReload=/bin/kill -HUP $MAINPID
> Restart=on-failure
>diff --git a/src/secret/virtsecretd.service.in b/src/secret/virtsecretd.service.in
>index 6d298c5334..774cfc3ecd 100644
>--- a/src/secret/virtsecretd.service.in
>+++ b/src/secret/virtsecretd.service.in
>@@ -14,7 +14,7 @@ Documentation=https://libvirt.org
> [Service]
> Type=notify
> Environment=VIRTSECRETD_ARGS="--timeout 120"
>-EnvironmentFile=-@sysconfdir@/sysconfig/virtsecretd
>+EnvironmentFile=-@initconfdir@/virtsecretd
> ExecStart=@sbindir@/virtsecretd $VIRTSECRETD_ARGS
> ExecReload=/bin/kill -HUP $MAINPID
> Restart=on-failure
>diff --git a/src/storage/virtstoraged.service.in b/src/storage/virtstoraged.service.in
>index eda4d86d37..e1a1ea6820 100644
>--- a/src/storage/virtstoraged.service.in
>+++ b/src/storage/virtstoraged.service.in
>@@ -16,7 +16,7 @@ Documentation=https://libvirt.org
> [Service]
> Type=notify
> Environment=VIRTSTORAGED_ARGS="--timeout 120"
>-EnvironmentFile=-@sysconfdir@/sysconfig/virtstoraged
>+EnvironmentFile=-@initconfdir@/virtstoraged
> ExecStart=@sbindir@/virtstoraged $VIRTSTORAGED_ARGS
> ExecReload=/bin/kill -HUP $MAINPID
> Restart=on-failure
>diff --git a/src/vbox/virtvboxd.service.in b/src/vbox/virtvboxd.service.in
>index 6f447276e9..e73206591a 100644
>--- a/src/vbox/virtvboxd.service.in
>+++ b/src/vbox/virtvboxd.service.in
>@@ -15,7 +15,7 @@ Documentation=https://libvirt.org
> [Service]
> Type=notify
> Environment=VIRTVBOXD_ARGS="--timeout 120"
>-EnvironmentFile=-@sysconfdir@/sysconfig/virtvboxd
>+EnvironmentFile=-@initconfdir@/virtvboxd
> ExecStart=@sbindir@/virtvboxd $VIRTVBOXD_ARGS
> ExecReload=/bin/kill -HUP $MAINPID
> Restart=on-failure
>diff --git a/src/vz/virtvzd.service.in b/src/vz/virtvzd.service.in
>index 2b1165c92b..bd98d96262 100644
>--- a/src/vz/virtvzd.service.in
>+++ b/src/vz/virtvzd.service.in
>@@ -15,7 +15,7 @@ Documentation=https://libvirt.org
> [Service]
> Type=notify
> Environment=VIRTVZD_ARGS="--timeout 120"
>-EnvironmentFile=-@sysconfdir@/sysconfig/virtvzd
>+EnvironmentFile=-@initconfdir@/virtvzd
> ExecStart=@sbindir@/virtvzd $VIRTVZD_ARGS
> ExecReload=/bin/kill -HUP $MAINPID
> Restart=on-failure
>diff --git a/tools/libvirt-guests.service.in b/tools/libvirt-guests.service.in
>index 1c569c320d..c547218f2a 100644
>--- a/tools/libvirt-guests.service.in
>+++ b/tools/libvirt-guests.service.in
>@@ -14,7 +14,7 @@ Documentation=man:libvirt-guests(8)
> Documentation=https://libvirt.org
>
> [Service]
>-EnvironmentFile=-@sysconfdir@/sysconfig/libvirt-guests
>+EnvironmentFile=-@initconfdir@/libvirt-guests
> # Hack just call traditional service until we factor
> # out the code
> ExecStart=@libexecdir@/libvirt-guests.sh start
>diff --git a/tools/libvirt-guests.sh.in b/tools/libvirt-guests.sh.in
>index 87f96af14d..016014215f 100644
>--- a/tools/libvirt-guests.sh.in
>+++ b/tools/libvirt-guests.sh.in
>@@ -18,6 +18,7 @@
>
> sysconfdir="@sysconfdir@"
> localstatedir="@localstatedir@"
>+initconfdir="@initconfdir@"
> libvirtd="@sbindir@"/libvirtd
>
> # Source function library.
>@@ -39,8 +40,8 @@ START_DELAY=0
> BYPASS_CACHE=0
> SYNC_TIME=0
>
>-test -f "$sysconfdir"/sysconfig/libvirt-guests &&
>-    . "$sysconfdir"/sysconfig/libvirt-guests
>+test -f "$initconfdir"/libvirt-guests &&
>+    . "$initconfdir"/libvirt-guests
>
> LISTFILE="$localstatedir"/lib/libvirt/libvirt-guests
> VAR_SUBSYS_LIBVIRT_GUESTS="$localstatedir"/lock/subsys/libvirt-guests
>diff --git a/tools/meson.build b/tools/meson.build
>index fad7f202ad..f2d58cfdcb 100644
>--- a/tools/meson.build
>+++ b/tools/meson.build
>@@ -241,6 +241,7 @@ tools_conf = configuration_data({
>   'sbindir': sbindir,
>   'schemadir': pkgdatadir / 'schemas',
>   'sysconfdir': sysconfdir,
>+  'initconfdir': initconfdir,
> })
>
> configure_file(
>diff --git a/tools/virt-pki-validate.in b/tools/virt-pki-validate.in
>index 7100eafb63..c91f247ba5 100644
>--- a/tools/virt-pki-validate.in
>+++ b/tools/virt-pki-validate.in
>@@ -73,6 +73,7 @@ echo Found "$CERTOOL"
> #
> SYSCONFDIR="@sysconfdir@"
> PKI="$SYSCONFDIR/pki"
>+INITCONFDIR="@initconfdir@"
> if [ ! -d "$PKI" ]
> then
>     echo the $PKI directory is missing, it is usually
>@@ -294,24 +295,24 @@ fi
>
> if [ "$SERVER" = "1" ]
> then
>-    if [ -r "$SYSCONFDIR"/sysconfig/libvirtd ]
>+    if [ -r "$INITCONFDIR"/libvirtd ]
>     then
>-        if grep "^LIBVIRTD_ARGS.*--listen" "$SYSCONFDIR"/sysconfig/libvirtd \
>+        if grep "^LIBVIRTD_ARGS.*--listen" "$INITCONFDIR"/libvirtd \
>             >/dev/null 2>&1
>         then
>             :
>         else
>-            echo Make sure "$SYSCONFDIR"/sysconfig/libvirtd is setup to listen to
>+            echo Make sure "$INITCONFDIR"/libvirtd is setup to listen to
>             echo TCP/IP connections and restart the libvirtd service
>         fi
>     fi
>-    if [ -r "$SYSCONFDIR"/sysconfig/iptables ]
>+    if [ -r "$INITCONFDIR"/iptables ]
>     then
>-        if grep "$PORT" "$SYSCONFDIR"/sysconfig/iptables >/dev/null 2>&1
>+        if grep "$PORT" "$INITCONFDIR"/iptables >/dev/null 2>&1

This won't work on Gentoo for example which has only service
configuration options there, but since:

a) the check is not thorough at all
b) never worked there anyway
c) can't not work more than before

I think it's fine ;)

Reviewed-by: Martin Kletzander <mkletzan@redhat.com>


>         then
>             :
>         else
>-            echo Make sure "$SYSCONFDIR"/sysconfig/iptables is setup to allow
>+            echo Make sure "$INITCONFDIR"/iptables is setup to allow
>             echo incoming TCP/IP connections on port $PORT and
>             echo restart the iptables service
>         fi
>-- 
>2.40.1
>
Re: [libvirt PATCH 2/5] meson: Use initconfdir
Posted by Andrea Bolognani 1 year, 2 months ago
On Fri, May 05, 2023 at 01:34:50PM +0200, Martin Kletzander wrote:
> On Tue, May 02, 2023 at 07:15:49PM +0200, Andrea Bolognani wrote:
> > -    if [ -r "$SYSCONFDIR"/sysconfig/iptables ]
> > +    if [ -r "$INITCONFDIR"/iptables ]
> >     then
> > -        if grep "$PORT" "$SYSCONFDIR"/sysconfig/iptables >/dev/null 2>&1
> > +        if grep "$PORT" "$INITCONFDIR"/iptables >/dev/null 2>&1
>
> This won't work on Gentoo for example which has only service
> configuration options there, but since:
>
> a) the check is not thorough at all
> b) never worked there anyway
> c) can't not work more than before
>
> I think it's fine ;)

Yeah, the file doesn't exist at all on my Fedora machine, and the
documentation for RHEL 7 (!) says something about firewalld making it
obsolete. Debian doesn't seem to have it either.

The code has been the same since the script was introduced in 2009,
so I think it's just a consequence of the world changing around it.

We could probably look into dropping that part of the script, but
that's a task for someone else I think :)

-- 
Andrea Bolognani / Red Hat / Virtualization