Add lib support as an option

Some images like `criu` will have extra libs that it requires.  This
adds lib support via LD_LIBRARY_PATH and InstallOpts

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby
2018-08-01 15:49:39 -04:00
parent 1537f31381
commit 5a47c5ec1d
9 changed files with 101 additions and 11 deletions

View File

@@ -20,6 +20,7 @@ import (
"fmt"
"os"
"path/filepath"
"runtime"
"github.com/containerd/containerd/plugin"
"github.com/pkg/errors"
@@ -49,6 +50,15 @@ func init() {
if err := os.Setenv("PATH", fmt.Sprintf("%s:%s", bin, os.Getenv("PATH"))); err != nil {
return nil, errors.Wrapf(err, "set binary image directory in path %s", bin)
}
if runtime.GOOS != "windows" {
lib := filepath.Join(path, "lib")
if err := os.MkdirAll(lib, 0711); err != nil {
return nil, err
}
if err := os.Setenv("LD_LIBRARY_PATH", fmt.Sprintf("%s:%s", os.Getenv("LD_LIBRARY_PATH"), lib)); err != nil {
return nil, errors.Wrapf(err, "set binary lib directory in path %s", lib)
}
}
return &manager{}, nil
},
})