windows process shim installer
Signed-off-by: Ameya Gawde <ameya.gawde@docker.com>
This commit is contained in:
20
install.go
20
install.go
@@ -21,6 +21,8 @@ import (
|
||||
"context"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
introspectionapi "github.com/containerd/containerd/api/services/introspection/v1"
|
||||
"github.com/containerd/containerd/archive"
|
||||
@@ -48,6 +50,15 @@ func (c *Client) Install(ctx context.Context, image Image, opts ...InstallOpts)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var binDir, libDir string
|
||||
if runtime.GOOS == "windows" {
|
||||
binDir = "Files\\bin"
|
||||
libDir = "Files\\lib"
|
||||
} else {
|
||||
binDir = "bin"
|
||||
libDir = "lib"
|
||||
}
|
||||
for _, layer := range manifest.Layers {
|
||||
ra, err := cs.ReaderAt(ctx, layer)
|
||||
if err != nil {
|
||||
@@ -60,9 +71,14 @@ func (c *Client) Install(ctx context.Context, image Image, opts ...InstallOpts)
|
||||
}
|
||||
if _, err := archive.Apply(ctx, path, r, archive.WithFilter(func(hdr *tar.Header) (bool, error) {
|
||||
d := filepath.Dir(hdr.Name)
|
||||
result := d == "bin"
|
||||
result := d == binDir
|
||||
|
||||
if config.Libs {
|
||||
result = result || d == "lib"
|
||||
result = result || d == libDir
|
||||
}
|
||||
|
||||
if runtime.GOOS == "windows" {
|
||||
hdr.Name = strings.Replace(hdr.Name, "Files", "", 1)
|
||||
}
|
||||
if result && !config.Replace {
|
||||
if _, err := os.Lstat(filepath.Join(path, hdr.Name)); err == nil {
|
||||
|
Reference in New Issue
Block a user