On Tue, 2019-03-26 at 16:20 +0000, Daniel P. Berrangé wrote:
On Tue, Mar 26, 2019 at 05:06:15PM +0100, Andrea Bolognani wrote:
> + # Try to integrate gracefully with downstream packages by running QEMU
> + # processes under the same user and group they would
> + case $(grep ^ID= /etc/os-release 2>/dev/null) in
> + *arch*)
> + default_qemu_user=nobody
> + default_qemu_group=nobody
> + ;;
> + *centos*|*fedora*|*gentoo*|*rhel*|*suse*)
> + default_qemu_user=qemu
> + default_qemu_group=qemu
> + ;;
> + *debian*)
> + default_qemu_user=libvirt-qemu
> + default_qemu_group=libvirt-qemu
> + ;;
> + *ubuntu*)
> + default_qemu_user=libvirt-qemu
> + default_qemu_group=kvm
> + ;;
Or this needs to gain...
*)
default_qemu_user=root
default_qemu_group=root
> + if ! getent passwd "$default_qemu_user" >/dev/null 2>&1 ||
\
> + ! getent group "$default_qemu_group" >/dev/null 2>&1;
then
otherwise these are passing an empty string to getent which
feels dubious. Even if empty string works I wouldn't want to
rely on that.
A (quoted) empty string work exactly the way you'd expect it to, in
that it will make the command fail every single time. But sure, I can
do the more obviously correct thing and add the default case above if
you prefer that :)
> + default_qemu_user=root
> + default_qemu_group=root
We ought to issue a warning if the expected user/group doesn't
actually exist.
You got it. v3 coming right up.
--
Andrea Bolognani / Red Hat / Virtualization