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"],
|
return compress(["cpio", "--null", "--quiet", "-H", "newc", "-o"],
|
||||||
rootdir, outfile, compression, compressargs)
|
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"]
|
compressargs = compressargs or ["-9"]
|
||||||
return compress(["tar", "--no-recursion", "--selinux", "--acls", "--xattrs", "-cf-", "--null", "-T-"],
|
tar_cmd = ["tar", "--no-recursion"]
|
||||||
rootdir, outfile, compression, compressargs)
|
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):
|
def mksquashfs(rootdir, outfile, compression="default", compressargs=None):
|
||||||
'''Make a squashfs image containing the given rootdir.'''
|
'''Make a squashfs image containing the given rootdir.'''
|
||||||
|
Loading…
Reference in New Issue
Block a user