Add selinux switch to mktar
Sometimes you don't want to include the selinux xattrs in the tar (eg. bsdtar has problems extracting them). They are still included by default, but pass selinux=False to remove '--selinux --acls --xattrs' from the tar cmdline.
This commit is contained in:
parent
6ccebefc26
commit
9ba304d74b
@ -80,10 +80,13 @@ def mkcpio(rootdir, outfile, compression="xz", compressargs=None):
|
||||
return compress(["cpio", "--null", "--quiet", "-H", "newc", "-o"],
|
||||
rootdir, outfile, compression, compressargs)
|
||||
|
||||
def mktar(rootdir, outfile, compression="xz", compressargs=None):
|
||||
def mktar(rootdir, outfile, compression="xz", compressargs=None, selinux=True):
|
||||
compressargs = compressargs or ["-9"]
|
||||
return compress(["tar", "--no-recursion", "--selinux", "--acls", "--xattrs", "-cf-", "--null", "-T-"],
|
||||
rootdir, outfile, compression, compressargs)
|
||||
tar_cmd = ["tar", "--no-recursion"]
|
||||
if selinux:
|
||||
tar_cmd += ["--selinux", "--acls", "--xattrs"]
|
||||
tar_cmd += ["-cf-", "--null", "-T-"]
|
||||
return compress(tar_cmd, rootdir, outfile, compression, compressargs)
|
||||
|
||||
def mksquashfs(rootdir, outfile, compression="default", compressargs=None):
|
||||
'''Make a squashfs image containing the given rootdir.'''
|
||||
|
Loading…
Reference in New Issue
Block a user