rpms/python-virtinst/devel virtinst-0.400.3-selinux-context.patch, NONE, 1.1 python-virtinst.spec, 1.61, 1.62

Daniel P. Berrange berrange at fedoraproject.org
Fri Apr 3 17:17:34 UTC 2009


Author: berrange

Update of /cvs/pkgs/rpms/python-virtinst/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv16782

Modified Files:
	python-virtinst.spec 
Added Files:
	virtinst-0.400.3-selinux-context.patch 
Log Message:
Set SELinux context on $HOME/.virtinst to make kernel/initrd boot work (rhbz #491052)

virtinst-0.400.3-selinux-context.patch:

--- NEW FILE virtinst-0.400.3-selinux-context.patch ---
diff -rup virtinst-0.400.3.orig/virtinst/Installer.py virtinst-0.400.3.new/virtinst/Installer.py
--- virtinst-0.400.3.orig/virtinst/Installer.py	2009-03-10 03:32:15.000000000 +0000
+++ virtinst-0.400.3.new/virtinst/Installer.py	2009-04-03 18:15:10.000000000 +0100
@@ -136,12 +136,28 @@ class Installer(object):
     def get_scratchdir(self):
         if platform.system() == 'SunOS':
             return '/var/tmp'
-        if self.type == "xen" and os.path.exists(XEN_SCRATCH):
+        if os.geteuid() == 0 and self.type == "xen" and os.path.exists(XEN_SCRATCH):
             return XEN_SCRATCH
         if os.geteuid() == 0 and os.path.exists(LIBVIRT_SCRATCH):
             return LIBVIRT_SCRATCH
-        else:
-            return os.path.expanduser("~/.virtinst/boot")
+
+        appdir = os.path.expanduser("~/.virtinst")
+        bootdir = appdir + "/boot"
+        # Try and make directory immediately and set selinux
+        # context if possible
+        try:
+            import selinux
+            if not os.access(appdir, os.W_OK):
+                os.mkdir(appdir)
+            if not os.access(bootdir, os.W_OK):
+                os.mkdir(bootdir)
+            selinux.restorecon(bootdir, recursive=True)
+            logging.info("Restored SELinux context on %s" % bootdir)
+        except Exception, e:
+            logging.error("Unable to restore SELinux context on %s: %s" % (bootdir, str(e)))
+            pass
+
+        return bootdir
     scratchdir = property(get_scratchdir)
 
     def get_cdrom(self):


Index: python-virtinst.spec
===================================================================
RCS file: /cvs/pkgs/rpms/python-virtinst/devel/python-virtinst.spec,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -r1.61 -r1.62
--- python-virtinst.spec	23 Mar 2009 20:56:47 -0000	1.61
+++ python-virtinst.spec	3 Apr 2009 17:17:04 -0000	1.62
@@ -17,11 +17,12 @@
 Summary: Python modules and utilities for installing virtual machines
 Name: python-%{appname}
 Version: 0.400.3
-Release: 2%{_extra_release}
+Release: 3%{_extra_release}
 Source0: http://virt-manager.org/download/sources/%{appname}/%{appname}-%{version}.tar.gz
 Patch1: %{appname}-%{version}-fix-virtimage-scratch.patch
 Patch2: %{appname}-%{version}-hostdev-libvirt-calls.patch
 Patch3: %{appname}-%{version}-spanish-trans.patch
+Patch4: %{appname}-%{version}-selinux-context.patch
 License: GPLv2+
 Group: Development/Libraries
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@@ -50,6 +51,7 @@
 %patch1 -p1
 %patch2 -p1
 %patch3 -p1
+%patch4 -p1
 
 %build
 python setup.py build
@@ -85,6 +87,9 @@
 %{_bindir}/virt-convert
 
 %changelog
+* Fri Apr  3 2009 Daniel P. Berrange <berrange at redhat.com> - 0.400.3-fc11
+- Set SELinux context on $HOME/.virtinst to make kernel/initrd boot work (rhbz #491052)
+
 * Mon Mar 23 2009 Cole Robinson <crobinso at redhat.com> - 0.400.3-2.fc11
 - Add spanish translation (bz 480816)
 - Fix calls to libvirt host device detach/reset




More information about the scm-commits mailing list