policycoreutils: gui: polgen: search for systemd subpackage when generating policy

A number of packages have a systemd subpackage.  Look for those when
doing the file list of a package to generate its policy.

Signed-off-by: Eric Paris <eparis@redhat.com>
This commit is contained in:
Miroslav Grepl 2012-04-26 13:53:14 -04:00 committed by Eric Paris
parent e4bbd7cfa8
commit 71f68548a5

View File

@ -1140,6 +1140,22 @@ allow %s_t %s_t:%s_socket name_%s;
else: else:
self.add_dir(f) self.add_dir(f)
fd.close() fd.close()
# some packages have own systemd subpackage
# tor-systemd for example
binary_name = self.program.split("/")[-1]
rc, output = commands.getstatusoutput("rpm -q %s-systemd" % binary_name)
if rc == 0:
fd = os.popen("rpm -ql %s-systemd" % binary_name)
for f in fd.read().split():
for b in self.DEFAULT_DIRS:
if f.startswith(b):
if os.path.isfile(f):
self.add_file(f)
else:
self.add_dir(f)
fd.close()
if os.path.isfile("/var/run/%s.pid" % self.name): if os.path.isfile("/var/run/%s.pid" % self.name):
self.add_file("/var/run/%s.pid" % self.name) self.add_file("/var/run/%s.pid" % self.name)