Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions cmd/umoci/raw-unpack.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ is the destination to unpack the image to.`,
Name: "keep-dirlinks",
Usage: "don't clobber underlying symlinks to directories",
},
cli.StringFlag{
Name: "start-from-digest",
Usage: "start unpacking from the given layer digest",
Value: "",
},
},

Action: rawUnpack,
Expand Down Expand Up @@ -134,6 +139,19 @@ func rawUnpack(ctx *cli.Context) (Err error) {
return fmt.Errorf("[internal error] unknown manifest blob type: %s", manifestBlob.Descriptor.MediaType)
}

startFromDigest := ctx.String("start-from-digest")
if startFromDigest != "" {
for _, layer := range manifest.Layers {
if layer.Digest.String() == startFromDigest {
unpackOptions.StartFrom = layer
break
}
}
if unpackOptions.StartFrom.MediaType == "" {
return fmt.Errorf("start-from-digest: %s not found in manifest", startFromDigest)
}
}

log.Warnf("unpacking rootfs ...")
if err := layer.UnpackRootfs(context.Background(), engineExt, rootfsPath, manifest, &unpackOptions); err != nil {
return fmt.Errorf("create rootfs: %w", err)
Expand Down
Loading