[libvirt PATCH 5/5] meson: Optimize handling of qemu_user and qemu_group

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

 



If the user has already provided us with the configuration they
want, there's no point in trying to come up with a reasonable
OS-specific default.

Suggested-by: Olaf Hering <olaf@xxxxxxxxx>
Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx>
---
 meson.build | 54 +++++++++++++++++++++++++----------------------------
 1 file changed, 25 insertions(+), 29 deletions(-)

diff --git a/meson.build b/meson.build
index 36ebe9aa2a..0e35d64fd1 100644
--- a/meson.build
+++ b/meson.build
@@ -1655,40 +1655,36 @@ if not get_option('driver_qemu').disabled()
     endif
     conf.set_quoted('QEMU_DATADIR', qemu_datadir)
 
-    if host_machine.system() in [ 'freebsd', 'darwin' ]
-      default_qemu_user = 'root'
-      default_qemu_group = 'wheel'
-    else
-      os_release = run_command('grep', '-E', '^ID(_LIKE)*=', '/etc/os-release', check: false).stdout()
-      if os_release.contains('arch')
-        default_qemu_user = 'nobody'
-        default_qemu_group = 'nobody'
-      elif (os_release.contains('fedora') or
-            os_release.contains('gentoo') or
-            os_release.contains('suse'))
-        default_qemu_user = 'qemu'
-        default_qemu_group = 'qemu'
-      elif os_release.contains('ubuntu')
-        default_qemu_user = 'libvirt-qemu'
-        default_qemu_group = 'kvm'
-      elif os_release.contains('debian')
-        default_qemu_user = 'libvirt-qemu'
-        default_qemu_group = 'libvirt-qemu'
-      else
-        default_qemu_user = 'root'
-        default_qemu_group = 'root'
-      endif
-    endif
     qemu_user = get_option('qemu_user')
     qemu_group = get_option('qemu_group')
     if (qemu_user == '' and qemu_group != '') or (qemu_user != '' and qemu_group == '')
       error('Please specify both qemu_user and qemu_group or neither of them')
     endif
-    if qemu_user == ''
-      qemu_user = default_qemu_user
-    endif
-    if qemu_group == ''
-      qemu_group = default_qemu_group
+    if qemu_user == '' and qemu_group == ''
+      if host_machine.system() in [ 'freebsd', 'darwin' ]
+        qemu_user = 'root'
+        qemu_group = 'wheel'
+      else
+        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('fedora') or
+              os_release.contains('gentoo') or
+              os_release.contains('suse'))
+          qemu_user = 'qemu'
+          qemu_group = 'qemu'
+        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'
+        endif
+      endif
     endif
     conf.set_quoted('QEMU_USER', qemu_user)
     conf.set_quoted('QEMU_GROUP', qemu_group)
-- 
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