[libvirt] PATCH: Fix RPM upgrades to create qemu user

Daniel P. Berrange berrange at redhat.com
Thu Jul 30 11:14:39 UTC 2009


If upgrading from F11 to F12 it is possible the qemu user/group does not
yet exist. Since the libvirt RPM needs to deploy files owned by this
user/group, regardless of whether QEMU is yet installed, we need to make
sure to create this user/group in %pre, otherwise fiels will end up with
wrong ownership.

Daniel

diff -u -p -r1.159 libvirt.spec
--- libvirt.spec	29 Jul 2009 14:58:18 -0000	1.159
+++ libvirt.spec	30 Jul 2009 11:06:53 -0000
@@ -419,6 +419,18 @@ chmod 0644 $RPM_BUILD_ROOT%{_sysconfdir}
 %clean
 rm -fr %{buildroot}
 
+%pre
+%if 0%{?fedora} >= 12
+# Normally 'setup' adds this in /etc/passwd, but this is
+# here for case of upgrades from earlier Fedora. This
+# UID/GID pair is reserved for qemu:qemu
+getent group kvm >/dev/null || groupadd -g 36 -r kvm
+getent group qemu >/dev/null || groupadd -g 107 -r qemu
+getent passwd qemu >/dev/null || \
+  useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \
+    -c "qemu user" qemu
+%endif
+
 %post
 
 %if %{with_libvirtd}


-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list