diff -up libselinux-2.0.94/src/selinuxswig_python.i.chcon libselinux-2.0.94/src/selinuxswig_python.i --- libselinux-2.0.94/src/selinuxswig_python.i.chcon 2010-08-23 10:23:50.000000000 -0400 +++ libselinux-2.0.94/src/selinuxswig_python.i 2010-08-23 10:23:54.000000000 -0400 @@ -21,6 +21,14 @@ def restorecon(path, recursive=False): map(restorecon, [os.path.join(dirname, fname) for fname in fnames]), None) +def chcon(path, context, recursive=False): + """ Set the SELinux context on a given path """ + lsetfilecon(path, context) + if recursive: + for root, dirs, files in os.walk(path): + for name in files + dirs: + lsetfilecon(os.path.join(root,name), context) + def copytree(src, dest): """ An SELinux-friendly shutil.copytree method """ shutil.copytree(src, dest)