[libvirt PATCH 5/5] meson: Improve initconfdir defaults

Andrea Bolognani posted 5 patches 1 year, 2 months ago
[libvirt PATCH 5/5] meson: Improve initconfdir defaults
Posted by Andrea Bolognani 1 year, 2 months ago
Keep /etc/sysconfig as the fallback, but pick more suitable
values for various Linux distros.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
 meson.build | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index 8848e58995..f04703b810 100644
--- a/meson.build
+++ b/meson.build
@@ -83,7 +83,16 @@ endif
 
 initconfdir = get_option('initconfdir')
 if initconfdir == ''
-  initconfdir = sysconfdir / 'sysconfig'
+  if (os_release.contains('alpine') or
+      os_release.contains('arch') or
+      os_release.contains('gentoo'))
+    initconfdir = sysconfdir / 'conf.d'
+  # Ubuntu has ID_LIKE=debian
+  elif os_release.contains('debian')
+    initconfdir = sysconfdir / 'default'
+  else
+    initconfdir = sysconfdir / 'sysconfig'
+  endif
 endif
 
 bindir = prefix / get_option('bindir')
-- 
2.40.1
Re: [libvirt PATCH 5/5] meson: Improve initconfdir defaults
Posted by Martin Kletzander 1 year, 2 months ago
On Tue, May 02, 2023 at 07:15:52PM +0200, Andrea Bolognani wrote:
>Keep /etc/sysconfig as the fallback, but pick more suitable
>values for various Linux distros.
>
>Signed-off-by: Andrea Bolognani <abologna@redhat.com>
>---
> meson.build | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
>diff --git a/meson.build b/meson.build
>index 8848e58995..f04703b810 100644
>--- a/meson.build
>+++ b/meson.build
>@@ -83,7 +83,16 @@ endif
>
> initconfdir = get_option('initconfdir')
> if initconfdir == ''
>-  initconfdir = sysconfdir / 'sysconfig'
>+  if (os_release.contains('alpine') or
>+      os_release.contains('arch') or
>+      os_release.contains('gentoo'))

I can't vouch for all of these, but from my limited memory and
search-engine-fu I think you're right here.  There might be more and
more caveats when migrated to systemd for example, especially with
custom envvar files, but that's beside the point here.

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

>+    initconfdir = sysconfdir / 'conf.d'
>+  # Ubuntu has ID_LIKE=debian
>+  elif os_release.contains('debian')
>+    initconfdir = sysconfdir / 'default'
>+  else
>+    initconfdir = sysconfdir / 'sysconfig'
>+  endif
> endif
>
> bindir = prefix / get_option('bindir')
>-- 
>2.40.1
>
Re: [libvirt PATCH 5/5] meson: Improve initconfdir defaults
Posted by Andrea Bolognani 1 year, 2 months ago
On Fri, May 05, 2023 at 01:37:59PM +0200, Martin Kletzander wrote:
> On Tue, May 02, 2023 at 07:15:52PM +0200, Andrea Bolognani wrote:
> > initconfdir = get_option('initconfdir')
> > if initconfdir == ''
> > -  initconfdir = sysconfdir / 'sysconfig'
> > +  if (os_release.contains('alpine') or
> > +      os_release.contains('arch') or
> > +      os_release.contains('gentoo'))
>
> I can't vouch for all of these, but from my limited memory and
> search-engine-fu I think you're right here.  There might be more and
> more caveats when migrated to systemd for example, especially with
> custom envvar files, but that's beside the point here.

I've just looked at what the official package in each distribution is
doing:

https://git.alpinelinux.org/aports/tree/community/libvirt/APKBUILD#n131
https://github.com/archlinux/svntogit-community/blob/packages/libvirt/trunk/PKGBUILD#L93-L101
https://gitweb.gentoo.org/repo/gentoo.git/tree/app-emulation/libvirt/files/libvirtd.confd-r5#n1
https://salsa.debian.org/libvirt-team/libvirt/-/blob/debian/latest/debian/patches/debian/Debianize-systemd-service-files.patch#L48

We can always tweak things later, of course.

Thanks for the review! I'll push the patches now :)

-- 
Andrea Bolognani / Red Hat / Virtualization