mirror of
https://github.com/SELinuxProject/selinux
synced 2025-01-16 02:10:55 +00:00
73b7ff410c
When calling "sepolgen generate" to automatically generate a SELinux policy template, the command fails when it cannot invoke RPM related commands on Linux distributions that do not support RPM by default: Failed to retrieve rpm info for selinux-policy Traceback (most recent call last): File "/usr/lib/python-exec/python2.7/sepolicy", line 643, in <module> args.func(args) File "/usr/lib/python-exec/python2.7/sepolicy", line 517, in generate print mypolicy.generate(args.path) File "/usr/lib64/python2.7/site-packages/sepolicy/generate.py", line 1370, in generate out += "%s # %s\n" % (self.write_spec(out_dir), _("Spec file")) File "/usr/lib64/python2.7/site-packages/sepolicy/generate.py", line 1219, in write_spec fd.write(self.generate_spec()) File "/usr/lib64/python2.7/site-packages/sepolicy/generate.py", line 1181, in generate_spec selinux_policyver = get_rpm_nvr_list("selinux-policy")[1] TypeError: 'NoneType' object has no attribute '__getitem__' As the RPM related steps are only needed on RPM-enabled distributions, we should ignore these steps on other Linux distribution platforms. In this patch, we use the Python platform module to get the Linux distribution, and only start the RPM-related activities on Linux distributions that use RPM as their native package manager. Signed-off-by: Sven Vermeulen <sven.vermeulen@siphos.be> |
||
---|---|---|
checkpolicy | ||
libselinux | ||
libsemanage | ||
libsepol | ||
policycoreutils | ||
scripts | ||
secilc | ||
sepolgen | ||
.gitignore | ||
Android.mk | ||
CleanSpec.mk | ||
Makefile | ||
README |
Please submit all bug reports and patches to selinux@tycho.nsa.gov. Subscribe via selinux-join@tycho.nsa.gov. Build dependencies on Fedora: yum install audit-libs-devel bison bzip2-devel dbus-devel dbus-glib-devel flex flex-devel flex-static glib2-devel libcap-devel libcap-ng-devel pam-devel pcre-devel python-devel setools-devel swig ustr-devel To build and install everything under a private directory, run: make DESTDIR=~/obj install install-pywrap To install as the default system libraries and binaries (overwriting any previously installed ones - dangerous!), on x86_64, run: make LIBDIR=/usr/lib64 SHLIBDIR=/lib64 install install-pywrap relabel or on x86 (32-bit), run: make install install-pywrap relabel This may render your system unusable if the upstream SELinux userspace lacks library functions or other dependencies relied upon by your distribution. If it breaks, you get to keep both pieces.