test: Preserve attributes on copy

When creating the fullfile and installing the bundle in targetfs we
need to preserve the owner and mode of file

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
This commit is contained in:
Otavio Pontes
2020-04-16 13:52:29 -07:00
parent 9edb70023c
commit 669dfe09cf
+2 -2
View File
@@ -2918,7 +2918,7 @@ add_content_to_bundle() {
# the file is a file or symlink, copy it to the files directory
# (do not follow links)
debug_msg "Copying file/symlink $content_dir/$filename to $files_dir/$filehash..."
sudo cp -P "$content_dir"/"$filename" "$files_dir"/"$filehash"
sudo cp --preserve=all -P "$content_dir"/"$filename" "$files_dir"/"$filehash"
fi
# create the tar for each file, we need to skip validations since
@@ -3042,7 +3042,7 @@ create_bundle_from_content() { #swupd_function
# If the user chose to install the bundle, copy all files to the target directory
if [ "$local_bundle" = true ]; then
debug_msg "Installing $bundle_name in target $target_dir..."
sudo cp -r "$content_dir"/* "$target_dir"/
sudo cp --preserve=all -r "$content_dir"/* "$target_dir"/
fi
# If the user chose to track the bundle, create the tracking file for the bundle