Skip to content

Commit 28fc85e

Browse files
author
zhouhao
committed
unpack-main.go:
Signed-off-by: zhouhao <[email protected]>
1 parent 0a1e5dc commit 28fc85e

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

cmd/oci-create-runtime-bundle/main.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,6 @@ func (v *bundleCmd) Run(cmd *cobra.Command, args []string) {
109109
os.Exit(1)
110110
}
111111

112-
if _, err := os.Stat(args[1]); os.IsNotExist(err) {
113-
v.stderr.Printf("destination path %s does not exist", args[1])
114-
os.Exit(1)
115-
}
116-
117112
if v.typ == "" {
118113
typ, err := image.Autodetect(args[0])
119114
if err != nil {

image/image.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,16 @@ func createRuntimeBundle(w walker, dest, refName, rootfs string) error {
180180
return err
181181
}
182182

183+
if _, err = os.Stat(dest); err != nil {
184+
if os.IsNotExist(err) {
185+
if err2 := os.MkdirAll(dest, 0755); err2 != nil {
186+
return err2
187+
}
188+
} else {
189+
return err
190+
}
191+
}
192+
183193
err = m.unpack(w, filepath.Join(dest, rootfs))
184194
if err != nil {
185195
return err

0 commit comments

Comments
 (0)