[libvirt PATCH v2 0/1] meson: Fixes and improvements to handling of qemu_user and qemu_group

Changes from [v1]: * most patches have been pushed; * added comments. [v1] https://listman.redhat.com/archives/libvir-list/2022-January/msg01189.html Andrea Bolognani (1): meson: Check for os-release's ID_LIKE in addition to ID meson.build | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) -- 2.34.1

This makes it possible to reduce the number of cases we have to consider, because 'sles' declares itself to be like 'suse' and both 'rhel' and 'centos' declare themselves to be like 'fedora'. We have to move the check for Ubuntu before the one for Debian, however, because 'ubuntu' declares itself to be like 'debian' and it would end up with the wrong defaults otherwise. Suggested-by: Olaf Hering <olaf@aepfle.de> Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- meson.build | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/meson.build b/meson.build index 0e6f0f22fc..5f49ad0f3e 100644 --- a/meson.build +++ b/meson.build @@ -1665,24 +1665,23 @@ if not get_option('driver_qemu').disabled() qemu_user = 'root' qemu_group = 'wheel' else - os_release = run_command('grep', '^ID=', '/etc/os-release', check: false).stdout() + os_release = run_command('grep', '-E', '^ID(_LIKE)*=', '/etc/os-release', check: false).stdout() if os_release.contains('arch') qemu_user = 'nobody' qemu_group = 'nobody' - elif (os_release.contains('centos') or - os_release.contains('fedora') or + # RHEL and CentOS both have ID_LIKE=fedora, SLES has ID_LIKE=suse + elif (os_release.contains('fedora') or os_release.contains('gentoo') or - os_release.contains('rhel') or - os_release.contains('sles') or os_release.contains('suse')) qemu_user = 'qemu' qemu_group = 'qemu' - elif os_release.contains('debian') - qemu_user = 'libvirt-qemu' - qemu_group = 'libvirt-qemu' + # Ubuntu has ID_LIKE=debian so we need to handle it first elif os_release.contains('ubuntu') qemu_user = 'libvirt-qemu' qemu_group = 'kvm' + elif os_release.contains('debian') + qemu_user = 'libvirt-qemu' + qemu_group = 'libvirt-qemu' else qemu_user = 'root' qemu_group = 'root' -- 2.34.1

On Thu, Jan 27, 2022 at 12:00:18PM +0100, Andrea Bolognani wrote:
This makes it possible to reduce the number of cases we have to consider, because 'sles' declares itself to be like 'suse' and both 'rhel' and 'centos' declare themselves to be like 'fedora'.
We have to move the check for Ubuntu before the one for Debian, however, because 'ubuntu' declares itself to be like 'debian' and it would end up with the wrong defaults otherwise.
Suggested-by: Olaf Hering <olaf@aepfle.de> Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- meson.build | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
ping -- Andrea Bolognani / Red Hat / Virtualization

On Tue, Feb 15, 2022 at 01:38:47PM -0500, Andrea Bolognani wrote:
On Thu, Jan 27, 2022 at 12:00:18PM +0100, Andrea Bolognani wrote:
This makes it possible to reduce the number of cases we have to consider, because 'sles' declares itself to be like 'suse' and both 'rhel' and 'centos' declare themselves to be like 'fedora'.
We have to move the check for Ubuntu before the one for Debian, however, because 'ubuntu' declares itself to be like 'debian' and it would end up with the wrong defaults otherwise.
Suggested-by: Olaf Hering <olaf@aepfle.de> Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- meson.build | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
ping
ping_2 -- Andrea Bolognani / Red Hat / Virtualization

On 1/27/22 12:00, Andrea Bolognani wrote:
This makes it possible to reduce the number of cases we have to consider, because 'sles' declares itself to be like 'suse' and both 'rhel' and 'centos' declare themselves to be like 'fedora'.
We have to move the check for Ubuntu before the one for Debian, however, because 'ubuntu' declares itself to be like 'debian' and it would end up with the wrong defaults otherwise.
Suggested-by: Olaf Hering <olaf@aepfle.de> Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- meson.build | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Michal
participants (2)
-
Andrea Bolognani
-
Michal Prívozník