Skip to content

Commit 333a982

Browse files
authored
refactor: copy files using coreutils cp (#595)
1 parent a36ebe6 commit 333a982

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

oci/private/image.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ function base_from() {
4141
relative="$(coreutils realpath --relative-to="$OUTPUT/blobs/sha256" "$blob" --no-symlinks)"
4242
coreutils ln -s "$relative" "$OUTPUT/blobs/$relative_to_blobs"
4343
else
44-
coreutils cat "$blob" > "$OUTPUT/blobs/$relative_to_blobs"
44+
coreutils cp --no-preserve=mode "$blob" "$OUTPUT/blobs/$relative_to_blobs"
4545
fi
4646
done
47-
coreutils cat "$path/oci-layout" >"$OUTPUT/oci-layout"
47+
coreutils cp --no-preserve=mode "$path/oci-layout" "$OUTPUT/oci-layout"
4848
jq '.manifests[0].annotations["org.opencontainers.image.ref.name"] = "intermediate"' "$path/index.json" >"$OUTPUT/index.json"
4949
}
5050

@@ -110,7 +110,7 @@ function add_layer() {
110110
relative=$(coreutils realpath --no-symlinks --canonicalize-missing --relative-to="$OUTPUT/blobs/sha256" "$path" )
111111
coreutils ln --force --symbolic "$relative" "$output_path"
112112
else
113-
coreutils cat "$path" > "$output_path"
113+
coreutils cp --no-preserve=mode "$path" "$output_path"
114114
fi
115115
}
116116

oci/private/image_index.sh.tpl

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function add_image() {
2626
--argjson manifest "${manifest}" \
2727
'.manifests |= [$manifest + {"platform": $platform}]'\
2828
"${output_path}/manifest_list.json" > "${output_path}/manifest_list.new.json"
29-
cat "${output_path}/manifest_list.new.json" > "${output_path}/manifest_list.json"
29+
"${COREUTILS}" cp --no-preserve=mode "${output_path}/manifest_list.new.json" "${output_path}/manifest_list.json"
3030
done
3131
}
3232

@@ -36,7 +36,7 @@ function copy_blob() {
3636
local blob_image_relative_path="$3"
3737
local dest_path="${output_path}/${blob_image_relative_path}"
3838
mkdirp "$(dirname "${dest_path}")"
39-
"${COREUTILS}" cat "${image_path}/${blob_image_relative_path}" > "${dest_path}"
39+
"${COREUTILS}" cp --no-preserve=mode "${image_path}/${blob_image_relative_path}" "${dest_path}"
4040
}
4141

4242
function create_oci_layout() {

0 commit comments

Comments
 (0)