mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-20 09:39:08 +00:00
add ability to export filesystem
Signed-off-by: Avi Deitcher <avi@deitcher.net>
This commit is contained in:
parent
1cf22ed0ac
commit
7e65df33be
@ -18,6 +18,7 @@ func cacheExport(args []string) {
|
||||
cacheDir := fs.String("cache", defaultLinuxkitCache(), "Directory for caching and finding cached image")
|
||||
arch := fs.String("arch", runtime.GOARCH, "Architecture to resolve an index to an image, if the provided image name is an index")
|
||||
outfile := fs.String("outfile", "", "Path to file to save output, '-' for stdout")
|
||||
format := fs.String("format", "oci", "export format, one of 'oci', 'filesystem'")
|
||||
|
||||
if err := fs.Parse(args); err != nil {
|
||||
log.Fatal("Unable to parse args")
|
||||
@ -45,7 +46,15 @@ func cacheExport(args []string) {
|
||||
}
|
||||
|
||||
src := p.NewSource(&ref, *arch, desc)
|
||||
reader, err := src.V1TarReader()
|
||||
var reader io.ReadCloser
|
||||
switch *format {
|
||||
case "oci":
|
||||
reader, err = src.V1TarReader()
|
||||
case "filesystem":
|
||||
reader, err = src.TarReader()
|
||||
default:
|
||||
log.Fatalf("requested unknown format %s: %v", name, err)
|
||||
}
|
||||
if err != nil {
|
||||
log.Fatalf("error getting reader for image %s: %v", name, err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user