From 82a53b9ae4f3be9b9a8dbf5c3012ec5a8832af16 Mon Sep 17 00:00:00 2001
From: Thomas Woerner <twoerner@redhat.com>
Date: Tue, 19 Nov 2024 15:08:46 +0100
Subject: [PATCH] infra/image/shcontainer: New container_copy and
 container_fetch

container_copy can be used to copy a file to the container,
container_fetch can be used to copy a file from the container.

For more information, please have a look at the podman-cp man page.
---
 infra/image/shcontainer | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/infra/image/shcontainer b/infra/image/shcontainer
index 0bc3326..8b736ce 100644
--- a/infra/image/shcontainer
+++ b/infra/image/shcontainer
@@ -175,3 +175,23 @@ container_image_list() {
 container_check() {
     [ -n "$(command -v "podman")" ] || die "podman is required."
 }
+
+container_copy() {
+    local name="${1}"
+    local source="${2}"
+    local destination="${3}"
+
+    log info "= Copying ${source} to ${name}:${destination} ="
+    podman cp "${source}" "${name}:${destination}"
+    echo
+}
+
+container_fetch() {
+    local name="${1}"
+    local source="${2}"
+    local destination="${3}"
+
+    log info "= Copying ${name}:${source} to ${destination} ="
+    podman cp "${name}:${source}" "${destination}"
+    echo
+}
-- 
GitLab