fixed filecap not working in container builder

master 3.7.1.5
idziubenko 3 years ago
parent c4bbebac24
commit edbdb031ad

@ -1212,12 +1212,19 @@ class Builder(Update):
filecap = getProgPath("/usr/bin/filecap")
p = process(filecap, chroot_path)
with writeFile(pathJoin(chroot_path, self.cap_file)) as f:
column_shift = 0
for line in (x.strip() for x in p):
if not line or line.startswith("file"):
continue
fn, caps = line.partition(" ")[::2]
if line.startswith("set"):
# we don't need the first column at all
column_shift = 1
continue
line_split = line.split()
fn = line_split[0 + column_shift]
caps = line_split[1 + column_shift:]
fn = fn[len(chroot_path):]
f.write("%s %s\n"% (fn, " ".join(x.strip() for x in caps.split(","))))
f.write("%s %s\n"% (fn, " ".join(x.strip() for x in caps)))
return True
def clear_file_capabilities(self):

Loading…
Cancel
Save