mirror of
https://github.com/mudler/luet.git
synced 2025-09-04 08:45:40 +00:00
Update gomod and vendor
This commit is contained in:
42
vendor/github.com/moby/buildkit/util/binfmt_misc/check.go
generated
vendored
Normal file
42
vendor/github.com/moby/buildkit/util/binfmt_misc/check.go
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
package binfmt_misc
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"compress/gzip"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
func check(bin string) error {
|
||||
tmpdir, err := ioutil.TempDir("", "qemu-check")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer os.RemoveAll(tmpdir)
|
||||
pp := filepath.Join(tmpdir, "check")
|
||||
|
||||
r, err := gzip.NewReader(bytes.NewReader([]byte(bin)))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer r.Close()
|
||||
|
||||
f, err := os.OpenFile(pp, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0700)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if _, err := io.Copy(f, r); err != nil {
|
||||
f.Close()
|
||||
return err
|
||||
}
|
||||
f.Close()
|
||||
|
||||
cmd := exec.Command("/check")
|
||||
withChroot(cmd, tmpdir)
|
||||
err = cmd.Run()
|
||||
return err
|
||||
}
|
Reference in New Issue
Block a user