aboutsummaryrefslogtreecommitdiff
path: root/linaro_image_tools/media_create/chroot_utils.py
diff options
context:
space:
mode:
authorRicardo Salveti <ricardo.salveti@linaro.org>2015-10-25 23:48:16 -0200
committerRicardo Salveti <ricardo.salveti@linaro.org>2015-10-26 02:48:56 -0200
commit7f08d927635e86c8f24c5b8ab5a2b88f70b1d257 (patch)
tree720ae754e1dec1f5686f836bfbd14077a5d0ee8d /linaro_image_tools/media_create/chroot_utils.py
parente9c31ef7daf440d2af7925d20b3392d1f8580543 (diff)
chroot_utils: check for links and copy with --archive
This allows overwriting links and also move them back after creating the image, with the original permission and properties. Change-Id: I3f1b8848d0d66f9a0d7bc4dfd5e3509ddb7ac438 Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
Diffstat (limited to 'linaro_image_tools/media_create/chroot_utils.py')
-rw-r--r--linaro_image_tools/media_create/chroot_utils.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/linaro_image_tools/media_create/chroot_utils.py b/linaro_image_tools/media_create/chroot_utils.py
index 7997ee3..6d60866 100644
--- a/linaro_image_tools/media_create/chroot_utils.py
+++ b/linaro_image_tools/media_create/chroot_utils.py
@@ -219,14 +219,14 @@ def temporarily_overwrite_file_on_dir(filepath, directory, tmp_dir):
path_to_orig = os.path.join(tmp_dir, basename)
# Move the existing file from the given directory to the temp dir.
oldpath = os.path.join(directory, basename)
- if os.path.exists(oldpath):
+ if os.path.lexists(oldpath):
cmd_runner.run(
['mv', '-f', oldpath, path_to_orig], as_root=True).wait()
# Now copy the given file onto the given directory.
- cmd_runner.run(['cp', filepath, directory], as_root=True).wait()
+ cmd_runner.run(['cp', '-a', filepath, directory], as_root=True).wait()
def undo():
- if os.path.exists(path_to_orig):
+ if os.path.lexists(path_to_orig):
cmd_runner.run(
['mv', '-f', path_to_orig, directory], as_root=True).wait()
else: