buildinstall: Copy file without preserving owner

The files are generally owned by root. If the compose is running as
root, this will still create files owned by root. If it's running as
non-priviledged user, it will crash. With this patch it will work.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2018-07-12 09:57:12 +02:00
parent e3de4dcccf
commit 60917fdc77
1 changed files with 6 additions and 2 deletions

View File

@ -316,7 +316,9 @@ def tweak_buildinstall(compose, src, dst, arch, variant, label, volid, kickstart
# copy src to temp
# TODO: place temp on the same device as buildinstall dir so we can hardlink
cmd = "cp -av --remove-destination %s/* %s/" % (shlex_quote(src), shlex_quote(tmp_dir))
cmd = "cp -dRv --preserve=mode,links,timestamps --remove-destination %s/* %s/" % (
shlex_quote(src), shlex_quote(tmp_dir)
)
run(cmd)
found_configs = tweak_configs(tmp_dir, volid, kickstart_file)
@ -345,7 +347,9 @@ def tweak_buildinstall(compose, src, dst, arch, variant, label, volid, kickstart
run("chmod -R a+rX %s" % shlex_quote(tmp_dir))
# copy temp to dst
cmd = "cp -av --remove-destination %s/* %s/" % (shlex_quote(tmp_dir), shlex_quote(dst))
cmd = "cp -dRv --preserve=mode,links,timestamps --remove-destination %s/* %s/" % (
shlex_quote(tmp_dir), shlex_quote(dst)
)
run(cmd)
shutil.rmtree(tmp_dir)