summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-08-23 14:01:20 -0400
committerGitHub <noreply@github.com>2021-08-23 14:01:20 -0400
commit90cf78b199772082025f22e4ebc0e30c133d2a88 (patch)
treee890e717d5b5ce7bc51821776607464a7759271d /utils
parent6a3741598cc30216a1a8db7d2c917e19bc37002b (diff)
parentedddfe8c4f7761b12dc64ea4aa0a83b755aa124f (diff)
downloadpodman-90cf78b199772082025f22e4ebc0e30c133d2a88.tar.gz
podman-90cf78b199772082025f22e4ebc0e30c133d2a88.tar.bz2
podman-90cf78b199772082025f22e4ebc0e30c133d2a88.zip
Merge pull request #11290 from flouthoc/volume-export
volumes: Add support for `volume export` which allows exporting content to external path.
Diffstat (limited to 'utils')
-rw-r--r--utils/utils.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/utils/utils.go b/utils/utils.go
index a2268a30b..2e415130e 100644
--- a/utils/utils.go
+++ b/utils/utils.go
@@ -107,6 +107,16 @@ func UntarToFileSystem(dest string, tarball *os.File, options *archive.TarOption
return archive.Untar(tarball, dest, options)
}
+// Creates a new tar file and wrties bytes from io.ReadCloser
+func CreateTarFromSrc(source string, dest string) error {
+ file, err := os.Create(dest)
+ if err != nil {
+ return errors.Wrapf(err, "Could not create tarball file '%s'", dest)
+ }
+ defer file.Close()
+ return TarToFilesystem(source, file)
+}
+
// TarToFilesystem creates a tarball from source and writes to an os.file
// provided
func TarToFilesystem(source string, tarball *os.File) error {