[libvirt PATCH v2 1/1] meson: Check for os-release's ID_LIKE in addition to ID

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx>
---
 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




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux